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 Homebrew/homebrew#8182. Closes Homebrew/homebrew#10051. Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
This commit is contained in:
parent
dba62fd97d
commit
bd52b679da
2 changed files with 17 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue