Skip to content

Commit

Permalink
Merge pull request #150390 from branchvincent/python3.12
Browse files Browse the repository at this point in the history
 [email protected]: promote to default python3
  • Loading branch information
BrewTestBot committed Feb 21, 2024
2 parents 0f4edd3 + a9ac0c8 commit 0cefaa8
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 91 deletions.
2 changes: 1 addition & 1 deletion Aliases/python
2 changes: 1 addition & 1 deletion Aliases/python-gdbm
2 changes: 1 addition & 1 deletion Aliases/python-tk
2 changes: 1 addition & 1 deletion Aliases/python3
2 changes: 1 addition & 1 deletion Aliases/python@3
82 changes: 42 additions & 40 deletions Formula/p/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ class PythonAT311 < Formula
url "https://www.python.org/ftp/python/3.11.7/Python-3.11.7.tgz"
sha256 "068c05f82262e57641bd93458dfa883128858f5f4997aad7a36fd25b13b29209"
license "Python-2.0"
revision 1
revision 2

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

bottle do
sha256 arm64_sonoma: "360a3c596e6dc366b14105edd808c402f92963c893060ab08a46e5478da9d9f8"
sha256 arm64_ventura: "43a26af08d37b1c27930e587b498071726ba9810b5b0c3b48772406410fe4a5e"
sha256 arm64_monterey: "88abcc63a0b938a76807c067b97cf3f3c5d9138e52255952336125e7cfcf3ac0"
sha256 sonoma: "3ea9e879c186ad5d7ebcb930746c19ba828ebb9cce25e30f984ab569a405a503"
sha256 ventura: "0f4b5681ffa3da52e7eb33c75435ebdb58c1af12b2b16dfd0266dab28ef811a6"
sha256 monterey: "2f423003d778d46f0a733c565d93a086a5c186af63871ed7a8f545e24ebe62d4"
sha256 x86_64_linux: "e30cedb29d299760adce6a0d2a390828c80466da49c6da80ea524f039ea64188"
sha256 arm64_sonoma: "70dc9fcb84915ae957c5184326a00dfac2b6ef4ff7499a89f85872a4224583a1"
sha256 arm64_ventura: "d4fa103943c27f5f3053822b10d904521f32ddb6fa09fba214f6a4050fc1ea9f"
sha256 arm64_monterey: "499c45033e5ab8978d33a6c8c2a7cffb4011a05b1d39b4b64d49c14a837e6c90"
sha256 sonoma: "a0bac9048b07adbc7ef5371af600f731a907a7102f097608e80e74c23247ecd5"
sha256 ventura: "653a1f0706c98abe6e8a0674d9227711791ae056ce8a59f9ac5e91e4f03b8b2b"
sha256 monterey: "035c4c51329afabf69846a0ac5eff334ec3fcfbe7110aae632cc2bc77933c2ed"
sha256 x86_64_linux: "72be3c11e8f047f276f95fabb14ad84a9df898e2c5edd019aae9f51ce63b7007"
end

# setuptools remembers the build flags python is built with and uses them to
Expand Down Expand Up @@ -50,22 +50,6 @@ class PythonAT311 < Formula
skip_clean "bin/easy_install3", "bin/easy_install-3.4", "bin/easy_install-3.5", "bin/easy_install-3.6",
"bin/easy_install-3.7", "bin/easy_install-3.8", "bin/easy_install-3.9", "bin/easy_install-3.10"

link_overwrite "bin/2to3"
link_overwrite "bin/idle3"
link_overwrite "bin/pip3"
link_overwrite "bin/pydoc3"
link_overwrite "bin/python3"
link_overwrite "bin/python3-config"
link_overwrite "bin/wheel3"
link_overwrite "share/man/man1/python3.1"
link_overwrite "lib/libpython3.so"
link_overwrite "lib/pkgconfig/python3.pc"
link_overwrite "lib/pkgconfig/python3-embed.pc"
link_overwrite "Frameworks/Python.framework/Headers"
link_overwrite "Frameworks/Python.framework/Python"
link_overwrite "Frameworks/Python.framework/Resources"
link_overwrite "Frameworks/Python.framework/Versions/Current"

# Always update to latest release
resource "flit-core" do
url "https://files.pythonhosted.org/packages/c4/e6/c1ac50fe3eebb38a155155711e6e864e254ce4b6e17fe2429b4c4d5b9e80/flit_core-3.9.0.tar.gz"
Expand Down Expand Up @@ -234,8 +218,12 @@ def install
system "make"

