-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Expand file tree
/
Copy pathpython-setuptools.rb
More file actions
47 lines (39 loc) · 1.6 KB
/
python-setuptools.rb
File metadata and controls
47 lines (39 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
class PythonSetuptools < Formula
desc "Easily download, build, install, upgrade, and uninstall Python packages"
homepage "https://setuptools.pypa.io/"
url "https://files.pythonhosted.org/packages/18/5d/3bf57dcd21979b887f014ea83c24ae194cfcd12b9e0fda66b957c69d1fca/setuptools-80.9.0.tar.gz"
sha256 "f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c"
license "MIT"
revision 1
bottle do
sha256 cellar: :any_skip_relocation, all: "83ebb533c2181540817970579431c38953d9743d68bea5b69799a790d726c4fe"
end
depends_on "python@3.12" => [:build, :test]
depends_on "python@3.13" => [:build, :test]
depends_on "python@3.14" => [:build, :test]
def pythons
deps.map(&:to_formula)
.select { |f| f.name.match?(/^python@\d\.\d+$/) }
.map { |f| f.opt_libexec/"bin/python" }
end
def install
inreplace_paths = %w[
_distutils/compilers/C/unix.py
_vendor/platformdirs/unix.py
]
pythons.each do |python|
system python, "-m", "pip", "install", *std_pip_args, "."
# Ensure uniform bottles
setuptools_site_packages = prefix/Language::Python.site_packages(python)/"setuptools"
inreplace setuptools_site_packages/"_vendor/platformdirs/macos.py", "/opt/homebrew", HOMEBREW_PREFIX
inreplace_files = inreplace_paths.map { |file| setuptools_site_packages/file }
inreplace_files += setuptools_site_packages.glob("_vendor/platformdirs-*dist-info/METADATA")
inreplace inreplace_files, "/usr/local", HOMEBREW_PREFIX
end
end
test do
pythons.each do |python|
system python, "-c", "import setuptools"
end
end
end