aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorsamueljohn2012-02-08 19:42:19 +0100
committerCharlie Sharpsteen2012-02-16 00:03:07 -0800
commit2bf9bba72b151117bb7713c749b18dbeace5480d (patch)
treebe7b265fb4f8d4c75977ef3fd450417100e71244 /Library
parenta0d84742051b3885346bb4928fa43a74c72f80de (diff)
downloadhomebrew-2bf9bba72b151117bb7713c749b18dbeace5480d.tar.bz2
sip & pyqt: Now use lib/pythonX.Y/site-packages
Benefit: For brewed Python, adding stuff to the PYTHONPATH is no longer needed. For other Pythons nothing changes but the X.Y part in the path. Oh, and you only need to edit your PYTHONPATH once. - Added a method to get the major.minor version number from the current python - Updated the caveats to reflect the new path Fixes #8182. Closes #10051. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/pyqt.rb14
-rw-r--r--Library/Formula/sip.rb11
2 files changed, 17 insertions, 8 deletions
diff --git a/Library/Formula/pyqt.rb b/Library/Formula/pyqt.rb
index 16fab87f1..91f4f0977 100644
--- a/Library/Formula/pyqt.rb
+++ b/Library/Formula/pyqt.rb
@@ -16,16 +16,20 @@ class Pyqt < Formula
system "python", "./configure.py", "--confirm-license",
"--bindir=#{bin}",
- "--destdir=#{lib}/python",
+ "--destdir=#{lib}/#{which_python}/site-packages",
"--sipdir=#{share}/sip"
system "make"
system "make install"
end
- def caveats; <<-EOS
-This formula won't function until you amend your PYTHONPATH like so:
- export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/python:$PYTHONPATH
-EOS
+ def caveats; <<-EOS.undent
+ For non-homebrew Python, you need to amend your PYTHONPATH like so:
+ export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
+ EOS
+ end
+
+ def which_python
+ "python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
def test
diff --git a/Library/Formula/sip.rb b/Library/Formula/sip.rb
index 6347839fd..4139fe2f1 100644
--- a/Library/Formula/sip.rb
+++ b/Library/Formula/sip.rb
@@ -30,18 +30,23 @@ class Sip < Formula
inreplace 'build.py', /@SIP_VERSION@/, (sip_version.gsub '.', ',')
system "python", "build.py", "prepare"
+ # Set --destdir such that the python modules will be in the HOMEBREWPREFIX/lib/pythonX.Y/site-packages
system "python", "configure.py",
- "--destdir=#{lib}/python",
+ "--destdir=#{lib}/#{which_python}/site-packages",
"--bindir=#{bin}",
"--incdir=#{include}"
system "make install"
end
def caveats; <<-EOS.undent
- This formula won't function until you amend your PYTHONPATH like so:
- export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/python:$PYTHONPATH
+ For non-homebrew Python, you need to amend your PYTHONPATH like so:
+ export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
EOS
end
+
+ def which_python
+ "python" + `python -c 'import sys;print(sys.version[:3])'`.strip
+ end
end