Skip to content

Commit

Permalink
Merge pull request #193308 from branchvincent/python3.13
Browse files Browse the repository at this point in the history
[email protected]: add missing sysconfig inreplace
  • Loading branch information
BrewTestBot authored Oct 9, 2024
2 parents a9e384d + 80bfed8 commit 430d839
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions Formula/p/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ class PythonAT313 < Formula
url "https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tgz"
sha256 "12445c7b3db3126c41190bfdc1c8239c39c719404e844babbd015a1bc3fafcd4"
license "Python-2.0"
revision 1

livecheck do
url "https://www.python.org/ftp/python/"
regex(%r{href=.*?v?(3\.13(?:\.\d+)*)/?["' >]}i)
end

bottle do
sha256 arm64_sequoia: "f1da7c79a3819968a37a28eb281a021960b7ad129e00b5327939097e82938798"
sha256 arm64_sonoma: "d163a1c6f5112cb1f33c8c16e2d129462db04b09de51c766ea1f0b9dbb47296f"
sha256 arm64_ventura: "a5245cd1f33bd725fd680974bac3ada8ef5d7d49cd36a7e3cb3f65de9709269e"
sha256 sonoma: "939370415e656a91d5becc7b35c9ef59e122be0f55f678a0d5752afc03aa8a05"
sha256 ventura: "be500f47cfb96db2813c6b2742135b77d6675d70d77baffce3a359bad0ae54c2"
sha256 x86_64_linux: "ad43a9702189e70afbb8e6d1e76d36f15969aee759acfd8687d228bce9f3d44c"
sha256 arm64_sequoia: "56d325c239b860c2f2be6dcf255021142aeb1ba4d1abbc44fc9832726b9ae71e"
sha256 arm64_sonoma: "59cb6d9a33e96f12b1c03e3931062b413ed05749b57921b5438bf59f465fb869"
sha256 arm64_ventura: "9d839b31f2728276cec2d4af27954a0202645d50f47e3768105cc263cbb2efc5"
sha256 sonoma: "44239bd5b2e23ac4e3537925d16695931e34cedb93648ac63e15ce05fa66926d"
sha256 ventura: "d5257cc367cea5fb1003646077cdb644e8eb181045e2815255738242e05f8af2"
sha256 x86_64_linux: "856c9c245e10cac940a6bf36af6ecf1a321ad82cbbcca2ea38136d3605bea9b2"
end

# setuptools remembers the build flags python is built with and uses them to
Expand Down Expand Up @@ -139,6 +140,7 @@ def install
--with-openssl=#{Formula["openssl@3"].opt_prefix}
--enable-optimizations
--with-system-expat
--with-system-libmpdec
--with-readline=editline
]

Expand All @@ -162,7 +164,7 @@ def install
end

# Enabling LTO on Linux makes libpython3.*.a unusable for anyone whose GCC
# install does not match the one in CI _exactly_ (major and minßor version).
# install does not match the one in CI _exactly_ (major and minor version).
# https://github.com/orgs/Homebrew/discussions/3734
args << "--with-lto"
args << "--enable-framework=#{frameworks}"
Expand All @@ -177,8 +179,7 @@ def install
end

# Resolve HOMEBREW_PREFIX in our sysconfig modification.
# not needed for embedded patch, but re-enable if a formula patch is made?
# inreplace "Lib/sysconfig/__init__.py", "HOMEBREW_PREFIX", HOMEBREW_PREFIX
inreplace "Lib/sysconfig/__init__.py", "@@HOMEBREW_PREFIX@@", HOMEBREW_PREFIX

# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
Expand Down Expand Up @@ -233,6 +234,11 @@ def install

# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink pc_dir.children

# Fix for https://github.com/Homebrew/homebrew-core/issues/21212
inreplace lib_cellar/"_sysconfigdata__darwin_darwin.py",
%r{('LINKFORSHARED': .*?) (Python.framework/Versions/3.\d+/Python)'}m,
"\\1 #{opt_prefix}/Frameworks/\\2'"
else
# Prevent third-party packages from building against fragile Cellar paths
inreplace Dir[lib_cellar/"**/_sysconfigdata_*linux_x86_64-*.py",
Expand Down Expand Up @@ -508,6 +514,12 @@ def caveats

system bin/"pip#{version.major_minor}", "list", "--format=columns"

# Verify our sysconfig patches
sysconfig_path = "import sysconfig; print(sysconfig.get_paths(\"osx_framework_library\")[\"data\"])"
assert_equal HOMEBREW_PREFIX.to_s, shell_output("#{python3} -c '#{sysconfig_path}'").strip
linkforshared_var = "import sysconfig; print(sysconfig.get_config_var(\"LINKFORSHARED\"))"
assert_match opt_prefix.to_s, shell_output("#{python3} -c '#{linkforshared_var}'") if OS.mac?

# Check our externally managed marker
assert_match "If you wish to install a Python library",
shell_output("#{python3} -m pip install pip 2>&1", 1)
Expand Down

0 comments on commit 430d839

Please sign in to comment.