Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cython: Add formula for v3.0.10 #1135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions Library/Formula/cython.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class Cython < Formula
desc "Compiler for writing C extensions for the Python language"
homepage "https://cython.org/"
url "https://files.pythonhosted.org/packages/d5/f7/2fdd9205a2eedee7d9b0abbf15944a1151eb943001dbdc5233b1d1cfc34e/Cython-3.0.10.tar.gz"
sha256 "dcc96739331fb854dcf503f94607576cfe8488066c61ca50dfd55836f132de99"
license "Apache-2.0"

bottle do
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 "python3"

def python3
"python3.10"
end

def install
version = Language::Python.major_minor_version "python3"
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{version}/site-packages"

system python3, *Language::Python.setup_install_args(libexec)

bin.install (libexec/"bin").children
bin.env_script_all_files(libexec/"bin", PYTHONPATH: ENV["PYTHONPATH"])
end

test do
version = Language::Python.major_minor_version "python3"
ENV.prepend_create_path "PYTHONPATH", libexec/"lib/python#{version}/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