48 lines
1.8 KiB
Ruby
48 lines
1.8 KiB
Ruby
class Cython < Formula
|
|
desc "Compiler for writing C extensions for the Python language"
|
|
homepage "https://cython.org/"
|
|
url "https://files.pythonhosted.org/packages/a5/1f/c7c5450c60a90ce058b47ecf60bb5be2bfe46f952ed1d3b95d1d677588be/Cython-0.29.13.tar.gz"
|
|
sha256 "c29d069a4a30f472482343c866f7486731ad638ef9af92bfe5fca9c7323d638e"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "9999944d12ee8dd0ba94a81e79866b4997da8f405982ae070294b06eddf13c04" => :catalina
|
|
sha256 "b98048e900416d9ade12a002a03d86e1d9d2ecc0d9654c526e266b548a6d7852" => :mojave
|
|
sha256 "4dc3c1ad4576bdbab32987a44f5dea00230f1984ebee4602539ec97f09e47ae2" => :high_sierra
|
|
sha256 "3a480dba247419c716c9d05a70fea3d3fbbe4afa4c18cb9371ecd15e69d5d1b6" => :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
|