class Cython < Formula desc "Compiler for writing C extensions for the Python language" homepage "https://cython.org/" url "https://files.pythonhosted.org/packages/f0/f8/7f406aac4c6919d5a4ce16509bbe059cd256e9ad94bae5ccac14094b7c51/Cython-0.29.1.tar.gz" sha256 "18ab7646985a97e02cee72e1ddba2e732d4931d4e1732494ff30c5aa084bfb97" bottle do cellar :any_skip_relocation sha256 "a62c02999e5c8b497df68e6acc77bdeffdbc68674f61af574cd639210482a5e0" => :mojave sha256 "f657fbd738b85e805bf00d0abbdb100d88e586ac6bb0dd0e9ff3000c3ed4a605" => :high_sierra sha256 "95370d7551b1aacab4564c03b58cc3a9d39fa6bf76eb5e4875752210af9efe9b" => :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