From 5320391bb52442bcb4549b61e89feff0867d2746 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 1 Apr 2014 22:12:41 -0500 Subject: python3: support bottling. Move a bunch of site_packages stuff to post_install. Closes #27968. --- Library/Formula/python3.rb | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'Library/Formula/python3.rb') diff --git a/Library/Formula/python3.rb b/Library/Formula/python3.rb index cf8c7a66d..f2d8acbea 100644 --- a/Library/Formula/python3.rb +++ b/Library/Formula/python3.rb @@ -109,14 +109,28 @@ class Python3 < Formula mv app, app.gsub(".app", " 3.app") end - # Post-install, fix up the site-packages so that user-installed Python - # software survives minor updates, such as going from 3.3.2 to 3.3.3: + # A fix, because python and python3 both want to install Python.framework + # and therefore we can't link both into HOMEBREW_PREFIX/Frameworks + # https://github.com/Homebrew/homebrew/issues/15943 + ["Headers", "Python", "Resources"].each{ |f| rm(prefix/"Frameworks/Python.framework/#{f}") } + rm prefix/"Frameworks/Python.framework/Versions/Current" + + # Remove 2to3 because python2 also installs it + rm bin/"2to3" # Remove the site-packages that Python created in its Cellar. site_packages_cellar.rmtree + end + + def post_install + # Fix up the site-packages so that user-installed Python software survives + # minor updates, such as going from 3.3.2 to 3.3.3: + # Create a site-packages in HOMEBREW_PREFIX/lib/python#{VER}/site-packages site_packages.mkpath + # Symlink the prefix site-packages into the cellar. + site_packages_cellar.delete if site_packages_cellar.exist? site_packages_cellar.parent.install_symlink site_packages # Write our sitecustomize.py @@ -142,15 +156,6 @@ class Python3 < Formula [install] prefix=#{HOMEBREW_PREFIX} EOF - - # A fix, because python and python3 both want to install Python.framework - # and therefore we can't link both into HOMEBREW_PREFIX/Frameworks - # https://github.com/Homebrew/homebrew/issues/15943 - ["Headers", "Python", "Resources"].each{ |f| rm(prefix/"Frameworks/Python.framework/#{f}") } - rm prefix/"Frameworks/Python.framework/Versions/Current" - - # Remove 2to3 because python2 also installs it - rm bin/"2to3" end def distutils_fix_superenv(args) -- cgit v1.2.3