Skip to content

Commit

Permalink
pyqt: use Language::Python.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Mar 12, 2014
1 parent d6d3375 commit 66e56a1
Showing 1 changed file with 5 additions and 24 deletions.
29 changes: 5 additions & 24 deletions Library/Formula/pyqt.rb
Expand Up @@ -8,13 +8,7 @@ class Pyqt < Formula
depends_on :python => :recommended
depends_on :python3 => :optional

if !Formula["python"].installed? && build.with?("python") &&
build.with?("python3")
odie <<-EOS.undent
pyqt: You cannot use system Python 2 and Homebrew's Python 3 simultaneously.
Either `brew install python` or use `--without-python3`.
EOS
elsif build.without?("python3") && build.without?("python")
if build.without?("python3") && build.without?("python")
odie "pyqt: --with-python3 must be specified when using --without-python"
end

Expand All @@ -26,16 +20,6 @@ class Pyqt < Formula
depends_on "sip"
end

def pythons
pythons = []
["python", "python3"].each do |python|
next if build.without? python
version = /\d\.\d/.match `#{python} --version 2>&1`
pythons << [python, version]
end
pythons
end

def patches
# On Mavericks we want to target libc++, but this requires a user specified
# qmake makespec. Unfortunately user specified makespecs are broken in the
Expand All @@ -52,8 +36,8 @@ def install
ENV.append "QMAKESPEC", "unsupported/macx-clang-libc++"
end

pythons.each do |python, version|
ENV["PYTHONPATH"] = HOMEBREW_PREFIX/"opt/sip/lib/python#{version}/site-packages"
Language::Python.each_python(build) do |python, version|
ENV.append_path 'PYTHONPATH', HOMEBREW_PREFIX/"opt/sip/lib/python#{version}/site-packages"

args = ["--confirm-license",
"--bindir=#{bin}",
Expand All @@ -79,7 +63,7 @@ def install
system python, "./configure-ng.py", *args
system "make"
system "make", "install"
system "make", "clean" if pythons.length > 1
system "make", "clean"
end
end

Expand Down Expand Up @@ -107,10 +91,7 @@ def __init__(self, parent=None):
sys.exit(app.exec_())
EOS

pythons.each do |python, version|
unless Formula[python].installed?
ENV["PYTHONPATH"] = HOMEBREW_PREFIX/"lib/python#{version}/site-packages"
end
Language::Python.each_python(build) do |python, version|
system python, "test.py"
end
end
Expand Down

0 comments on commit 66e56a1

Please sign in to comment.