54 lines
2.0 KiB
Ruby
54 lines
2.0 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/6c/9f/f501ba9d178aeb1f5bf7da1ad5619b207c90ac235d9859961c11829d0160/Cython-0.29.21.tar.gz"
|
|
sha256 "e57acb89bd55943c8d8bf813763d20b9099cc7165c0f16b707631a7654be9cad"
|
|
revision 1
|
|
|
|
livecheck do
|
|
url :stable
|
|
end
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "fd74db80cbd06970855b2bd78d71593c919fad34d165c351663503f2429193c4" => :big_sur
|
|
sha256 "8642f6bff6de2c04fc5eea73b63af6a7029665a3fc053d5fa94043af0e9842ce" => :catalina
|
|
sha256 "1b53458978d40017cb1b3be75aadfa9e99ecaffd73f6c3d4885d6a5d5b0ddaca" => :mojave
|
|
sha256 "f6474509ad079919250de3f536e2d57e4230e72b1614603b5797c24a08e67391" => :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@3.9"
|
|
|
|
def install
|
|
xy = Language::Python.major_minor_version Formula["python@3.9"].opt_bin/"python3"
|
|
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{xy}/site-packages"
|
|
system Formula["python@3.9"].opt_bin/"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 Formula["python@3.9"].opt_bin/"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 Formula["python@3.9"].opt_bin/"python3", "setup.py", "build_ext", "--inplace"
|
|
assert_match phrase, shell_output("#{Formula["python@3.9"].opt_bin}/python3 -c 'import package_manager'")
|
|
end
|
|
end
|