homebrew-core/Formula/cython.rb
2017-05-24 06:24:33 -07:00

45 lines
1.6 KiB
Ruby

class Cython < Formula
desc "Compiler for writing C extensions for the Python language"
homepage "http://cython.org"
url "https://pypi.python.org/packages/b7/67/7e2a817f9e9c773ee3995c1e15204f5d01c8da71882016cac10342ef031b/Cython-0.25.2.tar.gz"
sha256 "f141d1f9c27a07b5a93f7dc5339472067e2d7140d1c5a9e20112a5665ca60306"
bottle do
cellar :any_skip_relocation
sha256 "8d07c028127e8664c7205b3b03391a6d61715da0b0786392202e5637bf9e95e8" => :sierra
sha256 "bdb424de2643b23a8f9e6082f69de09e3914140b99ec134dbd73665a3c6abc47" => :el_capitan
sha256 "c464b7984210219436fd918b6441d569f6f17ce7a274be92d501af8c401237d1" => :yosemite
end
keg_only <<-EOS.undent
this formula is mainly used internally by other formulae.
Users are advised to use `pip` to install cython
EOS
depends_on :python if MacOS.version <= :snow_leopard
def install
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python2.7/site-packages"
system "python", *Language::Python.setup_install_args(libexec)
bin.install Dir[libexec/"bin/*"]
bin.env_script_all_files(libexec/"bin", :PYTHONPATH => ENV["PYTHONPATH"])
end
test do
ENV.prepend_path "PYTHONPATH", libexec/"lib/python2.7/site-packages"
phrase = "You are using Homebrew"
(testpath/"package_manager.pyx").write "print '#{phrase}'"
(testpath/"setup.py").write <<-EOS.undent
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("package_manager.pyx")
)
EOS
system "python", "setup.py", "build_ext", "--inplace"
assert_match phrase, shell_output("python -c 'import package_manager'")
end
end