ENV.deparallelize do
# The `altinstall` target prevents the installation of files with only Python's major
# version in its name. This allows us to link multiple versioned Python formulae.
# https://github.com/python/cpython#installing-multiple-versions
#
# Tell Python not to install into /Applications (default for framework builds)
system "make", "install", "PYTHONAPPSDIR=#{prefix}"
system "make", "altinstall", "PYTHONAPPSDIR=#{prefix}"
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{pkgshare}" if OS.mac?
end

Expand Down Expand Up @@ -268,6 +256,9 @@ def install
inreplace lib_cellar/"_sysconfigdata__darwin_darwin.py",
%r{('LINKFORSHARED': .*?)'(Python.framework/Versions/3.\d+/Python)'}m,
"\\1'#{opt_prefix}/Frameworks/\\2'"

# Remove symlinks that conflict with the main Python formula.
rm %w[Headers Python Resources Versions/Current].map { |subdir| frameworks/"Python.framework"/subdir }
else
# Prevent third-party packages from building against fragile Cellar paths
inreplace Dir[lib_cellar/"**/_sysconfigdata_*linux_x86_64-*.py",
Expand All @@ -279,6 +270,9 @@ def install
inreplace bin/"python#{version.major_minor}-config",
'prefix_real=$(installed_prefix "$0")',
"prefix_real=#{opt_prefix}"

# Remove symlinks that conflict with the main Python formula.
rm lib/"libpython3.so"
end

# Remove the site-packages that Python created in its Cellar.
Expand Down Expand Up @@ -323,12 +317,16 @@ def install
# Write out sitecustomize.py
(lib_cellar/"sitecustomize.py").atomic_write(sitecustomize)

# Install unversioned symlinks in libexec/bin.
# Install unversioned and major-versioned symlinks in libexec/bin.
{
"idle" => "idle#{version.major_minor}",
"pydoc" => "pydoc#{version.major_minor}",
"python" => "python#{version.major_minor}",
"python-config" => "python#{version.major_minor}-config",
"idle" => "idle#{version.major_minor}",
"idle3" => "idle#{version.major_minor}",
"pydoc" => "pydoc#{version.major_minor}",
"pydoc3" => "pydoc#{version.major_minor}",
"python" => "python#{version.major_minor}",
"python3" => "python#{version.major_minor}",
"python-config" => "python#{version.major_minor}-config",
"python3-config" => "python#{version.major_minor}-config",
}.each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
Expand Down Expand Up @@ -382,20 +380,21 @@ def post_install
mv (site_packages/"bin").children, bin
rmdir site_packages/"bin"

rm_rf bin/"pip"
rm_rf bin.glob("pip{,3}")
mv bin/"wheel", bin/"wheel#{version.major_minor}"
bin.install_symlink "wheel#{version.major_minor}" => "wheel3"

# Install unversioned symlinks in libexec/bin.
# Install unversioned and major-versioned symlinks in libexec/bin.
{
"pip" => "pip#{version.major_minor}",
"wheel" => "wheel#{version.major_minor}",
"pip" => "pip#{version.major_minor}",
"pip3" => "pip#{version.major_minor}",
"wheel" => "wheel#{version.major_minor}",
"wheel3" => "wheel#{version.major_minor}",
}.each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end

# post_install happens after link
%W[wheel3 pip3 wheel#{version.major_minor} pip#{version.major_minor}].each do |e|
%W[wheel#{version.major_minor} pip#{version.major_minor}].each do |e|
(HOMEBREW_PREFIX/"bin").install_symlink bin/e
end
end
Expand Down Expand Up @@ -460,14 +459,14 @@ def sitecustomize
def caveats
<<~EOS
Python has been installed as
#{HOMEBREW_PREFIX}/bin/python3
#{HOMEBREW_PREFIX}/bin/python#{version.major_minor}
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
Unversioned and major-versioned symlinks `python`, `python3`, `python-config`, `python3-config`, `pip`, `pip3`, etc. pointing to
`python#{version.major_minor}`, `python#{version.major_minor}-config`, `pip#{version.major_minor}` etc., respectively, have been installed into
#{opt_libexec}/bin
You can install Python packages with
pip3 install <package>
pip#{version.major_minor} install <package>
They will install into the site-package directory
#{HOMEBREW_PREFIX}/lib/python#{version.major_minor}/site-packages
Expand All @@ -481,6 +480,9 @@ def caveats
you'll need to read your database using the older version of Homebrew Python and convert to another format.
`dbm` still defaults to `dbm.gnu` when it is installed.
If you do not need a specific version of Python, and always want Homebrew's `python3` in your PATH:
brew install python3
For more information about Homebrew and Python, see: https://docs.brew.sh/Homebrew-and-Python
EOS
end
Expand Down
86 changes: 40 additions & 46 deletions Formula/p/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,21 @@ class PythonAT312 < Formula
url "https://www.python.org/ftp/python/3.12.2/Python-3.12.2.tgz"
sha256 "a7c4f6a9dc423d8c328003254ab0c9338b83037bd787d680826a5bf84308116e"
license "Python-2.0"
revision 1

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

bottle do
sha256 arm64_sonoma: "b0f2286abf6b8d3a9d040ba0c1c459e5b0dd523ee672e4882baa0f231cb8c3eb"
sha256 arm64_ventura: "2703933061282706e9b41302d974166987b103c21ce65b58b759a329eb517ce9"
sha256 arm64_monterey: "4d09cbbc860ec99e25461c65caf26b01a5677ad0c9a893ba64fca65164a6e545"
sha256 sonoma: "f06822918f24893bc1211906cefdf97974ef0e488caff206face8bfd069686e0"
sha256 ventura: "2e206044af781c6f8fda101a9753d4f5a3bc0a5dd2ca2edaa2f259979762a98f"
sha256 monterey: "b1350b7254e55a922076f74f6702f14db4fd79e788d6cd9e1a08131e1a740d6c"
sha256 x86_64_linux: "a26e6153b696509a6b2bc2e078c17d053f961b2d676fcf2a269fca20b905f646"
sha256 arm64_sonoma: "4603d3f3277f2d25fec8e813543a863ceabd90066578b14d530d2f7f59e345e0"
sha256 arm64_ventura: "312729d7f0c6f95b573cbab483db01aaf2ca577392405d0e0b5ea6717ebb916a"
sha256 arm64_monterey: "d5f921fba6c83ddda6cf887ed040106dc7647a9b2aed035a1079d58c7c7c5f62"
sha256 sonoma: "99fcd3eb3dff129c97ae0e4afb8fb90e39fa8595ea61b19854020cd4561e1e92"
sha256 ventura: "2b8cefc95067f3232cbf8b8c0c9df11b040923e12e0308f5102f237f82372710"
sha256 monterey: "20655faca163d3ca0c567a4acb3ccb22388ca68dc3adff598a63525221eadd23"
sha256 x86_64_linux: "08fc9fc751eeb9cae20a3797ff26c7baecf2001129ea590c7cefd437e0a1f1cd"
end

# setuptools remembers the build flags python is built with and uses them to
Expand Down Expand Up @@ -50,6 +51,22 @@ class PythonAT312 < Formula
"bin/easy_install-3.7", "bin/easy_install-3.8", "bin/easy_install-3.9", "bin/easy_install-3.10",
"bin/easy_install-3.11"

link_overwrite "bin/2to3"
link_overwrite "bin/idle3"
link_overwrite "bin/pip3"
link_overwrite "bin/pydoc3"
link_overwrite "bin/python3"
link_overwrite "bin/python3-config"
link_overwrite "bin/wheel3"
link_overwrite "share/man/man1/python3.1"
link_overwrite "lib/libpython3.so"
link_overwrite "lib/pkgconfig/python3.pc"
link_overwrite "lib/pkgconfig/python3-embed.pc"
link_overwrite "Frameworks/Python.framework/Headers"
link_overwrite "Frameworks/Python.framework/Python"
link_overwrite "Frameworks/Python.framework/Resources"
link_overwrite "Frameworks/Python.framework/Versions/Current"

# Always update to latest release
resource "flit-core" do
url "https://files.pythonhosted.org/packages/c4/e6/c1ac50fe3eebb38a155155711e6e864e254ce4b6e17fe2429b4c4d5b9e80/flit_core-3.9.0.tar.gz"
Expand Down Expand Up @@ -204,12 +221,8 @@ def install
system "make"

ENV.deparallelize do
# The `altinstall` target prevents the installation of files with only Python's major
# version in its name. This allows us to link multiple versioned Python formulae.
# https://github.com/python/cpython#installing-multiple-versions
#
# Tell Python not to install into /Applications (default for framework builds)
system "make", "altinstall", "PYTHONAPPSDIR=#{prefix}"
system "make", "install", "PYTHONAPPSDIR=#{prefix}"
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{pkgshare}" if OS.mac?
end

Expand Down Expand Up @@ -242,8 +255,6 @@ def install
inreplace lib_cellar/"_sysconfigdata__darwin_darwin.py",
%r{('LINKFORSHARED': .*?)'(Python.framework/Versions/3.\d+/Python)'}m,
"\\1'#{opt_prefix}/Frameworks/\\2'"
# Remove symlinks that conflict with the main Python formula.
rm %w[Headers Python Resources Versions/Current].map { |subdir| frameworks/"Python.framework"/subdir }
else
# Prevent third-party packages from building against fragile Cellar paths
inreplace Dir[lib_cellar/"**/_sysconfigdata_*linux_x86_64-*.py",
Expand All @@ -255,8 +266,6 @@ def install
inreplace bin/"python#{version.major_minor}-config",
'prefix_real=$(installed_prefix "$0")',
"prefix_real=#{opt_prefix}"
# Remove symlinks that conflict with the main Python formula.
rm lib/"libpython3.so"
end

# Remove the site-packages that Python created in its Cellar.
Expand Down Expand Up @@ -301,16 +310,12 @@ def install
# Write out sitecustomize.py
(lib_cellar/"sitecustomize.py").atomic_write(sitecustomize)

# Install unversioned and major-versioned symlinks in libexec/bin.
# Install unversioned symlinks in libexec/bin.
{
"idle" => "idle#{version.major_minor}",
"idle3" => "idle#{version.major_minor}",
"pydoc" => "pydoc#{version.major_minor}",
"pydoc3" => "pydoc#{version.major_minor}",
"python" => "python#{version.major_minor}",
"python3" => "python#{version.major_minor}",
"python-config" => "python#{version.major_minor}-config",
"python3-config" => "python#{version.major_minor}-config",
"idle" => "idle#{version.major_minor}",
"pydoc" => "pydoc#{version.major_minor}",
"python" => "python#{version.major_minor}",
"python-config" => "python#{version.major_minor}-config",
}.each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
Expand Down Expand Up @@ -363,21 +368,20 @@ def post_install
mv (site_packages/"bin").children, bin
rmdir site_packages/"bin"

rm_rf bin.glob("pip{,3}")
rm_rf bin/"pip"
mv bin/"wheel", bin/"wheel#{version.major_minor}"
bin.install_symlink "wheel#{version.major_minor}" => "wheel3"

# Install unversioned and major-versioned symlinks in libexec/bin.
# Install unversioned symlinks in libexec/bin.
{
"pip" => "pip#{version.major_minor}",
"pip3" => "pip#{version.major_minor}",
"wheel" => "wheel#{version.major_minor}",
"wheel3" => "wheel#{version.major_minor}",
"pip" => "pip#{version.major_minor}",
"wheel" => "wheel#{version.major_minor}",
}.each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end

# post_install happens after link
%W[wheel#{version.major_minor} pip#{version.major_minor}].each do |e|
%W[wheel3 pip3 wheel#{version.major_minor} pip#{version.major_minor}].each do |e|
(HOMEBREW_PREFIX/"bin").install_symlink bin/e
end

Expand Down Expand Up @@ -460,23 +464,12 @@ def sitecustomize
def caveats
<<~EOS
Python has been installed as
#{HOMEBREW_PREFIX}/bin/python#{version.major_minor}
#{HOMEBREW_PREFIX}/bin/python3
Unversioned and major-versioned symlinks `python`, `python3`, `python-config`, `python3-config`, `pip`, `pip3`, etc. pointing to
`python#{version.major_minor}`, `python#{version.major_minor}-config`, `pip#{version.major_minor}` etc., respectively, have been installed into
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
#{opt_libexec}/bin
You can install Python packages with
pip#{version.major_minor} install <package>
They will install into the site-package directory
#{HOMEBREW_PREFIX}/lib/python#{version.major_minor}/site-packages
tkinter is no longer included with this formula, but it is available separately:
brew install python-tk@#{version.major_minor}
If you do not need a specific version of Python, and always want Homebrew's `python3` in your PATH:
brew install python3
See: https://docs.brew.sh/Homebrew-and-Python
EOS
end
Expand All @@ -493,6 +486,7 @@ def caveats
system python3, "-c", "import _ctypes"
system python3, "-c", "import _decimal"
system python3, "-c", "import pyexpat"
system python3, "-c", "import readline"
system python3, "-c", "import zlib"

# tkinter is provided in a separate formula
Expand Down

0 comments on commit 0cefaa8

Please sign in to comment.