From d06a1dc7ea85aa7a9b1c49ca05bade9a835dddd8 Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Mon, 9 Oct 2023 22:00:41 -0700 Subject: [PATCH 1/5] python@3.11: demote from default python3 --- Formula/p/python@3.11.rb | 68 +++++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 33 deletions(-) diff --git a/Formula/p/python@3.11.rb b/Formula/p/python@3.11.rb index f15ec048eaf30..a47b3f90e34a7 100644 --- a/Formula/p/python@3.11.rb +++ b/Formula/p/python@3.11.rb @@ -4,7 +4,7 @@ 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/" @@ -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" @@ -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 @@ -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", @@ -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. @@ -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 @@ -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 @@ -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 + pip#{version.major_minor} install They will install into the site-package directory #{HOMEBREW_PREFIX}/lib/python#{version.major_minor}/site-packages @@ -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 From 0b7a8eef3eea06df45e495a51470493776448383 Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Mon, 9 Oct 2023 22:04:42 -0700 Subject: [PATCH 2/5] python@3.12: promote to default python3 --- Formula/p/python@3.12.rb | 72 ++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/Formula/p/python@3.12.rb b/Formula/p/python@3.12.rb index 6148e3a8edc69..74b96303000e3 100644 --- a/Formula/p/python@3.12.rb +++ b/Formula/p/python@3.12.rb @@ -4,6 +4,7 @@ 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/" @@ -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" @@ -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 @@ -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", @@ -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. @@ -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 @@ -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 @@ -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 - 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 @@ -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 From 817f86a2891212a2852c5047af99ca481ef20e5f Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Mon, 9 Oct 2023 22:09:45 -0700 Subject: [PATCH 3/5] python@3.12: migrate aliases --- Aliases/python | 2 +- Aliases/python-gdbm | 2 +- Aliases/python-tk | 2 +- Aliases/python3 | 2 +- Aliases/python@3 | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Aliases/python b/Aliases/python index d40889917ff4c..8e3e037c90e3f 120000 --- a/Aliases/python +++ b/Aliases/python @@ -1 +1 @@ -../Formula/p/python@3.11.rb \ No newline at end of file +../Formula/p/python@3.12.rb \ No newline at end of file diff --git a/Aliases/python-gdbm b/Aliases/python-gdbm index b3a4753c7708b..1d9d3509b4cc9 120000 --- a/Aliases/python-gdbm +++ b/Aliases/python-gdbm @@ -1 +1 @@ -../Formula/p/python-gdbm@3.11.rb \ No newline at end of file +../Formula/p/python-gdbm@3.12.rb \ No newline at end of file diff --git a/Aliases/python-tk b/Aliases/python-tk index fec2c5687ce61..760b066cc82e4 120000 --- a/Aliases/python-tk +++ b/Aliases/python-tk @@ -1 +1 @@ -../Formula/p/python-tk@3.11.rb \ No newline at end of file +../Formula/p/python-tk@3.12.rb \ No newline at end of file diff --git a/Aliases/python3 b/Aliases/python3 index d40889917ff4c..8e3e037c90e3f 120000 --- a/Aliases/python3 +++ b/Aliases/python3 @@ -1 +1 @@ -../Formula/p/python@3.11.rb \ No newline at end of file +../Formula/p/python@3.12.rb \ No newline at end of file diff --git a/Aliases/python@3 b/Aliases/python@3 index d40889917ff4c..8e3e037c90e3f 120000 --- a/Aliases/python@3 +++ b/Aliases/python@3 @@ -1 +1 @@ -../Formula/p/python@3.11.rb \ No newline at end of file +../Formula/p/python@3.12.rb \ No newline at end of file From ac615dee62cdfab2e4bfdd1bc2fc0b9749c3c641 Mon Sep 17 00:00:00 2001 From: Branch Vincent <19800529+branchvincent@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:00:44 +0000 Subject: [PATCH 4/5] python@3.11: update 3.11.7_2 bottle. --- Formula/p/python@3.11.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Formula/p/python@3.11.rb b/Formula/p/python@3.11.rb index a47b3f90e34a7..3db846c7a4c32 100644 --- a/Formula/p/python@3.11.rb +++ b/Formula/p/python@3.11.rb @@ -12,13 +12,13 @@ class PythonAT311 < Formula 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 From a9ac0c81c86dab2ab28baa652208e5da30ef52f7 Mon Sep 17 00:00:00 2001 From: Branch Vincent <19800529+branchvincent@users.noreply.github.com> Date: Wed, 21 Feb 2024 17:00:45 +0000 Subject: [PATCH 5/5] python@3.12: update 3.12.2_1 bottle. --- Formula/p/python@3.12.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Formula/p/python@3.12.rb b/Formula/p/python@3.12.rb index 74b96303000e3..62488758f308b 100644 --- a/Formula/p/python@3.12.rb +++ b/Formula/p/python@3.12.rb @@ -12,13 +12,13 @@ class PythonAT312 < Formula 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