homebrew-core/Formula/cython.rb

46 lines
1.6 KiB
Ruby
Raw Normal View History

2017-05-21 22:49:24 +00:00
class Cython < Formula
desc "Compiler for writing C extensions for the Python language"
homepage "http://cython.org"
url "https://files.pythonhosted.org/packages/ee/2a/c4d2cdd19c84c32d978d18e9355d1ba9982a383de87d0fcb5928553d37f4/Cython-0.27.3.tar.gz"
sha256 "6a00512de1f2e3ce66ba35c5420babaef1fe2d9c43a8faab4080b0dbcc26bc64"
2017-05-21 22:49:24 +00:00
2017-05-22 02:13:48 +00:00
bottle do
cellar :any_skip_relocation
2017-11-04 20:25:17 +00:00
sha256 "50a5f8928e750f0f51572265550b680b75def6b2bff16847c3fee4fe968ee1f0" => :high_sierra
sha256 "e0e1da2e224c839e0fa93fee56e92261b4fc33c286a7c6b9decbc09d5995e5c3" => :sierra
sha256 "68500af222ef5dc5f50686731cc31360ab11e4a3c2467e51d88b1075ffe35b38" => :el_capitan
2017-05-22 02:13:48 +00:00
end
2017-10-18 10:10:48 +00:00
keg_only <<~EOS
2017-05-21 22:49:24 +00:00
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}'"
2017-10-18 10:10:48 +00:00
(testpath/"setup.py").write <<~EOS
2017-05-21 22:49:24 +00:00
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