class Cython < Formula desc "Compiler for writing C extensions for the Python language" homepage "https://cython.org/" url "https://files.pythonhosted.org/packages/9c/9b/706dac7338c2860cd063a28cdbf5e9670995eaea408abbf2e88ba070d90d/Cython-0.29.14.tar.gz" sha256 "e4d6bb8703d0319eb04b7319b12ea41580df44fd84d83ccda13ea463c6801414" bottle do cellar :any_skip_relocation sha256 "2d2a1514ce57cc7cdec29ce6e470394c787b8d202bef1cc9dd3ae5f13a386df1" => :catalina sha256 "ea89b8f5d7ac15cf0bb9bea4e4dfa8011f6e81e0f32a4469bdfd89f14113a790" => :mojave sha256 "0ffc5add1581ec19b84eb515096f423f8e797a6d0c8de0bb40fd290ad86e0eb6" => :high_sierra end keg_only <<~EOS this formula is mainly used internally by other formulae. Users are advised to use `pip` to install cython EOS depends_on "python" def install xy = Language::Python.major_minor_version "python3" ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages" system "python3", *Language::Python.setup_install_args(libexec) bin.install Dir[libexec/"bin/*"] bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"]) end test do xy = Language::Python.major_minor_version "python3" ENV.prepend_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages" phrase = "You are using Homebrew" (testpath/"package_manager.pyx").write "print '#{phrase}'" (testpath/"setup.py").write <<~EOS from distutils.core import setup from Cython.Build import cythonize setup( ext_modules = cythonize("package_manager.pyx") ) EOS system "python3", "setup.py", "build_ext", "--inplace" assert_match phrase, shell_output("python3 -c 'import package_manager'") end end