Python 2.x and 3.x support

New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.

To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.

The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:

python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.

Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.

python do
  system python, 'setup.py', "--prefix=#{prefix}"
end

Read more in the Homebrew wiki.
master
Samuel John 2013-01-21 10:33:56 +01:00
parent 2e64384f82
commit f6e80bdea2
94 changed files with 1140 additions and 1330 deletions

View File

@ -62,7 +62,8 @@ class Asymptote < Formula
If you wish to use xasy, you must first install the Python Imaging Library:
easy_install http://effbot.org/downloads/Imaging-1.1.7.tar.gz
brew install pil
EOS
end
end

View File

@ -5,43 +5,18 @@ class Bazaar < Formula
url 'https://launchpad.net/bzr/2.5/2.5.1/+download/bzr-2.5.1.tar.gz'
sha1 '7e2776e3aaf8fb48828026d3fc2a3047465eea5e'
option "system", "Install using the OS X system Python."
depends_on :python
def install
ENV.j1 # Builds aren't parallel-safe
# Make and install man page first
system "make man1/bzr.1"
man1.install "man1/bzr.1"
if build.include? "system"
ENV.prepend "PATH", "/System/Library/Frameworks/Python.framework/Versions/Current/bin", ":"
python do
# In this python block, the site-packages are already set up
system python, "setup.py", "install", "--prefix=#{prefix}"
(prefix/'man').rmtree
end
# Find the arch for the Python we are building against.
# We remove 'ppc' support, so we can pass Intel-optimized CFLAGS.
if build.include? "system"
python_cmd = "/usr/bin/python"
else
python_cmd = "python"
end
archs = archs_for_command(python_cmd)
archs.remove_ppc!
ENV['ARCHFLAGS'] = archs.as_arch_flags
system "make"
inreplace "bzr", "#! /usr/bin/env python", "#!/usr/bin/python" if build.include? "system"
libexec.install 'bzr', 'bzrlib'
bin.install_symlink libexec+'bzr'
end
def caveats; <<-EOS.undent
We've built a "standalone" version of bazaar and installed its libraries to:
#{libexec}
We've specifically kept it out of your Python's "site-packages" folder.
EOS
end
end

View File

@ -6,6 +6,7 @@ class Beecrypt < Formula
sha256 '286f1f56080d1a6b1d024003a5fa2158f4ff82cae0c6829d3c476a4b5898c55d'
depends_on "icu4c"
depends_on :python => :optional
def patches
# fix build with newer clang, gcc 4.7 (https://bugs.gentoo.org/show_bug.cgi?id=413951)
@ -19,15 +20,27 @@ class Beecrypt < Formula
end
def install
ENV.remove_from_cflags /-march=\S*/
args = ["--prefix=#{prefix}", "--disable-openmp", "--without-java", "--without-python"]
ENV.remove_from_cflags(/-march=\S*/)
args = ["--prefix=#{prefix}", "--disable-openmp", "--without-java"]
if MacOS.prefer_64_bit?
args << "--build=x86_64-apple-darwin#{darwin_major_version}"
end
args << "--without-python" if build.without? 'python'
if python
# We don't want beecrypt to use get_python_lib() to install into
# the global site-packages. There is no option to set it.
# Fixing this in configure make the configure output printout correct.
inreplace "configure", "ac_cv_python_libdir=`$PYTHON -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib()'`",
"ac_cv_python_libdir='#{python.site_packages}'"
end
system "./configure", *args
system "make"
system "make check"
system "make install"
# We have to move the check after install (which is stupid, I know) but
# otherwise they fail because python bindings don't yet find the libbeecrypt
system "make check"
end
end

View File

@ -1,7 +1,7 @@
require 'formula'
class UniversalPython < Requirement
satisfy { archs_for_command("python").universal? }
satisfy(:build_env => false) { archs_for_command("python").universal? }
def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
@ -29,14 +29,14 @@ class Boost < Formula
option :universal
option 'with-mpi', 'Enable MPI support'
option 'without-python', 'Build without Python'
option 'with-icu', 'Build regexp engine with icu support'
option 'with-icu4c', 'Build regexp engine with icu support'
option 'with-c++11', 'Compile using Clang, std=c++11 and stdlib=libc++' if MacOS.version >= :lion
option 'use-system-layout', 'Use system layout instead of tagged'
depends_on UniversalPython if build.universal? and not build.include? "without-python"
depends_on "icu4c" if build.include? "with-icu"
depends_on MPIDependency.new(:cc, :cxx) if build.include? "with-mpi"
depends_on :python => :recommended
depends_on UniversalPython if build.universal? and build.with? "python"
depends_on "icu4c" => :optional
depends_on MPIDependency.new(:cc, :cxx) if build.with? "mpi"
fails_with :llvm do
build 2335
@ -69,15 +69,15 @@ class Boost < Formula
# Force boost to compile using the appropriate GCC version
open("user-config.jam", "a") do |file|
file.write "using darwin : : #{ENV.cxx} ;\n"
file.write "using mpi ;\n" if build.include? 'with-mpi'
file.write "using mpi ;\n" if build.with? 'mpi'
end
# we specify libdir too because the script is apparently broken
bargs = ["--prefix=#{prefix}", "--libdir=#{lib}"]
bargs << "--with-toolset=clang" if build.include? "with-c++11"
bargs << "--with-toolset=clang" if build.with? "c++11"
if build.include? 'with-icu'
if build.with? 'icu4c'
icu4c_prefix = Formula.factory('icu4c').opt_prefix
bargs << "--with-icu=#{icu4c_prefix}"
else
@ -99,7 +99,7 @@ class Boost < Formula
"threading=multi",
"install"]
if MacOS.version >= :lion and build.include? 'with-c++11'
if MacOS.version >= :lion and build.with? 'c++11'
args << "toolset=clang" << "cxxflags=-std=c++11"
args << "cxxflags=-stdlib=libc++" << "cxxflags=-fPIC"
args << "cxxflags=-arch x86_64" if MacOS.prefer_64_bit? or build.universal?
@ -111,7 +111,7 @@ class Boost < Formula
end
args << "address-model=32_64" << "architecture=x86" << "pch=off" if build.universal?
args << "--without-python" if build.include? "without-python"
args << "--without-python" if build.without? 'python'
system "./bootstrap.sh", *bargs
system "./b2", *args

View File

@ -1,7 +1,7 @@
require 'formula'
class UniversalPython < Requirement
satisfy { archs_for_command("python").universal? }
satisfy(:build_env => false) { archs_for_command("python").universal? }
def message; <<-EOS.undent
A universal build was requested, but Python is not a universal build
@ -23,12 +23,12 @@ class Boost149 < Formula
option :universal
option 'with-mpi', 'Enable MPI support'
option 'without-python', 'Build without Python'
option 'with-icu', 'Build regexp engine with icu support'
option 'with-icu4c', 'Build regexp engine with icu support'
depends_on UniversalPython if build.universal? and not build.include? "without-python"
depends_on "icu4c" if build.include? "with-icu"
depends_on MPIDependency.new(:cc, :cxx) if build.include? "with-mpi"
depends_on :python => :recommended
depends_on UniversalPython if build.universal? and build.with? "python"
depends_on "icu4c" => :optional
depends_on MPIDependency.new(:cc, :cxx) if build.with? "mpi"
fails_with :llvm do
build 2335
@ -50,13 +50,13 @@ class Boost149 < Formula
# Force boost to compile using the appropriate GCC version
open("user-config.jam", "a") do |file|
file.write "using darwin : : #{ENV.cxx} ;\n"
file.write "using mpi ;\n" if build.include? 'with-mpi'
file.write "using mpi ;\n" if build.with? 'mpi'
end
# we specify libdir too because the script is apparently broken
bargs = ["--prefix=#{prefix}", "--libdir=#{lib}"]
if build.include? 'with-icu'
if build.with? 'icu4c'
icu4c_prefix = Formula.factory('icu4c').opt_prefix
bargs << "--with-icu=#{icu4c_prefix}"
else
@ -73,7 +73,7 @@ class Boost149 < Formula
"install"]
args << "address-model=32_64" << "architecture=x86" << "pch=off" if build.universal?
args << "--without-python" if build.include? "without-python"
args << "--without-python" if build.without? 'python'
system "./bootstrap.sh", *bargs
system "./bjam", *args

View File

@ -7,6 +7,7 @@ class BulkExtractor < Formula
depends_on :autoconf
depends_on :automake
depends_on :python
depends_on 'afflib' => :optional
depends_on 'exiv2' => :optional
@ -19,25 +20,24 @@ class BulkExtractor < Formula
end
def install
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make"
system "make install"
python do
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make"
system "make install"
# Install documentation
(share/'bulk_extractor/doc').install Dir['doc/*.{html,txt,pdf}']
# Install documentation
(share/'bulk_extractor/doc').install Dir['doc/*.{html,txt,pdf}']
# Install Python utilities
(share/'bulk_extractor/python').install Dir['python/*.py']
(lib/python.xy/"site-packages").install Dir['python/*.py']
end
# Install the GUI the Homebrew way
libexec.install 'java_gui/BEViewer.jar'
bin.write_jar_script libexec/"BEViewer.jar", "BEViewer", "-Xmx1g"
end
def caveats; <<-EOS.undent
You may need to add the directory containing the Python bindings to your PYTHONPATH:
#{share}/bulk_extractor/python
EOS
def caveats
python.standard_caveats if python
end
end

View File

@ -1,14 +1,16 @@
require 'formula'
class Bup < Formula
homepage 'https://github.com/apenwarr/bup'
url 'https://github.com/apenwarr/bup/archive/bup-0.25-rc1.tar.gz'
homepage 'https://github.com/bup/bup'
url 'https://github.com/bup/bup/archive/bup-0.25-rc1.tar.gz'
sha1 'b88bd38d6f00a646faf0bd1f561595ebc0e55b30'
head 'https://github.com/apenwarr/bup.git', :branch => 'master'
head 'https://github.com/bup/bup.git', :branch => 'master'
option "run-tests", "Run unit tests after compilation"
depends_on :python
# patch to make the `--prefix` parameter work
# found at https://github.com/apenwarr/bup/pull/5
def patches
@ -16,9 +18,11 @@ class Bup < Formula
end
def install
ENV['PATH'] = '/usr/bin:' + ENV['PATH'] # make sure we Sytem Python
system "./configure", "--prefix=#{prefix}"
system "make"
python do
ohai ENV['PATH']
system "./configure", "--prefix=#{prefix}"
system "make"
end
system "make test" if build.include? "run-tests"
system "make install"
end

View File

@ -7,6 +7,7 @@ class Cantera < Formula
head 'http://cantera.googlecode.com/svn/cantera18/trunk/'
depends_on 'numpy' => :python
depends_on :python
depends_on 'graphviz'
# fixes the Makefiles in Cantera/cxx/demos/ that have broken install commands

View File

@ -21,6 +21,7 @@ class CmuSphinxbase < Formula
sha1 'c0c4d52e143d07cd593bd6bcaeb92b9a8a5a8c8e'
depends_on 'pkg-config' => :build
depends_on :python
depends_on HomebrewedPython
def install

View File

@ -9,6 +9,7 @@ class Collectd < Formula
option "java", "Enable Java 1.6 support"
depends_on 'pkg-config' => :build
depends_on :python
fails_with :clang do
build 318
@ -26,7 +27,7 @@ class Collectd < Formula
--disable-dependency-tracking
--prefix=#{prefix}
--localstatedir=#{var}
--with-python=/usr/bin]
--with-python=#{python}]
args << "--disable-embedded-perl" if MacOS.version == :leopard
args << "--disable-java" unless build.include? "java"

View File

@ -3,7 +3,7 @@ require 'formula'
class PythonWithGdbm < Requirement
fatal true
satisfy { quiet_system "python", "-c", "import gdbm" }
satisfy(:build_env => false) { quiet_system "python", "-c", "import gdbm" }
def message; <<-EOS.undent
The Python being used does not include gdbm support,
@ -21,16 +21,20 @@ class Cvs2svn < Formula
url 'http://trac.macports.org/export/70472/distfiles/cvs2svn/cvs2svn-2.3.0.tar.gz'
sha1 '545237805ddb241054ba40b105b9c29b705539b8'
depends_on :python
depends_on PythonWithGdbm
def install
system "python", "setup.py", "install", "--prefix=#{prefix}"
system "make man"
man1.install gzip('cvs2svn.1', 'cvs2git.1', 'cvs2bzr.1')
prefix.install %w[ BUGS COMMITTERS HACKING
cvs2bzr-example.options cvs2git-example.options cvs2hg-example.options
cvs2svn-example.options contrib ]
python do
system python, "setup.py", "install", "--prefix=#{prefix}"
system "make man"
man1.install gzip('cvs2svn.1', 'cvs2git.1', 'cvs2bzr.1')
prefix.install %w[ BUGS COMMITTERS HACKING
cvs2bzr-example.options
cvs2git-example.options
cvs2hg-example.options
cvs2svn-example.options contrib ]
end
doc.install Dir['{doc,www}/*']
end

View File

@ -5,6 +5,8 @@ class Denyhosts < Formula
url 'http://downloads.sourceforge.net/project/denyhosts/denyhosts/2.6/DenyHosts-2.6.tar.gz'
sha1 '02143843cb7c37c986c222b7acc11f7b75eb7373'
depends_on :python
# Copies of daemon-control-dist & denyhosts.cfg-dist edited for OS X.
def patches; DATA; end
@ -30,11 +32,12 @@ class Denyhosts < Formula
end
# Install mostly into libexec (a la Duplicity)
system "python", "setup.py", "install",
"--prefix=#{prefix}",
"--install-lib=#{libexec}",
"--install-scripts=#{libexec}",
"--install-data=#{libexec}"
python do
system python, "setup.py", "install",
"--prefix=#{prefix}",
"--install-scripts=#{bin}",
"--install-data=#{libexec}"
end
libexec.install 'daemon-control'
(libexec+'daemon-control').chmod 0755

View File

@ -5,13 +5,16 @@ class Diffuse < Formula
url 'http://downloads.sourceforge.net/project/diffuse/diffuse/0.4.7/diffuse-0.4.7.tar.bz2'
sha1 '9e3b906b579495027b76dc723b5df28e400d3f26'
depends_on :python
depends_on 'pygtk'
def install
system "python", "./install.py",
python do
system python, "./install.py",
"--sysconfdir=#{etc}",
"--examplesdir=#{share}",
"--prefix=#{prefix}"
end
end
def test

View File

@ -7,6 +7,7 @@ class Disco < Formula
# Periods in the install path cause disco-worker to complain so change to underscores.
version '0_4_5'
depends_on :python
depends_on 'erlang'
depends_on 'simplejson' => :python if MacOS.version == :leopard
depends_on 'libcmph'
@ -23,44 +24,31 @@ class Disco < Formula
s.change_make_var! "localstatedir", var
end
# Support for setup.py, which is called from within the Makefile
temp_site_packages = lib/which_python/'site-packages'
mkdir_p temp_site_packages
ENV['PYTHONPATH'] = temp_site_packages
py_install_opts = "--verbose --force --install-scripts=#{bin} " +
"--install-lib=#{temp_site_packages} --install-data=#{share} --install-headers=#{include}"
python do
# Disco's "rebar" build tool refuses to build unless it's in a git repo, so
# make a dummy one
system "git init && git add master/rebar && git commit -a -m 'dummy commit'"
# Disco's "rebar" build tool refuses to build unless it's in a git repo, so
# make a dummy one
system "git init && git add master/rebar && git commit -a -m 'dummy commit'"
system "make"
system "make install"
prefix.install %w[contrib doc examples]
system "make"
system "make install PY_INSTALL_OPTS='#{py_install_opts}'"
prefix.install %w[contrib doc examples]
# Fix the config file to point at the linked files, not in to cellar
# This isn't ideal - if there's a settings.py file left over from a previous disco
# installation, it'll issue a Warning
inreplace "#{etc}/disco/settings.py" do |s|
s.gsub!("Cellar/disco/"+version+"/", "")
# Fix the config file to point at the linked files, not in to cellar
# This isn't ideal - if there's a settings.py file left over from a previous disco
# installation, it'll issue a Warning
inreplace "#{etc}/disco/settings.py" do |s|
s.gsub!("Cellar/disco/"+version+"/", "")
end
end
end
def which_python
# Update this once we have something like [this](https://github.com/mxcl/homebrew/issues/11204)
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
def caveats; <<-EOS.undent
Disco is a Python script. You must install homebrew's python or add the path
#{HOMEBREW_PREFIX}/lib/python2.7/site-packages
to your PYTHONPATH before running disco or ddfs.
Please copy #{etc}/disco/settings.py to ~/.disco and edit it if necessary.
The DDFS_*_REPLICA settings have been set to 1 assuming a single-machine install.
Please see http://discoproject.org/doc/disco/start/install.html for further instructions.
def caveats
s = ''
s += python.standard_caveats if python
s += <<-EOS.undent
Please copy #{etc}/disco/settings.py to ~/.disco and edit it if necessary.
The DDFS_*_REPLICA settings have been set to 1 assuming a single-machine install.
Please see http://discoproject.org/doc/disco/start/install.html for further instructions.
EOS
end
end

View File

@ -7,10 +7,13 @@ class Discodex < Formula
sha1 '03a9ce7a8d70c371f4dd3ce2a1e2c72cda1fc1f4'
depends_on 'disco'
depends_on :python
def install
# The make target only installs python libs; must manually install the rest
system "make", "install", "prefix=#{prefix}"
prefix.install(%w[bin doc])
python do
# The make target only installs python libs; must manually install the rest
system "make", "install", "prefix=#{prefix}"
prefix.install(%w[bin doc])
end
end
end

View File

@ -2,7 +2,7 @@ require 'formula'
class PythonWithoutPPC < Requirement
fatal true
satisfy { not archs_for_command("python").ppc? }
satisfy(:build_env => false) { not archs_for_command("python").ppc? }
def message
"This software will not compile if your default Python is built with PPC support."
@ -14,18 +14,18 @@ class Distcc < Formula
url 'http://distcc.googlecode.com/files/distcc-3.2rc1.tar.gz'
sha1 '7cd46fe0926a3a859a516274e6ae59fa8ba0262d'
depends_on :python
depends_on PythonWithoutPPC
def install
# Prevent distcc from finding the System Python 2.6
ENV['PYTHON'] = which('python')
# Make sure python stuff is put into the Cellar.
# --root triggers a bug and installs into HOMEBREW_PREFIX/lib/python2.7/site-packages instead of the Cellar.
inreplace 'Makefile.in', '--root="$$DESTDIR"', ""
system "./configure", "--prefix=#{prefix}"
system "make install"
python do
# Make sure python stuff is put into the Cellar.
# --root triggers a bug and installs into HOMEBREW_PREFIX/lib/python2.7/site-packages instead of the Cellar.
inreplace 'Makefile.in', '--root="$$DESTDIR"', ""
system "./configure", "--prefix=#{prefix}"
system "make install"
end
plist_path.write startup_plist
plist_path.chmod 0644
end

View File

@ -5,24 +5,17 @@ class Duplicity < Formula
url 'http://code.launchpad.net/duplicity/0.6-series/0.6.21/+download/duplicity-0.6.21.tar.gz'
sha1 '8594666f5312a7b367ab80b979d70a5c45f1145b'
depends_on :python
depends_on 'librsync'
depends_on 'gnupg'
option :universal
def install
ENV.universal_binary if build.universal?
# Install mostly into libexec
system "python", "setup.py", "install",
"--prefix=#{prefix}",
"--install-lib=#{libexec}",
"--install-scripts=#{bin}"
# Shift files around to avoid needing a PYTHONPATH
mv bin+'duplicity', bin+'duplicity.py'
mv Dir[bin+'*'], libexec
bin.install_symlink "#{libexec}/duplicity.py" => "duplicity"
bin.install_symlink "#{libexec}/rdiffdir"
python do
ENV.universal_binary if build.universal?
# Install mostly into libexec
system python, "setup.py", "install", "--prefix=#{prefix}"
end
end
end

View File

@ -1,11 +1,18 @@
require 'formula'
class PyEnchant < Formula
homepage 'http://pythonhosted.org/pyenchant/'
url 'https://pypi.python.org/packages/source/p/pyenchant/pyenchant-1.6.5.tar.gz'
sha1 '6f01b8657b64e970a11945c2a9b4d6d8023997bc'
end
class Enchant < Formula
homepage 'http://www.abisource.com/projects/enchant/'
url 'http://www.abisource.com/downloads/enchant/1.6.0/enchant-1.6.0.tar.gz'
sha1 '321f9cf0abfa1937401676ce60976d8779c39536'
depends_on 'pkg-config' => :build
depends_on :python => :recommended
depends_on 'glib'
depends_on 'aspell'
@ -15,5 +22,23 @@ class Enchant < Formula
"--disable-ispell",
"--disable-myspell"
system "make install"
if build.with? 'python'
# Now we handle the python bindings from the subformulae PyEnchant
PyEnchant.new.brew do
python do
ENV['PYENCHANT_LIBRARY_PATH'] = lib/'libenchant.dylib'
system python, 'setup.py', 'install', "--prefix=#{prefix}",
'--single-version-externally-managed',
'--record=installed.txt'
end
end
end
end
def test
python do
system python, "-c", "import enchant; d=enchant.Dict('en_US'); print(d.suggest('homebrew'))"
end
end
end

View File

@ -5,7 +5,10 @@ class Fail2ban < Formula
url 'http://cloud.github.com/downloads/fail2ban/fail2ban/fail2ban_0.8.7.1.orig.tar.gz'
sha1 'ec1a7ea1360056d5095bb9de733c1e388bd22373'
depends_on :python
def install
rm 'setup.cfg'
inreplace 'setup.py' do |s|
s.gsub! /\/etc/, etc
s.gsub! /\/var/, var
@ -21,13 +24,11 @@ class Fail2ban < Formula
inreplace 'fail2ban-regex', '/etc', etc
inreplace 'fail2ban-server', '/var', var
inreplace 'config/fail2ban.conf', '/var/run', (var + 'run')
inreplace 'config/fail2ban.conf', '/var/run', (var/'run')
system "python", "setup.py", "install",
"--prefix=#{prefix}",
"--install-lib=#{libexec}",
"--install-data=#{libexec}",
"--install-scripts=#{bin}"
python do
system python, "setup.py", "install", "--prefix=#{prefix}", "--install-lib=#{libexec}"
end
end
plist_options :startup => true
@ -52,7 +53,9 @@ class Fail2ban < Formula
EOS
end
def caveats; <<-EOS.undent
def caveats
<<-EOS.undent
#{python.standard_caveats if python}
Before using Fail2Ban for the first time you should edit jail
configuration and enable the jails that you want to use, for instance
ssh-ipfw. Also make sure that they point to the correct configuration

View File

@ -7,23 +7,20 @@ class Fontforge < Formula
head 'https://github.com/fontforge/fontforge.git'
env :std
option 'without-python', 'Build without Python'
option 'with-gif', 'Build with GIF support'
option 'with-x', 'Build with X'
depends_on 'gettext'
depends_on :xcode # Because: #include </Developer/Headers/FlatCarbon/Files.h>
depends_on :python => :recommended
depends_on :libpng => :recommended
depends_on 'jpeg' => :recommended
depends_on 'libtiff' => :recommended
depends_on :x11 if build.with? 'x'
depends_on :x11 => :recommended
depends_on 'giflib' if build.with? 'gif'
depends_on 'cairo' => :optional
depends_on 'pango' => :optional
depends_on 'libspiro' => :optional
depends_on 'fontconfig'
fails_with :llvm do
build 2336
@ -35,29 +32,30 @@ class Fontforge < Formula
"--enable-double",
"--without-freetype-bytecode"]
if build.without? "python"
args << "--without-python"
else
python_prefix = `python-config --prefix`.strip
python_version = `python-config --libs`.match('-lpython(\d+\.\d+)').captures.at(0)
args << "--with-python-headers=#{python_prefix}/include/python#{python_version}"
args << "--with-python-lib=-lpython#{python_version}"
args << "--without-cairo" unless build.with? "cairo"
args << "--without-pango" unless build.with? "pango"
args << "--without-x" unless build.with? 'x'
# To avoid "dlopen(/opt/local/lib/libpng.2.dylib, 1): image not found"
args << "--with-static-imagelibs"
if build.with? 'python'
args << "--enable-pyextension"
# Fix linking to correct Python library
ENV.prepend "LDFLAGS", "-L#{python.libdir}"
else
args << "--without-python"
end
# Fix linking to correct Python library
ENV.prepend "LDFLAGS", "-L#{python_prefix}/lib" unless build.without? "python"
# Fix linker error; see: http://trac.macports.org/ticket/25012
ENV.append "LDFLAGS", "-lintl"
# Reset ARCHFLAGS to match how we build
ENV["ARCHFLAGS"] = MacOS.prefer_64_bit? ? "-arch x86_64" : "-arch i386"
# Set up framework paths so FlatCarbon replacement paths work (see below)
ENV.append "CFLAGS", "-F/System/Library/Frameworks/CoreServices.framework/Frameworks"
ENV.append "CFLAGS", "-F/System/Library/Frameworks/Carbon.framework/Frameworks"
args << "--without-cairo" unless build.with? "cairo"
args << "--without-pango" unless build.with? "pango"
ENV.append "CFLAGS", "-F#{MacOS.sdk_path}/System/Library/Frameworks/CoreServices.framework/Frameworks"
ENV.append "CFLAGS", "-F#{MacOS.sdk_path}/System/Library/Frameworks/Carbon.framework/Frameworks"
system "./configure", *args
@ -70,7 +68,7 @@ class Fontforge < Formula
# Fix install location of Python extension; see:
# http://sourceforge.net/mailarchive/message.php?msg_id=26827938
inreplace "Makefile" do |s|
s.gsub! "python setup.py install --prefix=$(prefix) --root=$(DESTDIR)", "python setup.py install --prefix=$(prefix)"
s.gsub! "python setup.py install --prefix=$(prefix) --root=$(DESTDIR)", "#{python} setup.py install --prefix=$(prefix)"
end
# Replace FlatCarbon headers with the real paths
@ -86,12 +84,9 @@ class Fontforge < Formula
system "make install"
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
def test
system "#{bin}/fontforge", "-version"
system python, "-c", "import fontforge"
end
def caveats
@ -104,16 +99,9 @@ class Fontforge < Formula
ln -s #{opt_prefix}/FontForge.app /Applications
EOS
python_caveats = <<-EOS.undent
To use the Python extension with non-homebrew Python, you need to amend your
PYTHONPATH like so:
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
EOS
s = ""
s += x_caveats if build.with? "x"
s += python_caveats unless build.without? "python"
s += python.standard_caveats if python
return s
end

View File

@ -5,6 +5,8 @@ class Fsh < Formula
url 'http://www.lysator.liu.se/fsh/fsh-1.2.tar.gz'
sha1 'c2f1e923076d368fbb5504dcd1d33c74024b0d1b'
depends_on :python
def install
# FCNTL was deprecated and needs to be changed to fcntl
inreplace 'fshcompat.py', 'FCNTL', 'fcntl'
@ -14,10 +16,5 @@ class Fsh < Formula
"--prefix=#{prefix}",
"--infodir=#{info}"
system "make install"
cd bin do
inreplace ["fsh", "fshd", "in.fshd"],
"#! /usr/local/bin/python", "#!/usr/bin/env python"
end
end
end

View File

@ -10,7 +10,6 @@ class Gdal < Formula
option 'complete', 'Use additional Homebrew libraries to provide more drivers.'
option 'with-postgres', 'Specify PostgreSQL as a dependency.'
option 'with-mysql', 'Specify MySQL as a dependency.'
option 'without-python', 'Build without Python support (disables a lot of tools).'
option 'enable-opencl', 'Build with OpenCL acceleration.'
option 'enable-armadillo', 'Build with Armadillo accelerated TPS transforms.'
option 'enable-unsupported', "Allow configure to drag in any library it can find. Invoke this at your own risk."
@ -18,6 +17,7 @@ class Gdal < Formula
# For creating up to date man pages.
depends_on 'doxygen' => :build if build.head?
depends_on :python => :recommended
depends_on :libpng
depends_on 'jpeg'
depends_on 'giflib'
@ -200,18 +200,7 @@ class Gdal < Formula
system "make"
system "make install"
unless build.include? 'without-python'
# If setuptools happens to be installed, setup.py will cowardly refuse to
# install to anywhere that is not on the PYTHONPATH.
#
# Really setuptools, we're all consenting adults here...
python_lib = lib + which_python + 'site-packages'
ENV.append 'PYTHONPATH', python_lib
# setuptools is also apparently incapable of making the directory it's
# self
python_lib.mkpath
python do
# `python-config` may try to talk us into building bindings for more
# architectures than we really should.
if MacOS.prefer_64_bit?
@ -221,7 +210,7 @@ class Gdal < Formula
end
cd 'swig/python' do
system "python", "setup.py", "install_lib", "--install-dir=#{python_lib}"
system python, "setup.py", "install", "--prefix=#{prefix}", "--record=installed.txt", "--single-version-externally-managed"
bin.install Dir['scripts/*']
end
end
@ -232,22 +221,13 @@ class Gdal < Formula
Dir[bin + '*.dox'].each { |p| rm p }
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
unless build.include? 'without-python'
def caveats
<<-EOS
This version of GDAL was built with Python support. In addition to providing
modules that makes GDAL functions available to Python scripts, the Python
binding provides ~18 additional command line tools.
Unless you are using Homebrew's Python, both the bindings and the
additional tools will be unusable unless the following directory is added to
the PYTHONPATH:
#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages
def caveats
if python
python.standard_caveats +
<<-EOS.undent
This version of GDAL was built with Python support. In addition to providing
modules that makes GDAL functions available to Python scripts, the Python
binding provides ~18 additional command line tools.
EOS
end
end

View File

@ -9,6 +9,7 @@ class GitCola < Formula
option 'with-docs', "Build man pages using asciidoc and xmlto"
depends_on :python
depends_on 'pyqt'
if build.include? 'with-docs'
@ -18,18 +19,17 @@ class GitCola < Formula
end
def install
ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages", ':'
system "make", "prefix=#{prefix}", "install"
python do
# The python do block creates the PYTHONPATH and temp. site-packages
system "make", "prefix=#{prefix}", "install"
if build.include? 'with-docs'
system "make", "-C", "share/doc/git-cola",
"-f", "Makefile.asciidoc",
"prefix=#{prefix}",
"install", "install-html"
if build.include? 'with-docs'
system "make", "-C", "share/doc/git-cola",
"-f", "Makefile.asciidoc",
"prefix=#{prefix}",
"install", "install-html"
end
end
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end

View File

@ -20,6 +20,7 @@ class Git < Formula
option 'with-blk-sha1', 'Compile with the block-optimized SHA1 implementation'
option 'without-completions', 'Disable bash/zsh completions from "contrib" directory'
depends_on :python
depends_on 'pcre' => :optional
depends_on 'gettext' => :optional
@ -29,8 +30,9 @@ class Git < Formula
ENV['NO_DARWIN_PORTS'] = '1'
ENV['V'] = '1' # build verbosely
ENV['NO_R_TO_GCC_LINKER'] = '1' # pass arguments to LD correctly
ENV['PERL_PATH'] = which 'perl' # workaround for users of perlbrew
ENV['PYTHON_PATH'] = which 'python' # python can be brewed or unbrewed
ENV['PYTHON_PATH'] = python.binary if python
# Clean XCode 4.x installs don't include Perl MakeMaker
ENV['NO_PERL_MAKEMAKER'] = '1' if MacOS.version >= :lion

View File

@ -5,19 +5,17 @@ class Glade < Formula
url 'http://ftp.gnome.org/pub/GNOME/sources/glade3/3.8/glade3-3.8.3.tar.xz'
sha256 '84bb2d7f782f203e4aab923e47db8d22529229b13e59570945261611c63941d6'
depends_on :python
depends_on 'pkg-config' => :build
depends_on 'xz' => :build
depends_on 'intltool' => :build
depends_on 'gettext'
depends_on 'libglade'
depends_on 'libxml2' # make this dep explicit
depends_on 'hicolor-icon-theme'
depends_on :x11
def install
pydir = 'python' + `python -c 'import sys;print(sys.version[:3])'`.strip
libxml2 = Formula.factory('libxml2')
ENV.prepend 'PYTHONPATH', libxml2.lib/pydir/'site-packages', ':'
# Find our docbook catalog
ENV['XML_CATALOG_FILES'] = "#{etc}/xml/catalog"

View File

@ -8,6 +8,7 @@ class GnomeDocUtils < Formula
depends_on 'pkg-config' => :build
depends_on 'xz' => :build
depends_on 'intltool' => :build
depends_on :python
depends_on 'docbook'
depends_on 'gettext'
depends_on 'libxml2' => 'with-python'
@ -18,20 +19,17 @@ class GnomeDocUtils < Formula
end
def install
# TODO this should possibly be moved up into build.rb
pydir = 'python' + `python -c 'import sys;print(sys.version[:3])'`.strip
libxml2 = Formula.factory('libxml2')
ENV.prepend 'PYTHONPATH', libxml2.lib/pydir/'site-packages', ':'
python do
# Find our docbook catalog
ENV['XML_CATALOG_FILES'] = "#{etc}/xml/catalog"
# Find our docbook catalog
ENV['XML_CATALOG_FILES'] = "#{etc}/xml/catalog"
system "./configure", "--prefix=#{prefix}",
"--disable-scrollkeeper",
"--enable-build-utils=yes"
system "./configure", "--prefix=#{prefix}",
"--disable-scrollkeeper",
"--enable-build-utils=yes"
# Compilation doesn't work right if we jump straight to make install
system "make"
system "make install"
# Compilation doesn't work right if we jump straight to make install
system "make"
system "make install"
end
end
end

View File

@ -5,6 +5,8 @@ class GoogleAppEngine < Formula
url 'http://googleappengine.googlecode.com/files/google_appengine_1.8.0.zip'
sha1 '71b5f3ee06dce0a7d6af32d65ae27272eac038cb'
depends_on :python
def install
cd '..'
share.install 'google_appengine' => name

View File

@ -10,6 +10,7 @@ class Graphviz < Formula
sha1 'a1e6ba5d9298aa87b78170e2c74f21d7e579364e'
end
# To find Ruby and Co.
env :std
option :universal
@ -25,6 +26,7 @@ class Graphviz < Formula
depends_on 'pkg-config' => :build
depends_on 'pango' if build.include? 'with-pangocairo'
depends_on 'swig' if build.include? 'with-bindings'
depends_on :python if build.include? 'with-bindings' # this will set up python
depends_on 'gts' if build.include? 'with-gts'
depends_on :freetype if build.include? 'with-freetype' or MacOS::X11.installed?
depends_on :x11 if build.include? 'with-x' or MacOS::X11.installed?

View File

@ -7,35 +7,33 @@ class Grass < Formula
head 'https://svn.osgeo.org/grass/grass/trunk'
option "without-gui", "Build without WxPython interface. Command line tools still available."
depends_on "pkg-config" => :build
depends_on :python
depends_on "gettext"
depends_on "readline"
depends_on "gdal"
depends_on "libtiff"
depends_on "unixodbc"
depends_on "fftw"
depends_on 'wxmac' => :recommended # prefer over OS X's version because of 64bit
depends_on 'postgres' => :optional
depends_on :mysql => :optional
depends_on "cairo" if MacOS.version == :leopard
depends_on :x11
depends_on :x11 # needs to find at least X11/include/GL/gl.h
# Patches ensure 32 bit system python is used for wxWidgets and that files
# are not installed outside of the prefix.
# Patches that files are not installed outside of the prefix.
def patches; DATA; end
fails_with :clang do
cause "Multiple build failures while compiling GRASS tools."
end
option "with-postgres", "specify PostgreSQL as a dependency."
option "with-mysql", "Specify MySQL as a dependency."
option "without-gui", "Build without WxPython interface. Command line tools still available."
def headless?
# The GRASS GUI is based on WxPython. Unfortunately, Lion does not include
# this module so we have to drop it.
#
# This restriction can be lifted once WxMac hits a stable release that is
# 64-bit capable.
build.include? 'without-gui' or MacOS.version >= :lion
build.include? 'without-gui' or MacOS.version == :lion
end
def install
@ -44,37 +42,37 @@ class Grass < Formula
args = [
"--disable-debug", "--disable-dependency-tracking",
"--with-libs=#{MacOS::X11.lib} #{HOMEBREW_PREFIX}/lib",
"--with-includes=#{HOMEBREW_PREFIX}/include",
"--enable-largefile",
"--enable-shared",
"--with-cxx",
"--with-opengl=aqua",
"--with-x",
"--without-motif",
"--with-python=/usr/bin/python-config",
"--with-python",
"--with-blas",
"--with-lapack",
"--with-sqlite",
"--with-odbc",
"--with-geos=#{HOMEBREW_PREFIX}/bin/geos-config",
"--with-png-includes=#{MacOS::X11.include}",
"--with-geos=#{Formula.factory('geos').opt_prefix}/bin/geos-config",
"--with-png",
"--with-readline-includes=#{readline.include}",
"--with-readline-libs=#{readline.lib}",
"--with-readline-includes=#{readline.opt_prefix}/include",
"--with-readline-libs=#{readline.opt_prefix}/lib",
"--with-readline",
"--with-nls-includes=#{gettext.include}",
"--with-nls-libs=#{gettext.lib}",
"--with-nls-includes=#{gettext.opt_prefix}/include",
"--with-nls-libs=#{gettext.opt_prefix}/lib",
"--with-nls",
"--with-freetype-includes=#{MacOS::X11.include} #{MacOS::X11.include}/freetype2",
"--with-freetype",
"--without-tcltk" # Disabled due to compatibility issues with OS X Tcl/Tk
]
if headless?
unless MacOS::CLT.installed?
# On Xcode-only systems (without the CLT), we have to help:
args << "--with-macosx-sdk=#{MacOS.sdk_path}"
args << "--with-opengl-includes=#{MacOS.sdk_path}/System/Library/Frameworks/OpenGL.framework/Headers"
end
if headless? or build.without? 'wxmac'
args << "--without-wxwidgets"
else
args << "--with-wxwidgets=/usr/bin/wx-config"
args << "--with-wxwidgets=#{Formula.factory('wxmac').opt_prefix}/bin/wx-config"
end
if MacOS.prefer_64_bit?
@ -96,11 +94,11 @@ class Grass < Formula
args << "--with-cairo"
# Database support
if build.include? "with-postgres"
if build.with? "postgres"
args << "--with-postgres"
end
if build.include? "with-mysql"
if build.with? "mysql"
mysql = Formula.factory('mysql')
args << "--with-mysql-includes=#{mysql.include + 'mysql'}"
args << "--with-mysql-libs=#{mysql.lib + 'mysql'}"
@ -121,21 +119,22 @@ class Grass < Formula
The command line tools remain fully functional.
EOS
else
elsif MacOS.version < :lion
# On Lion or above, we are very happy with our brewed wxwidgets.
<<-EOS.undent
GRASS is currently in a transition period with respect to GUI support.
The old Tcl/Tk GUI cannot be built using the version of Tcl/Tk provided
by OS X. This has the unfortunate consquence of disabling the NVIZ
visualization system. A keg-only Tcl/Tk brew or some deep hackery of
by OS X. This has the unfortunate consquence of disabling the NVIZ
visualization system. A keg-only Tcl/Tk brew or some deep hackery of
the GRASS source may be possible ways to get around this around this.
Tcl/Tk will eventually be depreciated in GRASS 7 and this version has
been built to support the newer wxPython based GUI. However, there is
been built to support the newer wxPython based GUI. However, there is
a problem as wxWidgets does not compile as a 64 bit library on OS X
which affects Snow Leopard users. In order to remedy this, the GRASS
which affects Snow Leopard users. In order to remedy this, the GRASS
startup script:
#{prefix}/grass-6.4.0/etc/Init.sh
#{prefix}/grass-#{version}/etc/Init.sh
has been modified to use the OS X system Python and to start it in 32 bit mode.
EOS
@ -144,35 +143,6 @@ class Grass < Formula
end
__END__
Patch 1:
Force 32-bit system Python to be used for the WxPython GUI.
diff --git a/lib/init/init.sh b/lib/init/init.sh
index 8c87fe1..2d1a2a3 100644
--- a/lib/init/init.sh
+++ b/lib/init/init.sh
@@ -27,6 +27,17 @@ trap "echo 'User break!' ; exit" 2 3 15
# Set default GUI
DEFAULT_GUI="wxpython"
+
+# Homebrew Additions:
+#
+# So, problem with wxWidgets is that the developers have not released a stable
+# version that builds x86_64 for OS X. So, in order to use the nice GUI for
+# GRASS, we have to ensure the system python is used and ensure it starts in 32
+# bit mode.
+export VERSIONER_PYTHON_PREFER_32_BIT=yes
+export GRASS_PYTHON=/usr/bin/pythonw
+
+
# the following is only meant to be an internal variable for debugging this script.
# use 'g.gisenv set="DEBUG=[0-5]"' to turn GRASS debug mode on properly.
if [ -z "$GRASS_DEBUG" ] ; then
Patch 2:
Remove two lines of the Makefile that try to install stuff to
/Library/Documentation---which is outside of the prefix and usually fails due
to permissions issues.

View File

@ -5,10 +5,13 @@ class Grc < Formula
url 'http://korpus.juls.savba.sk/~garabik/software/grc/grc_1.4.tar.gz'
sha1 '79fd504d8291f13486d361611415ae60fa56712a'
depends_on :python
def install
#TODO we should deprefixify since it's python and thus possible
inreplace ['grc', 'grc.1'], '/etc', etc
inreplace ['grcat', 'grcat.1'], '/usr/local', prefix
inreplace ['grc', 'grcat'], '#! /usr/bin/python', '#!/usr/bin/env python'
etc.install 'grc.conf'
bin.install %w[grc grcat]

View File

@ -7,6 +7,7 @@ class GtkDoc < Formula
depends_on 'pkg-config' => :build
depends_on 'gnome-doc-utils' => :build
depends_on :python
depends_on 'gettext'
depends_on 'glib'
depends_on 'docbook'
@ -14,13 +15,8 @@ class GtkDoc < Formula
depends_on 'libxml2'
def install
# libxml2 must be installed with python support; this should be ensured
# by the gnome-doc-utils dependency. However it is keg-only, so we have
# to put its site-packages directory on the PYTHONPATH
pydir = 'python' + `python -c 'import sys;print(sys.version[:3])'`.strip
libxml2 = Formula.factory('libxml2')
ENV.prepend 'PYTHONPATH', libxml2.lib/pydir/'site-packages', ':'
# libxml2 is keg_only but we installed the python bindings globally, so
# configure should find them.
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",

View File

@ -8,9 +8,9 @@ class Io < Formula
head 'https://github.com/stevedekorte/io.git'
option 'without-addons', 'Build without addons'
option 'without-python', 'Build without python addon'
depends_on 'cmake' => :build
depends_on :python => :recommended
depends_on 'libevent'
depends_on 'libffi'
depends_on 'ossp-uuid'
@ -40,18 +40,23 @@ class Io < Formula
def install
ENV.j1
if build.include? 'without-addons'
if build.without? 'addons'
inreplace "CMakeLists.txt",
'add_subdirectory(addons)',
'#add_subdirectory(addons)'
end
if build.include? 'without-python'
if build.without? 'python'
inreplace "addons/CMakeLists.txt",
'add_subdirectory(Python)',
'#add_subdirectory(Python)'
end
mkdir 'buildroot' do
system "cmake", "..", *std_cmake_args
args = std_cmake_args
# For Xcode-only systems, the headers of system's python are inside of Xcode:
args << "-DPYTHON_INCLUDE_DIR='#{python.incdir}'" if python
# Cmake picks up the system's python dylib, even if we have a brewed one:
args << "-DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'" if python
system "cmake", "..", *args
system 'make'
output = %x[./_build/binaries/io ../libs/iovm/tests/correctness/run.io]
if $?.exitstatus != 0

View File

@ -5,9 +5,8 @@ class Ldns < Formula
url 'http://nlnetlabs.nl/downloads/ldns/ldns-1.6.16.tar.gz'
sha1 '5b4fc6c5c3078cd061905c47178478cb1015c62a'
option "python", "Build Python pydns bindings"
depends_on 'swig' if build.include? 'python'
depends_on :python => :optional
depends_on 'swig' if build.with? 'python'
def install
# gost requires OpenSSL >= 1.0.0
@ -15,12 +14,17 @@ class Ldns < Formula
--prefix=#{prefix}
--disable-gost
--with-drill
--with-ssl=#{MacOS.sdk_path}/usr
]
args << "--with-pyldns" if build.include? 'python'
if build.with? 'python'
args << "--with-pyldns"
ENV['PYTHON_SITE_PKG'] = python.site_packages
end
system "./configure", *args
system "make"
system "make install"
system "make install-pyldns" if build.include? 'python'
system "make", "install-pyldns"
end
end

View File

@ -8,9 +8,9 @@ class Ledger < Formula
head 'https://github.com/ledger/ledger.git', :branch => 'master'
option 'debug', 'Build with debugging symbols enabled'
option 'python', 'Enable Python support'
depends_on 'boost'
depends_on :python => :optional
if build.head?
depends_on 'cmake' => :build
depends_on 'ninja' => :build
@ -24,14 +24,23 @@ class Ledger < Formula
end
def install
opoo "Homebrew: Sorry, python bindings for --HEAD seem not to install. Help us fixing this!" if build.with? 'python'
# find Homebrew's libpcre
ENV.append 'LDFLAGS', "-L#{HOMEBREW_PREFIX}/lib"
if build.head?
args = [((build.include? 'debug') ? 'debug' : 'opt'), "make", "-N", "-j#{ENV.make_jobs}", "--output=build"]
args << '--python' if build.include? 'python'
system "./acprep", *args
system "cmake", "-D", "CMAKE_INSTALL_PREFIX=#{prefix}", "-P", "build/cmake_install.cmake"
if build.with? 'python'
args << '--python'
# acprep picks up system python because CMake is used
inreplace 'acprep', "self.configure_args = []",
"self.configure_args = ['-DPYTHON_INCLUDE_DIR=#{python.incdir}', '-DPYTHON_LIBRARY=#{python.libdir}/lib#{python.xy}.dylib']"
end
# Support homebrew not at /usr/local. Also support Xcode-only setups:
inreplace 'acprep', 'search_prefixes = [', "search_prefixes = ['#{HOMEBREW_PREFIX}','#{MacOS.sdk_path}/usr',"
system "./acprep", "--prefix=#{prefix}", *args
system "cmake", "-P", "build/cmake_install.cmake", "-DUSE_PYTHON=ON"
else
args = []
if build.with? 'libofx'

View File

@ -9,6 +9,7 @@ class Libcaca < Formula
option 'with-imlib2', 'Build with Imlib2 support'
depends_on :x11 if MacOS::X11.installed? or build.include? "with-imlib2"
depends_on :python => :recommended
if build.include? "with-imlib2"
depends_on 'pkg-config' => :build
@ -28,12 +29,13 @@ class Libcaca < Formula
# Don't build csharp bindings
# Don't build ruby bindings; fails for adamv w/ Homebrew Ruby 1.9.2
# Don't build python bindings:
# Fix --destdir issue.
# ../.auto/py-compile: Missing argument to --destdir.
inreplace 'python/Makefile.in', '$(am__py_compile) --destdir "$(DESTDIR)"', "$(am__py_compile) --destdir \"$(cacadir)\""
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-python",
"--disable-doc",
"--disable-slang",
"--disable-java",

View File

@ -5,10 +5,9 @@ class Libdnet < Formula
url 'http://libdnet.googlecode.com/files/libdnet-1.12.tgz'
sha1 '71302be302e84fc19b559e811951b5d600d976f8'
depends_on :automake
depends_on :libtool
option 'with-python', 'Build Python module'
depends_on :automake => :build
depends_on :libtool => :build
depends_on :python => :optional
# Fix use of deprecated macros
# http://code.google.com/p/libdnet/issues/detail?id=27
@ -26,7 +25,7 @@ class Libdnet < Formula
--prefix=#{prefix}
--mandir=#{man}
]
args << "--with-python" if build.include? "with-python"
args << "--with-python" if build.with? "python"
system "./configure", *args
system "make install"
end

View File

@ -12,14 +12,15 @@ class Liblunar < Formula
depends_on 'glib'
depends_on 'gettext'
depends_on 'vala' => :optional
depends_on 'pygobject' if build.include? 'python'
depends_on :python => :optional
depends_on 'pygobject' if build.with? 'python'
def install
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
]
args << '--disable-python' unless build.include? 'python'
args << '--disable-python' unless build.with? 'python'
system './configure', *args
system 'make install'
end

View File

@ -5,12 +5,12 @@ class Libming < Formula
url 'http://sourceforge.net/projects/ming/files/Releases/ming-0.4.4.tar.bz2'
sha1 'e803b3b94a00a361e3415105f26112cf6f7bac81'
option 'python', 'Build the python extension'
option 'perl', 'Build the perl extension'
option 'php', 'Build the php extension'
depends_on :libpng
depends_on :freetype
depends_on :python => :optional
depends_on 'giflib' => :optional
# Helps us find libgif.dylib, not libungif.dylib which is retired.
@ -20,7 +20,7 @@ class Libming < Formula
def install
# TODO: Libming also includes scripting front-ends for Perl, Python, TCL
# and PHP. These are disabled by default. Figure out what it would take to
# and PHP. These are disabled by default. Figure out what it would take to
# enable them.
# - python works if we tell it to use our giflib not ungif.
# - perl works without any change
@ -31,9 +31,9 @@ class Libming < Formula
--disable-silent-rules
--prefix=#{prefix}
]
args << '--enable-python' if build.include? 'python'
args << '--enable-perl' if build.include? 'perl'
args << '--enable-php' if build.include? 'php'
args << '--enable-python' if build.with? 'python'
args << '--enable-perl' if build.with? 'perl'
args << '--enable-php' if build.with? 'php'
system './configure', *args
system 'make'

View File

@ -7,15 +7,12 @@ class Libplist < Formula
head 'http://git.sukimashita.com/libplist.git'
# Improve the default option descr. generated by `depends_on :python => :optional`
option 'with-python', 'Enable Cython Python bindings'
depends_on 'cmake' => :build
if build.include? 'with-python'
depends_on 'Cython' => :python
# Needed to find the Cython executable
env :userpaths
end
depends_on :python => :optional
depends_on 'Cython' => :python if build.with? 'python'
def install
ENV.deparallelize # make fails on an 8-core Mac Pro
@ -25,39 +22,13 @@ class Libplist < Formula
# Disable Swig Python bindings
args << "-DENABLE_SWIG='OFF'"
if build.include? 'with-python'
## Taken from opencv.rb
#
# The CMake `FindPythonLibs` Module is dumber than a bag of hammers when
# more than one python installation is available---for example, it clings
# to the Header folder of the system Python Framework like a drowning
# sailor.
#
# This code was cribbed from the VTK formula and uses the output to
# `python-config` to do the job FindPythonLibs should be doing in the first
# place.
python_prefix = `python-config --prefix`.strip
# Python is actually a library. The libpythonX.Y.dylib points to this lib, too.
if File.exist? "#{python_prefix}/Python"
# Python was compiled with --framework:
args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library'
# For Xcode-only systems, the headers of system's python are inside of Xcode
args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'"
else
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
end
else
python_lib = "#{python_prefix}/lib/lib#{which_python}"
if File.exists? "#{python_lib}.a"
args << "-DPYTHON_LIBRARY='#{python_lib}.a'"
else
args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
end
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/#{which_python}'"
end
else
# Also disable Cython Python bindings if we're not building with '--python'
if python do
# For Xcode-only systems, the headers of system's python are inside of Xcode:
args << "-DPYTHON_INCLUDE_DIR='#{python.incdir}'"
# Cmake picks up the system's python dylib, even if we have a brewed one:
args << "-DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'"
end; else
# Also disable Cython Python bindings if we're not building --with-python
args << "-DENABLE_CYTHON='OFF'"
end
@ -66,16 +37,6 @@ class Libplist < Formula
end
def caveats
if build.include? 'with-python'
<<-EOS.undent
To use the Python bindings with non-homebrew Python, you need to amend your
PYTHONPATH like so:
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
EOS
end
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
python.standard_caveats if python
end
end

View File

@ -6,19 +6,19 @@ class Libpst < Formula
sha1 'c81df95509494c99222b0b603f7500dd9caceff1'
option 'pst2dii', 'Build pst2dii using gd'
option 'python', 'Build the libpst python interface'
depends_on 'boost'
depends_on 'gd' if build.include? 'pst2dii'
depends_on :python => :optional
depends_on 'gd' if build.with? 'pst2dii'
def install
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
]
args << '--disable-dii' unless build.include? 'pst2dii'
if build.include? 'python'
ENV['PYTHON_EXTRA_LDFLAGS'] = '-u _PyMac_Error'
args << '--disable-dii' unless build.with? 'pst2dii'
if build.with? 'python'
# ENV['PYTHON_EXTRA_LDFLAGS'] = '-u _PyMac_Error'
args << '--enable-python' << '--with-boost-python=mt'
else
args << '--disable-python'

View File

@ -5,12 +5,31 @@ class Libstfl < Formula
url 'http://www.clifford.at/stfl/stfl-0.22.tar.gz'
sha1 '226488be2b33867dfb233f0fa2dde2d066e494bd'
depends_on :python => :recommended
depends_on 'swig'
def patches; DATA; end
def install
system "make", "install",
"CC=#{ENV.cc} -pthread",
"prefix=#{prefix}"
args = ["CC=#{ENV.cc} -pthread", "prefix=#{prefix}"]
args << "FOUND_RUBY = 0" unless MacOS::CLT.installed? # Ruby does not build on Xcode only. Help us fix this!
if build.with? 'python'
# Install into the site-packages in the Cellar (so uninstall works)
inreplace 'python/Makefile.snippet' do |s|
s.change_make_var! "PYTHON_SITEARCH", python.site_packages
s.gsub! 'lib-dynload/', ''
end
# Fails race condition of test:
# ImportError: dynamic module does not define init function (init_stfl)
# make: *** [python/_stfl.so] Error 1
ENV.deparallelize
else
args << "FOUND_PYTHON = 0"
end
system "make", "install", *args
end
end

View File

@ -7,6 +7,7 @@ class Libswiften < Formula
head "git://swift.im/swift"
depends_on :python => :build
depends_on 'scons' => :build
depends_on 'libidn'
depends_on 'boost'

View File

@ -9,7 +9,8 @@ class Libxml2 < Formula
keg_only :provided_by_osx
option :universal
option 'with-python', 'Compile the libxml2 Python 2.x modules'
depends_on :python => :recommended
fails_with :llvm do
build 2326
@ -26,33 +27,40 @@ class Libxml2 < Formula
ENV.deparallelize
system "make install"
if build.include? 'with-python'
# Build Python bindings manually
python do
# This python do block sets up the site-packages in the Cellar.
cd 'python' do
python_lib = lib/which_python/'site-packages'
ENV.append 'PYTHONPATH', python_lib
python_lib.mkpath
archs = archs_for_command("python")
archs.remove_ppc!
arch_flags = archs.as_arch_flags
ENV.append 'CFLAGS', arch_flags
ENV.append 'LDFLAGS', arch_flags
unless MacOS::CLT.installed?
# We can hijack /opt/include to insert SDKROOT/usr/include
inreplace 'setup.py', '"/opt/include",', "'#{MacOS.sdk_path}/usr/include',"
end
system "python", "setup.py",
"install_lib",
"--install-dir=#{python_lib}"
# We need to insert our include dir first
inreplace 'setup.py', 'includes_dir = [', "includes_dir = ['#{include}', '#{MacOS.sdk_path}/usr/include',"
system python, 'setup.py', "install", "--prefix=#{prefix}"
end
# This is keg_only but it makes sense to have the python bindings:
ohai 'Linking python bindings'
Dir["#{python.site_packages}/*"].each{ |f|
path = python.global_site_packages/(Pathname.new(f).basename)
puts path
rm path if path.exist?
ln_s f, path
}
end
end
def caveats
<<-EOS.undent
Even if this formula is keg_only, the python bindings have been linked
into the global site-packages for your convenience.
#{python.global_site_packages}
EOS
end if build.with? 'python'
def test
if build.with? 'python'
system python, '-c', "import libxml2"
else
puts "No tests beacuse build --wtihout-python."
true
end
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end

View File

@ -5,14 +5,13 @@ class LittleCms < Formula
url 'http://sourceforge.net/projects/lcms/files/lcms/1.19/lcms-1.19.tar.gz'
sha1 'd5b075ccffc0068015f74f78e4bc39138bcfe2d4'
option 'with-python', "Build Python bindings"
depends_on :python => :optional
depends_on 'jpeg' => :optional
depends_on 'libtiff' => :optional
def install
args = ["--disable-debug", "--prefix=#{prefix}"]
args << "--with-python" if build.include? "with-python"
args << "--with-python" if build.with? "python"
system "./configure", *args
system "make install"

View File

@ -33,14 +33,20 @@ class Llvm < Formula
option :universal
option 'with-clang', 'Build Clang C/ObjC/C++ frontend'
option 'with-asan', 'Include support for -faddress-sanitizer (from compiler-rt)'
option 'shared', 'Build LLVM as a shared library'
option 'disable-shared', "Don't build LLVM as a shared library"
option 'all-targets', 'Build all target backends'
option 'rtti', 'Build with C++ RTTI'
option 'disable-assertions', 'Speeds up LLVM, but provides less debug information'
depends_on :python => :recommended
env :std if build.universal?
def install
if build.with? 'python' and build.include? 'disable-shared'
raise 'The Python bindings need the shared library.'
end
Clang.new("clang").brew do
clang_dir.install Dir['*']
end if build.include? 'with-clang'
@ -69,7 +75,7 @@ class Llvm < Formula
else
args << "--enable-targets=host"
end
args << "--enable-shared" if build.include? 'shared'
args << "--enable-shared" unless build.include? 'disable-shared'
args << "--disable-assertions" if build.include? 'disable-assertions'
@ -77,13 +83,18 @@ class Llvm < Formula
system "make install"
# install llvm python bindings
(share/'llvm/bindings').install buildpath/'bindings/python'
if python
unless build.head?
inreplace buildpath/'bindings/python/llvm/common.py', 'LLVM-3.1svn', "libLLVM-#{version}svn"
end
python.site_packages.install buildpath/'bindings/python/llvm'
end
# install clang tools and bindings
cd clang_dir do
system 'make install'
(share/'clang/tools').install 'tools/scan-build', 'tools/scan-view'
(share/'clang/bindings').install 'bindings/python'
python.site_packages.install 'bindings/python/clang' if python
end if build.include? 'with-clang'
end
@ -91,12 +102,15 @@ class Llvm < Formula
system "#{bin}/llvm-config", "--version"
end
def caveats; <<-EOS.undent
Extra tools and bindings are installed in #{share}/llvm and #{share}/clang.
def caveats
s = ''
s += python.standard_caveats if python
s += <<-EOS.undent
Extra tools are installed in #{share}/llvm and #{share}/clang.
If you already have LLVM installed, then "brew upgrade llvm" might not work.
Instead, try:
brew rm llvm && brew install llvm
If you already have LLVM installed, then "brew upgrade llvm" might not work.
Instead, try:
brew rm llvm && brew install llvm
EOS
end

View File

@ -6,6 +6,8 @@ class Lorem < Formula
version '0.6.1'
sha1 'aa6ef66e5ee1151397f19b358d772af316cf333b'
depends_on :python
def install
inreplace "lorem", "!/usr/bin/python", "!/usr/bin/env python"
bin.install "lorem"

View File

@ -10,10 +10,11 @@ class Macvim < Formula
option "custom-icons", "Try to generate custom document icons"
option "override-system-vim", "Override system vim"
option "with-python3", "Build with Python 3 scripting support"
depends_on 'cscope' => :recommended
depends_on 'lua' => :optional
depends_on :python => :recommended
depends_on :python3 => :optional # Help us! :python3 is MacVim makes the window disappear!
depends_on :xcode # For xcodebuild.
@ -30,14 +31,16 @@ class Macvim < Formula
args = %W[
--with-features=huge
--with-tlib=ncurses
--enable-multibyte
--with-macarchs=#{arch}
--with-macsdk=10.8
--enable-perlinterp
--enable-pythoninterp
--enable-rubyinterp
--enable-tclinterp
--with-ruby-command=#{RUBY_PATH}
--with-tlib=ncurses
--with-compiledby=Homebrew
--with-local-dir=#{HOMEBREW_PREFIX}
]
args << "--enable-cscope" if build.with? "cscope"
@ -47,7 +50,17 @@ class Macvim < Formula
args << "--with-lua-prefix=#{HOMEBREW_PREFIX}"
end
args << "--enable-python3interp" if build.include? "with-python3"
args << "--enable-pythoninterp=dynamic" if build.with? 'python'
args << "--enable-python3interp=dynamic" if build.with? "python3"
unless MacOS::CLT.installed?
# On Xcode-only systems:
# Macvim cannot deal with "/Applications/Xcode.app/Contents/Developer" as
# it is returned by `xcode-select -print-path` and already set by
# Homebrew (in superenv). Instead Macvim needs the deeper dir to directly
# append "SDKs/...".
args << "--with-developer-dir=#{MacOS::Xcode.prefix}/Platforms/MacOSX.platform/Developer/"
end
system "./configure", *args

View File

@ -15,6 +15,7 @@ class Mapnik < Formula
head 'https://github.com/mapnik/mapnik.git'
depends_on 'pkg-config' => :build
depends_on :python
depends_on :libtool
depends_on :freetype
depends_on :libpng
@ -46,9 +47,7 @@ class Mapnik < Formula
jobs = ENV.make_jobs.to_i
jobs /= 2 if jobs > 2
args = [ "scons/scons.py",
"configure",
"CC=\"#{ENV.cc}\"",
args = [ "CC=\"#{ENV.cc}\"",
"CXX=\"#{ENV.cxx}\"",
"JOBS=#{jobs}",
"PREFIX=#{prefix}",
@ -73,22 +72,16 @@ class Mapnik < Formula
args << "GDAL_CONFIG=#{Formula.factory('gdal').opt_prefix}/bin/gdal-config" if build.with? 'gdal'
args << "PG_CONFIG=#{Formula.factory('postgresql').opt_prefix}/bin/pg_config" if build.with? 'postgresql'
system "python", *args
system "python",
"scons/scons.py",
"install"
python do
system python, "scons/scons.py", "configure", *args
system python, "scons/scons.py", "install"
end
end
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
def caveats
python.standard_caveats if python
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end
__END__

View File

@ -9,21 +9,21 @@ class Mapserver < Formula
option "with-geos", "Build support for GEOS spatial operations"
option "with-php", "Build PHP MapScript module"
option "with-postgresql", "Build support for PostgreSQL as a data source"
option "with-python", "Build Python MapScript module"
# to find custom python
env :userpaths
depends_on :freetype
depends_on :libpng
depends_on :python => :recommended
depends_on 'swig' => :build
depends_on 'giflib'
depends_on 'gd' => %w{with-freetype}
depends_on 'proj'
depends_on 'gdal'
depends_on 'geos' => :optional
depends_on 'postgresql' if build.include? 'with-postgresql' and not MacOS.version >= :lion
depends_on 'fcgi' if build.include? 'with-fastcgi'
depends_on 'cairo' => :optional
def install
args = [
@ -47,6 +47,11 @@ class Mapserver < Formula
args << "--with-fastcgi=#{HOMEBREW_PREFIX}" if build.include? 'with-fastcgi'
unless MacOS::CLT.installed?
inreplace 'configure', "_JTOPDIR=`echo \"$_ACJNI_FOLLOWED\" | sed -e 's://*:/:g' -e 's:/[^/]*$::'`",
"_JTOPDIR='#{MacOS.sdk_path}/System/Library/Frameworks/JavaVM.framework/Headers'"
end
system "./configure", *args
system "make"
@ -54,9 +59,11 @@ class Mapserver < Formula
install_args << "PHP_EXT_DIR=#{prefix}" if build.include? 'with-php'
system "make", "install", *install_args
if build.include? 'with-python'
python do
cd 'mapscript/python' do
system "python", "setup.py", "install"
system python, "setup.py", "install", "--prefix=#{prefix}",
"--single-version-externally-managed",
"--record=installed-files.txt"
end
end
end

View File

@ -7,6 +7,7 @@ class Mercurial < Formula
head 'http://selenic.com/repo/hg', :using => :hg
depends_on :python # its written in Python, so this is a hard dep
depends_on 'docutils' => :python if build.head? or build.include? 'doc'
option 'doc', "Build the documentation"
@ -16,25 +17,29 @@ class Mercurial < Formula
# System-provided Python.
ENV.minimal_optimization
# install the completion script
bash_completion.install 'contrib/bash_completion' => 'hg-completion.bash'
system "make doc" if build.head? or build.include? 'doc'
system "make local"
python do
system "make doc" if build.head? or build.include? 'doc'
system "make local"
libexec.install 'hg', 'mercurial', 'hgext'
libexec.install 'hg', 'mercurial', 'hgext'
# If we get it working with python3, we would need the next line instead:
#['hg', 'mercurial', 'hgext'].each{ |f| libexec.install "#{f}#{python.if3then3}" }
# Symlink the hg binary into bin
bin.install_symlink libexec/'hg'
# Symlink the hg binary into bin
bin.install_symlink libexec/"hg#{python.if3then3}"
# Remove the hard-coded python invocation from hg
inreplace bin/'hg', %r[^#!.*$], '#!/usr/bin/env python'
# Install some contribs
bin.install "contrib/hgk#{python.if3then3}"
# Install man pages
man1.install 'doc/hg.1'
man5.install 'doc/hgignore.5', 'doc/hgrc.5'
# Install some contribs
bin.install 'contrib/hgk'
system 'make clean'
end
# Install man pages
man1.install 'doc/hg.1'
man5.install 'doc/hgignore.5', 'doc/hgrc.5'
end
def caveats

View File

@ -5,8 +5,10 @@ class Ninja < Formula
url 'https://github.com/martine/ninja/archive/v1.3.3.tar.gz'
sha1 '1e27d85316a267afa5e98ed62b660395ab5b9851'
depends_on :python
def install
system "./bootstrap.py"
system python, "./bootstrap.py"
bin.install "ninja"
bash_completion.install 'misc/bash-completion' => 'ninja-completion.sh'
end

View File

@ -1,15 +1,5 @@
require 'formula'
class PythonVersion < Requirement
env :userpaths
satisfy { `python -c 'import sys;print(sys.version[:3])'`.strip.to_f >= 2.6 }
def message
"Node's build system, gyp, requires Python 2.6 or newer."
end
end
class NpmNotInstalled < Requirement
fatal true
@ -55,7 +45,7 @@ class Node < Formula
option 'without-npm', 'npm will not be installed'
depends_on NpmNotInstalled unless build.without? 'npm'
depends_on PythonVersion
depends_on PythonInstalled.new("2.6") => :build
fails_with :llvm do
build 2326

View File

@ -11,9 +11,8 @@ class Omniorb < Formula
url 'http://sourceforge.net/projects/omniorb/files/omniORB/omniORB-4.1.6/omniORB-4.1.6.tar.bz2'
sha1 '383e3b3b605188fe6358316917576e0297c4e1a6'
option 'python', 'Enable Python mappings'
depends_on 'pkg-config' => :build
depends_on :python => :recommended
# http://www.omniorb-support.com/pipermail/omniorb-list/2012-February/031202.html
def patches
@ -21,12 +20,12 @@ class Omniorb < Formula
end
def install
args = ["--prefix=#{prefix}", "PYTHON=#{which 'python'}"]
args = ["--prefix=#{prefix}"]
system "./configure", *args
system "make"
system "make install"
if build.include? 'python'
python do
OmniorbBindings.new.brew do
system "./configure", *args
system "make install"
@ -35,25 +34,14 @@ class Omniorb < Formula
end
def caveats
s = ''
if build.include? 'python'
s += <<-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
return s.empty? ? nil : s
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
python.standard_caveats if python
end
test do
system "#{bin}/omniidl", "-h"
if build.include? 'python'
system "python", "-c", %(import omniORB; print 'omniORBpy', omniORB.__version__)
if build.with? 'python'
system python, "-c", %(import omniORB; print 'omniORBpy', omniORB.__version__)
end
end
end

View File

@ -5,49 +5,30 @@ class OpenBabel < Formula
url 'http://sourceforge.net/projects/openbabel/files/openbabel/2.3.2/openbabel-2.3.2.tar.gz'
sha1 'b8831a308617d1c78a790479523e43524f07d50d'
option 'gui', 'Build the Graphical User Interface'
option 'png', 'Support PNG depiction'
option 'python', 'Compile Python language bindings'
option 'java', 'Compile Java language bindings'
option 'with-cairo', 'Support PNG depiction'
option 'with-java', 'Compile Java language bindings'
depends_on 'pkg-config' => :build
depends_on 'cmake' => :build
depends_on 'wxmac' if build.include? 'gui'
depends_on 'cairo' if build.include? 'png'
depends_on 'eigen' if build.include? 'python'
depends_on 'eigen' if build.include? 'java'
depends_on :python => :optional
depends_on 'wxmac' => :optional
depends_on 'cairo' => :optional
depends_on 'eigen' if build.with?('python') || build.with?('java')
def install
args = %W[ -DCMAKE_INSTALL_PREFIX=#{prefix} ]
args << "-DPYTHON_BINDINGS=ON" if build.include? 'python'
args << "-DJAVA_BINDINGS=ON" if build.include? 'java'
args << "-DBUILD_GUI=ON" if build.include? 'gui'
args << "-DJAVA_BINDINGS=ON" if build.with? 'java'
args << "-DBUILD_GUI=ON" if build.with? 'wxmac'
args << "-DCAIRO_INCLUDE_DIRS=#{include}/cairo "\
"-DCAIRO_LIBRARIES=#{lib}/libcairo.dylib" if build.include? 'png'
"-DCAIRO_LIBRARIES=#{lib}/libcairo.dylib" if build.with? 'cairo'
# Find the right pyhton installation (code from opencv.rb)
if build.include? 'python'
python_prefix = `python-config --prefix`.strip
# Python is actually a library. The libpythonX.Y.dylib points to this lib, too.
if File.exist? "#{python_prefix}/Python"
# Python was compiled with --framework:
args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library'
# For Xcode-only systems, the headers of system's python are inside of Xcode
args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'"
else
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
end
else
python_lib = "#{python_prefix}/lib/lib#{which_python}"
if File.exists? "#{python_lib}.a"
args << "-DPYTHON_LIBRARY='#{python_lib}.a'"
else
args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
end
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/#{which_python}'"
end
args << "-DPYTHON_PACKAGES_PATH='#{lib}/#{which_python}/site-packages'"
python do
args << "-DPYTHON_BINDINGS=ON"
# For Xcode-only systems, the headers of system's python are inside of Xcode:
args << "-DPYTHON_INCLUDE_DIR='#{python.incdir}'"
# Cmake picks up the system's python dylib, even if we have a brewed one:
args << "-DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'"
args << "-DPYTHON_PACKAGES_PATH='#{python.site_packages}'"
end
args << '..'
@ -58,26 +39,18 @@ class OpenBabel < Formula
system "make install"
end
if build.include? 'python'
pydir = lib/which_python/'site-packages'
pydir.install lib/'openbabel.py', lib/'pybel.py'
cd pydir do
`python -c 'import py_compile;py_compile.compile(\"openbabel.py\");py_compile.compile(\"pybel.py\")'`
end
python do
python.site_packages.install lib/'openbabel.py', lib/'pybel.py', lib/'_openbabel.so'
end
end
def caveats; <<-EOS.undent
Python modules are installed to #{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages
so the PYTHONPATH environment variable should include the paths
#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:#{HOMEBREW_PREFIX}/lib
Java libraries are installed to #{HOMEBREW_PREFIX}/lib so this path should be
included in the CLASSPATH environment variable.
def caveats
s = ''
s += python.standard_caveats if python
s += <<-EOS.undent
Java libraries are installed to #{HOMEBREW_PREFIX}/lib so this path should be
included in the CLASSPATH environment variable.
EOS
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end

View File

@ -10,17 +10,17 @@ class Opencolorio < Formula
depends_on 'cmake' => :build
depends_on 'pkg-config' => :build
depends_on 'little-cms2'
depends_on :python => :optional
option 'with-tests', 'Verify the build with its unit tests (~1min)'
option 'with-python', 'Build ocio with python2.7 bindings'
option 'with-java', 'Build ocio with java bindings'
option 'with-docs', 'Build the documentation'
def install
args = std_cmake_args
args << "-DOCIO_BUILD_JNIGLUE=ON" if build.include? 'with-java'
args << "-DOCIO_BUILD_TESTS=ON" if build.include? 'with-tests'
args << "-DOCIO_BUILD_DOCS=ON" if build.include? 'with-docs'
args << "-DOCIO_BUILD_JNIGLUE=ON" if build.with? 'java'
args << "-DOCIO_BUILD_TESTS=ON" if build.with? 'tests'
args << "-DOCIO_BUILD_DOCS=ON" if build.with? 'docs'
args << "-DCMAKE_VERBOSE_MAKEFILE=OFF"
# CMake-2.8.7 + CLT + llvm + Lion => CMAKE_CXX_HAS_ISYSROOT "1"
@ -36,31 +36,18 @@ class Opencolorio < Formula
# /usr/include
# So we just set the sysroot to /
args << "-DCMAKE_OSX_SYSROOT=/" if ENV.compiler == :llvm and MacOS.version >= :lion
# args << "-DCMAKE_OSX_SYSROOT=/" if ENV.compiler == :llvm and MacOS.version >= :lion
# Python note:
# OCIO's PyOpenColorIO.so doubles as a shared library. So it lives in lib, rather
# than the usual HOMEBREW_PREFIX/lib/python2.7/site-packages per developer choice.
if build.include? 'with-python'
python_prefix = `python-config --prefix`.strip
if File.exist? "#{python_prefix}/Python"
# Python was compiled with --framework:
args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
else
python_version = `python-config --libs`.match('-lpython(\d+\.\d+)').captures.at(0)
python_lib = "#{python_prefix}/lib/libpython#{python_version}"
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/python#{python_version}'"
if File.exists? "#{python_lib}.a"
args << "-DPYTHON_LIBRARY='#{python_lib}.a'"
else
args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
end
end
else
if python do
# For Xcode-only systems, the headers of system's python are inside of Xcode:
args << "-DPYTHON_INCLUDE_DIR='#{python.incdir}'"
# Cmake picks up the system's python dylib, even if we have a brewed one:
args << "-DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'"
end; else
args << "-DOCIO_BUILD_PYGLUE=OFF"
end
@ -69,7 +56,7 @@ class Opencolorio < Formula
mkdir 'macbuild' do
system "cmake", *args
system "make"
system "make test" if build.include? 'with-tests'
system "make test" if build.with? 'tests'
system "make install"
end
end

View File

@ -6,12 +6,12 @@ class Orfeo < Formula
sha1 '2cdef44fc4119ef410f750001c18aabc6be3a48c'
depends_on 'cmake' => :build
depends_on :python => :optional
depends_on 'fltk'
depends_on 'gdal'
depends_on 'qt'
option 'examples', 'Compile and install various examples'
option 'python', 'Enable Python support'
option 'java', 'Enable Java support'
option 'patented', 'Enable patented algorithms'
@ -25,9 +25,17 @@ class Orfeo < Formula
]
args << '-DBUILD_EXAMPLES=' + ((build.include? 'examples') ? 'ON' : 'OFF')
args << '-DOTB_WRAP_PYTHON=' + ((build.include? 'python') ? 'ON' : 'OFF')
args << '-DOTB_WRAP_JAVA=' + ((build.include? 'java') ? 'ON' : 'OFF')
args << '-DOTB_USE_PATENTED=' + ((build.include? 'patented') ? 'ON' : 'OFF')
if python do
args << '-DOTB_WRAP_PYTHON=ON'
# For Xcode-only systems, the headers of system's python are inside of Xcode:
args << "-DPYTHON_INCLUDE_DIR='#{python.incdir}'"
# Cmake picks up the system's python dylib, even if we have a brewed one:
args << "-DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'"
end; else
args << '-DOTB_WRAP_PYTHON=OFF'
end
mkdir 'build' do
system 'cmake', '..', *args

View File

@ -5,16 +5,15 @@ class Oscats < Formula
url 'http://oscats.googlecode.com/files/oscats-0.6.tar.gz'
sha1 'f57fa06ee0d842ed4c547dd7ab599fd5090d7550'
option 'python', 'Build Python bindings'
depends_on 'pkg-config' => :build
depends_on :python => :optional
depends_on 'gsl'
depends_on 'glib'
depends_on 'pygobject' if build.include? 'python'
depends_on 'pygobject' if build.with? 'python'
def install
args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
args << "--enable-python-bindings" if build.include? 'python'
args << "--enable-python-bindings" if build.with? 'python'
system "./configure", *args
system "make install"
end

View File

@ -6,6 +6,7 @@ class Pil < Formula
sha1 '76c37504251171fda8da8e63ecb8bc42a69a5c81'
depends_on :freetype
depends_on :python
depends_on 'jpeg' => :recommended
depends_on 'little-cms' => :optional
@ -18,7 +19,7 @@ class Pil < Formula
def install
# Find the arch for the Python we are building against.
# We remove 'ppc' support, so we can pass Intel-optimized CFLAGS.
archs = archs_for_command("python")
archs = archs_for_command(python.binary)
archs.remove_ppc!
# Can't build universal on 32-bit hardware. See:
# https://github.com/mxcl/homebrew/issues/5844
@ -44,36 +45,11 @@ class Pil < Formula
"add_directory(include_dirs, \"#{HOMEBREW_PREFIX}/include\")"
end
# In order to install into the Cellar, the dir must exist and be in the
# PYTHONPATH.
temp_site_packages = lib/which_python/'site-packages'
mkdir_p temp_site_packages
ENV['PYTHONPATH'] = temp_site_packages
args = [
"--no-user-cfg",
"--verbose",
"install",
"--force",
"--install-scripts=#{share}/python",
"--install-lib=#{temp_site_packages}",
"--install-data=#{share}",
"--install-headers=#{include}",
"--record=installed-files.txt"
]
system "python", "-s", "setup.py", *args
python do
system python, "setup.py", "install" ,"--prefix=#{prefix}"
end
end
def caveats; <<-EOS.undent
This formula installs PIL against whatever Python is first in your path.
This Python needs to have either setuptools or distribute installed or
the build will fail.
EOS
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end
__END__

View File

@ -6,10 +6,10 @@ class Portmidi < Formula
sha1 'f45bf4e247c0d7617deacd6a65d23d9fddae6117'
option 'with-java', 'Build java based app and bindings. You need the Java SDK for this.'
option 'with-python', 'Build the pyportmidi python module.'
depends_on 'cmake' => :build
depends_on 'Cython' => :python if build.include? 'with-python'
depends_on :python => :optional
depends_on 'Cython' => :python if build.with? 'python'
def patches
# Avoid that the Makefile.osx builds the java app and fails because: fatal error: 'jni.h' file not found
@ -30,23 +30,7 @@ class Portmidi < Formula
system 'make -f pm_mac/Makefile.osx'
system 'make -f pm_mac/Makefile.osx install'
if build.include? 'with-python'
# In order to install into the Cellar, the dir must exist and be in the
# PYTHONPATH.
temp_site_packages = lib/which_python/'site-packages'
mkdir_p temp_site_packages
ENV['PYTHONPATH'] = temp_site_packages
args = [
"--no-user-cfg",
"--verbose",
"install",
"--force",
"--install-scripts=#{bin}",
"--install-lib=#{temp_site_packages}",
"--install-data=#{share}",
"--install-headers=#{include}",
]
python do
cd 'pm_python' do
# There is no longer a CHANGES.txt or TODO.txt.
inreplace 'setup.py', "CHANGES = open('CHANGES.txt').read()", 'CHANGES = ""'
@ -54,14 +38,17 @@ class Portmidi < Formula
# Provide correct dirs (that point into the Cellar)
ENV.append 'CFLAGS', "-I#{include}"
ENV.append 'LDFLAGS', "-L#{lib}"
system "python", "-s", "setup.py", *args
system python, "setup.py", "install", "--prefix=#{prefix}"
end
end
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
def test
if build.with?('python') || Tab.for_formula('portmidi').with?('python')
system "python", "-c", "import pyportmidi; pyportmidi.init()"
end
end
end
__END__

View File

@ -6,6 +6,7 @@ class PostgresXc < Formula
sha1 '76774cf32810dfa14b2174f2e939d3b28eb211a9'
depends_on :arch => :x86_64
depends_on :python => :recommended
depends_on 'readline'
depends_on 'libxml2' if MacOS.version == :leopard # Leopard libxml is too old
depends_on 'ossp-uuid' => :recommended
@ -13,7 +14,6 @@ class PostgresXc < Formula
conflicts_with 'postgresql',
:because => 'postgres-xc and postgresql install the same binaries.'
option 'no-python', 'Build without Python support'
option 'no-perl', 'Build without Perl support'
option 'enable-dtrace', 'Build with DTrace support'
@ -44,7 +44,7 @@ class PostgresXc < Formula
"--with-libxslt"]
args << "--with-ossp-uuid" unless build.without? 'ossp-uuid'
args << "--with-python" unless build.include? 'no-python'
args << "--with-python" if build.with? 'python'
args << "--with-perl" unless build.include? 'no-perl'
args << "--enable-dtrace" if build.include? 'enable-dtrace'
args << "ARCHFLAGS='-arch x86_64'"
@ -55,7 +55,7 @@ class PostgresXc < Formula
ENV.append 'LIBS', `uuid-config --libs`.strip
end
check_python_arch unless build.include? 'no-python'
check_python_arch if build.with? 'python'
system "./configure", *args
system "make install-world"
@ -73,27 +73,25 @@ class PostgresXc < Formula
end
def check_python_arch
# On 64-bit systems, we need to look for a 32-bit Framework Python.
# The configure script prefers this Python version, and if it doesn't
# have 64-bit support then linking will fail.
framework_python = Pathname.new "/Library/Frameworks/Python.framework/Versions/Current/Python"
return unless framework_python.exist?
unless (archs_for_command framework_python).include? :x86_64
opoo "Detected a framework Python that does not have 64-bit support in:"
puts <<-EOS.undent
#{framework_python}
# On 64-bit systems, we need to avoid a 32-bit Framework Python.
if python.framework?
unless archs_for_command(python.binary).include? :x86_64
opoo "Detected a framework Python that does not have 64-bit support in:"
puts <<-EOS.undent
#{python.prefix}
The configure script seems to prefer this version of Python over any others,
so you may experience linker problems as described in:
http://osdir.com/ml/pgsql-general/2009-09/msg00160.html
The configure script seems to prefer this version of Python over any others,
so you may experience linker problems as described in:
http://osdir.com/ml/pgsql-general/2009-09/msg00160.html
To fix this issue, you may need to either delete the version of Python
shown above, or move it out of the way before brewing PostgreSQL.
To fix this issue, you may need to either delete the version of Python
shown above, or move it out of the way before brewing PostgreSQL.
Note that a framework Python in /Library/Frameworks/Python.framework is
the "MacPython" version, and not the system-provided version which is in:
/System/Library/Frameworks/Python.framework
EOS
Note that a framework Python in /Library/Frameworks/Python.framework is
the "MacPython" version, and not the system-provided version which is in:
/System/Library/Frameworks/Python.framework
EOS
end
end
end

View File

@ -8,12 +8,12 @@ class Postgresql < Formula
depends_on 'readline'
depends_on 'libxml2' if MacOS.version == :leopard # Leopard libxml is too old
depends_on 'ossp-uuid' => :recommended
depends_on :python => :recommended
conflicts_with 'postgres-xc',
:because => 'postgresql and postgres-xc install the same binaries.'
option '32-bit'
option 'no-python', 'Build without Python support'
option 'no-perl', 'Build without Perl support'
option 'enable-dtrace', 'Build with DTrace support'
@ -46,7 +46,7 @@ class Postgresql < Formula
]
args << "--with-ossp-uuid" if build.with? 'ossp-uuid'
args << "--with-python" unless build.include? 'no-python'
args << "--with-python" if build.with? 'python'
args << "--with-perl" unless build.include? 'no-perl'
args << "--enable-dtrace" if build.include? 'enable-dtrace'
@ -56,7 +56,7 @@ class Postgresql < Formula
ENV.append 'LIBS', `uuid-config --libs`.strip
end
if not build.build_32_bit? and MacOS.prefer_64_bit? and not build.include? 'no-python'
if not build.build_32_bit? and MacOS.prefer_64_bit? and build.with? 'python'
args << "ARCHFLAGS='-arch x86_64'"
check_python_arch
end
@ -71,27 +71,25 @@ class Postgresql < Formula
end
def check_python_arch
# On 64-bit systems, we need to look for a 32-bit Framework Python.
# The configure script prefers this Python version, and if it doesn't
# have 64-bit support then linking will fail.
framework_python = Pathname.new "/Library/Frameworks/Python.framework/Versions/Current/Python"
return unless framework_python.exist?
unless (archs_for_command framework_python).include? :x86_64
opoo "Detected a framework Python that does not have 64-bit support in:"
puts <<-EOS.undent
#{framework_python}
# On 64-bit systems, we need to avoid a 32-bit Framework Python.
if python.framework?
unless archs_for_command(python.binary).include? :x86_64
opoo "Detected a framework Python that does not have 64-bit support in:"
puts <<-EOS.undent
#{python.prefix}
The configure script seems to prefer this version of Python over any others,
so you may experience linker problems as described in:
http://osdir.com/ml/pgsql-general/2009-09/msg00160.html
The configure script seems to prefer this version of Python over any others,
so you may experience linker problems as described in:
http://osdir.com/ml/pgsql-general/2009-09/msg00160.html
To fix this issue, you may need to either delete the version of Python
shown above, or move it out of the way before brewing PostgreSQL.
To fix this issue, you may need to either delete the version of Python
shown above, or move it out of the way before brewing PostgreSQL.
Note that a framework Python in /Library/Frameworks/Python.framework is
the "MacPython" version, and not the system-provided version which is in:
/System/Library/Frameworks/Python.framework
EOS
Note that a framework Python in /Library/Frameworks/Python.framework is
the "MacPython" version, and not the system-provided version which is in:
/System/Library/Frameworks/Python.framework
EOS
end
end
end
@ -103,11 +101,6 @@ class Postgresql < Formula
you may need to remove the previous version first. See:
https://github.com/mxcl/homebrew/issues/issue/2510
To build plpython against a specific Python, set PYTHON prior to brewing:
PYTHON=/usr/local/bin/python brew install postgresql
See:
http://www.postgresql.org/docs/9.2/static/install-procedure.html
# Create/Upgrade a Database
If this is your first install, create a database with:
@ -118,7 +111,7 @@ class Postgresql < Formula
# Loading Extensions
By default, Homebrew builds all available Contrib extensions. To see a list of all
By default, Homebrew builds all available Contrib extensions. To see a list of all
available extensions, from the psql command line, run:
SELECT * FROM pg_available_extensions;

View File

@ -8,6 +8,7 @@ class Py2cairo < Formula
depends_on 'pkg-config' => :build
depends_on 'cairo'
depends_on :x11
depends_on :python
option :universal
@ -26,23 +27,20 @@ class Py2cairo < Formula
end
end
# waf miscompiles py2cairo on >= lion with HB python, linking the wrong
# Python Library. So add a LINKFLAG that sets the path.
# https://github.com/mxcl/homebrew/issues/12893
# https://github.com/mxcl/homebrew/issues/14781
# https://bugs.freedesktop.org/show_bug.cgi?id=51544
ENV['LINKFLAGS'] = "-L#{%x(python-config --prefix).chomp}/lib"
system "./waf", "configure", "--prefix=#{prefix}", "--nopyc", "--nopyo"
system "./waf", "install"
python do
# waf miscompiles py2cairo on >= lion with HB python, linking the wrong
# Python Library. So add a LINKFLAG that sets the path.
# https://github.com/mxcl/homebrew/issues/12893
# https://github.com/mxcl/homebrew/issues/14781
# https://bugs.freedesktop.org/show_bug.cgi?id=51544
ENV['LINKFLAGS'] = "-L#{python.libdir}"
system "./waf", "configure", "--prefix=#{prefix}", "--nopyc", "--nopyo"
system "./waf", "install"
end
end
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
def caveats
python.standard_caveats if python
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end

View File

@ -5,6 +5,7 @@ class Pyexiv2 < Formula
url 'http://launchpad.net/pyexiv2/0.3.x/0.3.2/+download/pyexiv2-0.3.2.tar.bz2'
sha1 'ad20ea6925571d58637830569076aba327ff56d9'
depends_on :python
depends_on 'scons' => :build
depends_on 'exiv2'
depends_on 'boost'
@ -13,23 +14,19 @@ class Pyexiv2 < Formula
def patches; DATA; end
def install
# this build script ignores CPPFLAGS, but it honors CXXFLAGS
ENV.append "CXXFLAGS", ENV.cppflags
system "scons BOOSTLIB=boost_python-mt"
python do
# this build script ignores CPPFLAGS, but it honors CXXFLAGS
ENV.append "CXXFLAGS", ENV.cppflags
system "scons BOOSTLIB=boost_python-mt"
# let's install manually
mv 'build/libexiv2python.dylib', 'build/libexiv2python.so'
(lib + which_python + 'site-packages').install 'build/libexiv2python.so', 'src/pyexiv2'
# let's install manually
mv 'build/libexiv2python.dylib', 'build/libexiv2python.so'
python.site_packages.install 'build/libexiv2python.so', 'src/pyexiv2'
end
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
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
def caveats
python.standard_caveats if python
end
end

View File

@ -7,6 +7,7 @@ class Pygobject < Formula
depends_on 'pkg-config' => :build
depends_on 'glib'
depends_on :python
option :universal
@ -17,9 +18,11 @@ class Pygobject < Formula
def install
ENV.universal_binary if build.universal?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-introspection"
system "make install"
python do
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-introspection"
system "make install"
end
end
end

View File

@ -6,6 +6,7 @@ class Pygtk < Formula
sha1 '344e6a32a5e8c7e0aaeb807e0636a163095231c2'
depends_on 'pkg-config' => :build
depends_on :python
depends_on :x11
depends_on 'glib'
depends_on 'gtk+'
@ -18,11 +19,13 @@ class Pygtk < Formula
option 'glade', 'Python bindigs for glade. (to `import gtk.glade`)'
def install
ENV.append 'CFLAGS', '-ObjC'
ENV.universal_binary if build.universal?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
python do
ENV.append 'CFLAGS', '-ObjC'
ENV.universal_binary if build.universal?
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
end
# Fixing the pkgconfig file to find codegen, because it was moved from
# pygtk to pygobject. But our pkgfiles point into the cellar and in the
@ -30,55 +33,51 @@ class Pygtk < Formula
inreplace lib/'pkgconfig/pygtk-2.0.pc', 'codegendir=${datadir}/pygobject/2.0/codegen', "codegendir=#{HOMEBREW_PREFIX}/share/pygobject/2.0/codegen"
end
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
def caveats
python.standard_caveats if python
end
test do
(testpath/'test.py').write <<-EOS.undent
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
python do
(testpath/'test.py').write <<-EOS.undent
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
class HelloWorld(object):
def hello(self, widget, data=None):
print "Hello World"
class HelloWorld(object):
def hello(self, widget, data=None):
print "Hello World"
def delete_event(self, widget, event, data=None):
print "delete event occurred"
return False
def delete_event(self, widget, event, data=None):
print "delete event occurred"
return False
def destroy(self, widget, data=None):
print "destroy signal occurred"
gtk.main_quit()
def destroy(self, widget, data=None):
print "destroy signal occurred"
gtk.main_quit()
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_border_width(10)
self.button = gtk.Button("Hello World")
self.button.connect("clicked", self.hello, None)
self.button.connect_object("clicked", gtk.Widget.destroy, self.window)
self.window.add(self.button)
self.button.show()
self.window.show()
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.connect("destroy", self.destroy)
self.window.set_border_width(10)
self.button = gtk.Button("Hello World")
self.button.connect("clicked", self.hello, None)
self.button.connect_object("clicked", gtk.Widget.destroy, self.window)
self.window.add(self.button)
self.button.show()
self.window.show()
def main(self):
gtk.main()
def main(self):
gtk.main()
if __name__ == "__main__":
hello = HelloWorld()
hello.main()
EOS
chmod 0755, 'test.py'
system "./test.py"
if __name__ == "__main__":
hello = HelloWorld()
hello.main()
EOS
chmod 0755, 'test.py'
system "./test.py"
end
end
end

View File

@ -6,17 +6,22 @@ class Pygtkglext < Formula
sha1 '2ae3e87e8cdfc3318d8ff0e33b344377cb3df7cb'
depends_on 'pkg-config' => :build
depends_on :python
depends_on 'pygtk'
depends_on 'gtkglext'
depends_on 'pygobject'
def install
ENV['PYGTK_CODEGEN'] = which 'pygobject-codegen-2.0'
ENV['PYGTK_CODEGEN'] = Formula.factory('pygobject').opt_prefix/'bin/pygobject-codegen-2.0'
system "./configure", "--disable-debug", "--disable-dependency-tracking",
"--prefix=#{prefix}"
system "make install"
end
def caveats
python.standard_caveats if python
end
test do
system "python", "-c", "import pygtk", "pygtk.require('2.0')", "import gtk.gtkgl"
end

View File

@ -6,6 +6,7 @@ class Pygtksourceview < Formula
sha256 'bfdde2ce4f61d461fb34dece9433cf81a73a9c9de6b62d4eb06177b8c9cec9c7'
depends_on 'pkg-config' => :build
depends_on :python
depends_on 'gtksourceview'
depends_on 'pygtk'
@ -16,14 +17,8 @@ class Pygtksourceview < Formula
system "make install"
end
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
def caveats
python.standard_caveats if python
end
test do

View File

@ -1,67 +1,69 @@
require 'formula'
# Note: this project doesn't save old releases, so it breaks often as
# downloads disappear.
class Pyqt < Formula
homepage 'http://www.riverbankcomputing.co.uk/software/pyqt'
url 'http://downloads.sf.net/project/pyqt/PyQt4/PyQt-4.10.1/PyQt-mac-gpl-4.10.1.tar.gz'
sha1 'cf20699c4db8d3031c19dd51df8857bba1a4956b'
depends_on 'sip'
depends_on 'qt'
depends_on :python => :recommended
depends_on :python3 => :optional
depends_on 'sip' => ['with-python3'] if build.with? 'python3'
depends_on 'qt' # From their site: PyQt currently supports Qt v4 and will build against Qt v5
def install
ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages", ':'
python do
system python, "./configure.py", "--confirm-license",
"--bindir=#{bin}#{python.if3then3}",
"--destdir=#{lib}/#{python.xy}/site-packages",
"--sipdir=#{share}/sip#{python.if3then3}"
system "make"
system "make install"
system "make clean" # because this python block may be run twice
end
system "python", "./configure.py", "--confirm-license",
"--bindir=#{bin}",
"--destdir=#{lib}/#{which_python}/site-packages",
"--sipdir=#{share}/sip"
system "make"
system "make install"
if python3
# These tools need a unique suffix for python3.
['pyuic4', 'pyrcc4', 'pylupdate4'].each { |f| mv(prefix/"bin3/#{f}", bin/"#{f}-py3")}
rm_rf prefix/'bin3'
end
end
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
def caveats
python.standard_caveats if python
end
test do
ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages", ':'
python do
# Todo: For brew-test-bot we need to add a timer that quits after 1 s or so.
# Reference: http://zetcode.com/tutorials/pyqt4/firstprograms/
(testpath/'test.py').write <<-EOS.undent
#!/usr/bin/env python
# Reference: http://zetcode.com/tutorials/pyqt4/firstprograms/
(testpath/'test.py').write <<-EOS.undent
import sys
from PyQt4 import QtGui, QtCore
import sys
from PyQt4 import QtGui, QtCore
class QuitButton(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
class QuitButton(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Quit button')
self.setGeometry(300, 300, 250, 150)
self.setWindowTitle('Quit button')
quit = QtGui.QPushButton('Close', self)
quit.setGeometry(10, 10, 60, 35)
quit = QtGui.QPushButton('Close', self)
quit.setGeometry(10, 10, 60, 35)
self.connect(quit, QtCore.SIGNAL('clicked()'),
QtGui.qApp, QtCore.SLOT('quit()'))
self.connect(quit, QtCore.SIGNAL('clicked()'),
QtGui.qApp, QtCore.SLOT('quit()'))
app = QtGui.QApplication(sys.argv)
qb = QuitButton()
qb.show()
app.exec_()
sys.exit(0)
EOS
app = QtGui.QApplication(sys.argv)
qb = QuitButton()
qb.show()
app.exec_()
sys.exit(0)
EOS
system "python", "test.py"
system python, "test.py"
rm testpath/'test.py'
end
end
end

View File

@ -5,6 +5,7 @@ class Pyqwt < Formula
url 'http://sourceforge.net/projects/pyqwt/files/pyqwt5/PyQwt-5.2.0/PyQwt-5.2.0.tar.gz'
sha1 '797f37c63dec660272f6a8ccfd16a017df0ad640'
depends_on :python => :recommended
depends_on 'qt'
depends_on 'qwt'
depends_on 'sip'
@ -13,33 +14,32 @@ class Pyqwt < Formula
def patches
# Patch to build system to allow for specific
# installation directories.
{:p0 => DATA}
{ :p0 => DATA }
end
def install
cd "configure" do
system "python",
"configure.py",
"--module-install-path=#{lib}/#{which_python}/site-packages/PyQt4/Qwt5",
"--sip-install-path=#{share}/sip/Qwt5",
"--uic-install-path=#{lib}/#{which_python}/site-packages/PyQt4",
"-Q", "../qwt-5.2"
system "make install"
python do
system python,
"configure.py",
"--module-install-path=#{lib}/#{python.xy}/site-packages/PyQt4/Qwt5",
"--sip-install-path=#{share}/sip#{python.if3then3}/Qwt5",
"--uic-install-path=#{lib}/#{python.xy}/site-packages/PyQt4",
"-Q", "../qwt-5.2"
system "make install"
system 'make clean'
end
end
end
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
def caveats
python.standard_caveats if python
end
def test
system "python", "-c", "from PyQt4 import Qwt5 as Qwt"
python do
system python, "-c", "from PyQt4 import Qwt5 as Qwt"
end
end
end

View File

@ -6,15 +6,28 @@ class PysideTools < Formula
sha1 'f654553bc9bfb35dbc5673da26830969393f9fe8'
depends_on 'cmake' => :build
depends_on :python => :recommended
depends_on :python3 => :optional
depends_on 'pyside'
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
def install
python do
args = std_cmake_args
args << "-DSITE_PACKAGE=#{lib}/#{python.xy}/site-packages"
# The next two lines are because pyside needs this to switch Python
# versions in HOMEBREW_PREFIX/lib/cmake/PySide-X.Y.Z/PySideConfig.cmake
args << "-DPYTHON_BASENAME=-python2.7" if python2
args << "-DPYTHON_BASENAME=.cpython-33m" if python3
# And these two lines are because the ShibokenConfig.cmake needs this to
# switch python versions. The price for supporting both versions:
args << "-DPYTHON_SUFFIX='-python2.7'" if python2
args << "-DPYTHON_SUFFIX='.cpython-33m'" if python3
system "cmake", ".", *args
system "make install"
end
end
def install
system "cmake", ".", "-DSITE_PACKAGE=lib/#{which_python}/site-packages", *std_cmake_args
system "make install"
def caveats
python.standard_caveats if python
end
end

View File

@ -7,42 +7,39 @@ class Pyside < Formula
sha1 'c0119775f2500e48efebdd50b7be7543e71b2c24'
depends_on 'cmake' => :build
depends_on 'shiboken'
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
depends_on :python => :recommended
depends_on :python3 => :optional
depends_on 'shiboken' => '--with-python3' if build.with? 'python3'
depends_on 'qt'
def install
# The build will be unable to find Qt headers buried inside frameworks
# unless the folder containing those frameworks is added to the compiler
# search path.
qt = Formula.factory 'qt'
ENV.append_to_cflags "-F#{qt.frameworks}"
# Also need `ALTERNATIVE_QT_INCLUDE_DIR` to prevent "missing file" errors.
# Add out of tree build because one of its deps, shiboken, itself needs an
# out of tree build in shiboken.rb.
args = std_cmake_args + %W[
-DALTERNATIVE_QT_INCLUDE_DIR=#{qt.frameworks}
-DSITE_PACKAGE=lib/#{which_python}/site-packages
-DBUILD_TESTS=NO
..
]
mkdir 'macbuild' do
system 'cmake', *args
system 'make'
system 'make install'
python do
# Add out of tree build because one of its deps, shiboken, itself needs an
# out of tree build in shiboken.rb.
mkdir "macbuild#{python.if3then3}" do
args = std_cmake_args + %W[
-DSITE_PACKAGE=#{lib}/#{python.xy}/site-packages
-DALTERNATIVE_QT_INCLUDE_DIR=#{Formula.factory('qt').frameworks}
-DBUILD_TESTS=NO
..
]
# The next two lines are because shiboken needs them
args << "-DPYTHON_SUFFIX='-python2.7'" if python2
args << "-DPYTHON_SUFFIX='.cpython-33m'" if python3
system 'cmake', *args
system 'make'
system 'make install'
# Todo: How to deal with pyside.pc file? It doesn't support 2.x and 3.x!
end
end
end
def caveats
<<-EOS
PySide Python modules have been linked to:
#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages
def test
system 'python', '-c', "from PySide import QtCore" if Tab.for_formula('Pyside').with? 'python'
system 'python3', '-c', "from PySide import QtCore" if Tab.for_formula('Pyside').with? 'python3'
end
Make sure this folder is on your PYTHONPATH. For PySide development tools,
install the `pyside-tools` formula.
EOS
def caveats
python.standard_caveats if python
end
end

View File

@ -49,17 +49,11 @@ class Python < Formula
HOMEBREW_PREFIX/"lib/python2.7/site-packages"
end
# Where distribute/pip will install executable scripts.
def scripts_folder
HOMEBREW_PREFIX/"share/python"
end
def install
opoo 'The given option --with-poll enables a somewhat broken poll() on OS X (http://bugs.python.org/issue5154).' if build.include? 'with-poll'
# Unset these so that installing pip and distribute puts them where we want
# and not into some other Python the user has installed.
ENV['PYTHONPATH'] = nil
ENV['PYTHONHOME'] = nil
args = %W[
@ -85,7 +79,19 @@ class Python < Formula
end
# Allow sqlite3 module to load extensions: http://docs.python.org/library/sqlite3.html#f1
inreplace "setup.py", 'sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))', ''
inreplace("setup.py", 'sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))', '') if build.with? 'sqlite'
# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! 'DEFAULT_LIBRARY_FALLBACK = [', "DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib',"
f.gsub! 'DEFAULT_FRAMEWORK_FALLBACK = [', "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end
# Fix http://bugs.python.org/issue18071
inreplace "./Lib/_osx_support.py", "compiler_so = list(compiler_so)",
"if isinstance(compiler_so, (str,unicode)): compiler_so = compiler_so.split()"
system "./configure", *args
@ -103,89 +109,59 @@ class Python < Formula
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{share}/python"
system "make", "quicktest" if build.include? 'quicktest'
# Post-install, fix up the site-packages and install-scripts folders
# so that user-installed Python software survives minor updates, such
# as going from 2.7.0 to 2.7.1:
# Post-install, fix up the site-packages so that user-installed Python
# software survives minor updates, such as going from 2.7.0 to 2.7.1:
# Remove the site-packages that Python created in its Cellar.
site_packages_cellar.rmtree
# Create a site-packages in HOMEBREW_PREFIX/lib/python/site-packages
# Create a site-packages in HOMEBREW_PREFIX/lib/python2.7/site-packages
site_packages.mkpath
# Symlink the prefix site-packages into the cellar.
ln_s site_packages, site_packages_cellar
# Teach python not to use things from /System
# and tell it about the correct site-package dir because we moved it
sitecustomize = site_packages_cellar/"sitecustomize.py"
rm sitecustomize if File.exist? sitecustomize
sitecustomize.write <<-EOF.undent
# This file is created by `brew install python` and is executed on each
# python startup. Don't print from here, or else universe will collapse.
import sys
import site
# Write our sitecustomize.py to tell python about the correct site-package
# dir because we moved it.
# We reuse the PythonInstalled requirement here for the sitecustomize.py
PythonInstalled.new("2.7").modify_build_environment
# We ship distribute and pip.
# Our modify_build_environment need the opt/python already now, so we
# create it temporarily
(HOMEBREW_PREFIX/'opt/python/bin/python2').mkpath
ln_s bin/'python2', HOMEBREW_PREFIX/'opt/python/bin/python2'
setup_args = [ "-s", "setup.py", "--no-user-cfg", "install", "--force", "--verbose",
"--install-scripts=#{bin}", "--install-lib=#{site_packages}" ]
Distribute.new.brew { system "#{bin}/python2.7", *setup_args }
Pip.new.brew { system "#{bin}/python2.7", *setup_args }
(HOMEBREW_PREFIX/'opt/python').rmtree
# Only do fix 1 and 2, if the currently run python is a brewed one.
if sys.executable.startswith('#{HOMEBREW_PREFIX}'):
# Fix 1)
# A setuptools.pth and/or easy-install.pth sitting either in
# /Library/Python/2.7/site-packages or in
# ~/Library/Python/2.7/site-packages can inject the
# /System's Python site-packages. People then report
# "OSError: [Errno 13] Permission denied" because pip/easy_install
# attempts to install into
# /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
# See: https://github.com/mxcl/homebrew/issues/14712
sys.path = [ p for p in sys.path if not p.startswith('/System') ]
# Fix 2)
# Remove brewed Python's hard-coded site-packages
if '#{site_packages_cellar}' in sys.path:
sys.path.remove('#{site_packages_cellar}')
# Fix 3)
# For all Pythons: Tell about homebrew's site-packages location.
# This is needed for Python to parse *.pth files.
site.addsitedir('#{site_packages}')
EOF
# Install distribute and pip
# It's important to have these installers in our bin, because some users
# forget to put #{script_folder} in PATH, then easy_install'ing
# into /Library/Python/X.Y/site-packages with /usr/bin/easy_install.
mkdir_p scripts_folder unless scripts_folder.exist?
setup_args = ["-s", "setup.py", "--no-user-cfg", "install", "--force", "--verbose", "--install-lib=#{site_packages_cellar}", "--install-scripts=#{bin}"]
Distribute.new.brew { system "#{bin}/python", *setup_args }
Pip.new.brew { system "#{bin}/python", *setup_args }
# Tell distutils-based installers where to put scripts and python modules
(prefix/"Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/distutils.cfg").write <<-EOF.undent
# And now we write the distuitsl.cfg
cfg = prefix/"Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/distutils.cfg"
cfg.delete if cfg.exist?
cfg.write <<-EOF.undent
[global]
verbose=1
[install]
install-scripts=#{scripts_folder}
install-lib=#{site_packages}
force=1
prefix=#{HOMEBREW_PREFIX}
EOF
# Work-around this bug: http://bugs.python.org/issue18050
inreplace "#{prefix}/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", 'import sys', <<-EOS.undent
import sys
try:
from _sre import MAXREPEAT
except ImportError:
import _sre
_sre.MAXREPEAT = 65535 # this monkey-patches all other places of "from _sre import MAXREPEAT"'
EOS
makefile = prefix/'Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile'
inreplace makefile do |s|
unless MacOS::CLT.installed?
s.gsub!(/^CC=.*$/, "CC=xcrun clang")
s.gsub!(/^CXX=.*$/, "CXX=xcrun clang++")
s.gsub!(/^AR=.*$/, "AR=xcrun ar")
s.gsub!(/^RANLIB=.*$/, "RANLIB=xcrun ranlib")
end
# Should be fixed regardless of CLT (for `python-config --ldflags`)
s.gsub!(/^PYTHONFRAMEWORKDIR=\tPython\.framework/, "PYTHONFRAMEWORKDIR= #{opt_prefix}/Frameworks/Python.framework")
end
# Work-around this bug: http://bugs.python.org/issue18050
inreplace "#{prefix}/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", 'import sys', <<-EOS.undent
import sys
try:
from _sre import MAXREPEAT
except ImportError:
import _sre
_sre.MAXREPEAT = 65535 # this monkey-patches all other places of "from _sre import MAXREPEAT"'
EOS
# Write our sitecustomize.py to tell python about the correct site-package
# dir because we moved it. (Note, we had to install distribute and pip
# without the help of sitecustomize.py because HOMEBREW_PREFIX/opt/python
# is not yet linked)
# We reuse the PythonInstalled requirement here for the sitecustomize.py
ENV.prepend_path 'PATH', bin
PythonInstalled.new("2.7").modify_build_environment
end
def distutils_fix_superenv(args)
@ -246,9 +222,6 @@ class Python < Formula
def caveats
<<-EOS.undent
Homebrew's Python framework
#{prefix}/Frameworks/Python.framework
Python demo
#{HOMEBREW_PREFIX}/share/python/Extras
@ -265,10 +238,6 @@ class Python < Formula
They will install into the site-package directory
#{site_packages}
Executable python scripts will be put in:
#{scripts_folder}
so you may want to put "#{scripts_folder}" in your PATH, too.
See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
EOS
end

View File

@ -15,22 +15,27 @@ class Pip < Formula
sha1 '9c70d314e5dea6f41415af814056b0f63c3ffd14'
end
class Python3 < Formula
homepage 'http://www.python.org/'
url 'http://python.org/ftp/python/3.3.2/Python-3.3.2.tar.bz2'
sha1 'b28c36a9752b690059dc6df4fb9b4ec9d6c5708a'
VER='3.3' # The <major>.<minor> is used so often.
option :universal
option 'quicktest', 'Run `make quicktest` after the build'
option 'with-brewed-openssl', "Use Homebrew's openSSL instead of the one from OS X"
option 'with-brewed-tk', "Use Homebrew's Tk (has optional Cocoa and threads support)"
depends_on 'pkg-config' => :build
depends_on 'readline' => :recommended
depends_on 'sqlite' => :recommended
depends_on 'gdbm' => :recommended
depends_on 'openssl' if build.include? 'with-brewed-openssl'
depends_on 'homebrew/dupes/tcl-tk' if build.include? 'with-brewed-tk'
option :universal
option 'quicktest', 'Run `make quicktest` after the build'
option 'with-brewed-openssl', "Use Homebrew's openSSL instead of the one from OS X"
def patches
DATA if build.include? 'with-brewed-tk'
end
def site_packages_cellar
prefix/"Frameworks/Python.framework/Versions/#{VER}/lib/python#{VER}/site-packages"
@ -41,15 +46,6 @@ class Python3 < Formula
HOMEBREW_PREFIX/"lib/python#{VER}/site-packages"
end
# Where distribute/pip will install executable scripts.
def scripts_folder
HOMEBREW_PREFIX/"share/python3"
end
def effective_lib
prefix/"Frameworks/Python.framework/Versions/#{VER}/lib"
end
fails_with :llvm do
build '2336'
cause <<-EOS.undent
@ -66,7 +62,6 @@ class Python3 < Formula
def install
# Unset these so that installing pip and distribute puts them where we want
# and not into some other Python the user has installed.
ENV['PYTHONPATH'] = nil
ENV['PYTHONHOME'] = nil
args = %W[
@ -78,21 +73,27 @@ class Python3 < Formula
args << '--without-gcc' if ENV.compiler == :clang
if superenv?
distutils_fix_superenv(args)
else
distutils_fix_stdenv
end
if build.universal?
ENV.universal_binary
args << "--enable-universalsdk" << "--with-universal-archs=intel"
end
distutils_fix_superenv(args)
distutils_fix_stdenv
# Python does not need all of X11, these bundled Headers are enough
unless MacOS::CLT.installed?
ENV.append 'CPPFLAGS', "-I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers"
end
# Allow sqlite3 module to load extensions: http://docs.python.org/library/sqlite3.html#f1
inreplace "setup.py", 'sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))', 'pass'
inreplace("setup.py", 'sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))', 'pass') if build.with? 'sqlite'
# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! 'DEFAULT_LIBRARY_FALLBACK = [', "DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib',"
f.gsub! 'DEFAULT_FRAMEWORK_FALLBACK = [', "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end
system "./configure", *args
@ -122,32 +123,36 @@ class Python3 < Formula
# Symlink the prefix site-packages into the cellar.
ln_s site_packages, site_packages_cellar
# Teach python not to use things from /System
# and tell it about the correct site-package dir because we moved it
sitecustomize = site_packages_cellar/"sitecustomize.py"
rm sitecustomize if File.exist? sitecustomize
sitecustomize.write(sitecustomize_content)
# "python3" and executable is forgotten for framework builds.
# Make sure homebrew symlinks it to HOMEBREW_PREFIX/bin.
ln_s "#{bin}/python#{VER}", "#{bin}/python3" unless (bin/"python3").exist?
# Install distribute for python3 and assure there's no name clash
# Install distribute and pip for python3 and assure there's no name clash
# with what the python (2.x) formula installs.
scripts_folder.mkpath
setup_args = ["-s", "setup.py", "install", "--force", "--verbose", "--install-lib=#{site_packages_cellar}", "--install-scripts=#{bin}"]
ENV['PYTHONPATH'] = site_packages
setup_args = ["-s", "setup.py", "install", "--force", "--verbose",
"--install-scripts=#{bin}", "--install-lib=#{site_packages}" ]
Distribute.new.brew { system "#{bin}/python#{VER}", *setup_args }
mv bin/'easy_install', bin/'easy_install3'
Pip.new.brew { system "#{bin}/python#{VER}", *setup_args }
mv bin/'pip', bin/'pip3'
# Tell distutils-based installers where to put scripts
(prefix/"Frameworks/Python.framework/Versions/#{VER}/lib/python#{VER}/distutils/distutils.cfg").write <<-EOF.undent
# And now we write the distuitsl.cfg
cfg = prefix/"Frameworks/Python.framework/Versions/#{VER}/lib/python#{VER}/distutils/distutils.cfg"
cfg.delete if cfg.exist?
cfg.write <<-EOF.undent
[global]
verbose=1
[install]
install-scripts=#{scripts_folder}
install-lib=#{site_packages}
prefix=#{HOMEBREW_PREFIX}
EOF
# Write our sitecustomize.py and distutils.cfg to tell python about the
# correct site-package dir because we moved it.
# We reuse the PythonInstalled requirement here.
ENV.prepend_path 'PATH', bin
PythonInstalled.new(VER).modify_build_environment
unless MacOS::CLT.installed?
makefile = prefix/"Frameworks/Python.framework/Versions/#{VER}/lib/python#{VER}/config-#{VER}m/Makefile"
inreplace makefile do |s|
@ -158,102 +163,64 @@ class Python3 < Formula
end
end
# A temporary fix, until a homebrew
# [issue on handling Frameworks](https://github.com/mxcl/homebrew/issues/15943)
# is resolved. `brew install python python3` failed to link because both
# provide `Python.framework`. Homebrew will need to be smarter about this,
# since Frameworks are built to support multiple versions.
# A fix, because python and python3 both want to install Python.framework
# https://github.com/mxcl/homebrew/issues/15943
["Headers", "Python", "Resources"].each{ |f| rm(prefix/"Frameworks/Python.framework/#{f}") }
end
def distutils_fix_superenv(args)
if superenv?
# To allow certain Python bindings to find brewed software:
cflags = "CFLAGS=-I#{HOMEBREW_PREFIX}/include -I#{Formula.factory('sqlite').opt_prefix}/include"
ldflags = "LDFLAGS=-L#{HOMEBREW_PREFIX}/lib -L#{Formula.factory('sqlite').opt_prefix}/lib"
unless MacOS::CLT.installed?
# Help Python's build system (distribute/pip) to build things on Xcode-only systems
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
cflags += " -isysroot #{MacOS.sdk_path}"
ldflags += " -isysroot #{MacOS.sdk_path}"
# Same zlib.h-not-found-bug as in env :std (see below)
args << "CPPFLAGS=-I#{MacOS.sdk_path}/usr/include"
# To allow certain Python bindings to find brewed software:
cflags = "CFLAGS=-I#{HOMEBREW_PREFIX}/include -I#{Formula.factory('sqlite').opt_prefix}/include"
ldflags = "LDFLAGS=-L#{HOMEBREW_PREFIX}/lib -L#{Formula.factory('sqlite').opt_prefix}/lib"
unless MacOS::CLT.installed?
# Help Python's build system (distribute/pip) to build things on Xcode-only systems
# The setup.py looks at "-isysroot" to get the sysroot (and not at --sysroot)
cflags += " -isysroot #{MacOS.sdk_path}"
ldflags += " -isysroot #{MacOS.sdk_path}"
# Same zlib.h-not-found-bug as in env :std (see below)
args << "CPPFLAGS=-I#{MacOS.sdk_path}/usr/include"
unless build.include? 'with-brewed-tk'
cflags += " -I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers"
end
args << cflags
args << ldflags
# Avoid linking to libgcc http://code.activestate.com/lists/python-dev/112195/
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
# We want our readline! This is just to outsmart the detection code,
# superenv makes cc always find includes/libs!
inreplace "setup.py",
"do_readline = self.compiler.find_library_file(lib_dirs, 'readline')",
"do_readline = '#{HOMEBREW_PREFIX}/opt/readline/lib/libhistory.dylib'"
end
args << cflags
args << ldflags
# Avoid linking to libgcc http://code.activestate.com/lists/python-dev/112195/
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
# We want our readline! This is just to outsmart the detection code,
# superenv makes cc always find includes/libs!
inreplace "setup.py",
"do_readline = self.compiler.find_library_file(lib_dirs, 'readline')",
"do_readline = '#{HOMEBREW_PREFIX}/opt/readline/lib/libhistory.dylib'"
end
def distutils_fix_stdenv()
if not superenv?
# Python scans all "-I" dirs but not "-isysroot", so we add
# the needed includes with "-I" here to avoid this err:
# building dbm using ndbm
# error: /usr/include/zlib.h: No such file or directory
ENV.append 'CPPFLAGS', "-I#{MacOS.sdk_path}/usr/include" unless MacOS::CLT.installed?
# Python scans all "-I" dirs but not "-isysroot", so we add
# the needed includes with "-I" here to avoid this err:
# building dbm using ndbm
# error: /usr/include/zlib.h: No such file or directory
ENV.append 'CPPFLAGS', "-I#{MacOS.sdk_path}/usr/include" unless MacOS::CLT.installed?
# Don't use optimizations other than "-Os" here, because Python's distutils
# remembers (hint: `python3-config --cflags`) and reuses them for C
# extensions which can break software (such as scipy 0.11 fails when
# "-msse4" is present.)
ENV.minimal_optimization
# Don't use optimizations other than "-Os" here, because Python's distutils
# remembers (hint: `python3-config --cflags`) and reuses them for C
# extensions which can break software (such as scipy 0.11 fails when
# "-msse4" is present.)
ENV.minimal_optimization
# We need to enable warnings because the configure.in uses -Werror to detect
# "whether gcc supports ParseTuple" (https://github.com/mxcl/homebrew/issues/12194)
ENV.enable_warnings
if ENV.compiler == :clang
# http://docs.python.org/devguide/setup.html#id8 suggests to disable some Warnings.
ENV.append_to_cflags '-Wno-unused-value'
ENV.append_to_cflags '-Wno-empty-body'
ENV.append_to_cflags '-Qunused-arguments'
end
# We need to enable warnings because the configure.in uses -Werror to detect
# "whether gcc supports ParseTuple" (https://github.com/mxcl/homebrew/issues/12194)
ENV.enable_warnings
if ENV.compiler == :clang
# http://docs.python.org/devguide/setup.html#id8 suggests to disable some Warnings.
ENV.append_to_cflags '-Wno-unused-value'
ENV.append_to_cflags '-Wno-empty-body'
ENV.append_to_cflags '-Qunused-arguments'
end
end
def sitecustomize_content
<<-EOF.undent
# This file is created by `brew install python3` and is executed on each
# python#{VER} startup. Don't print from here, or else universe will collapse.
import sys
import site
# Only do fix 1 and 2, if the currently run python is a brewed one.
if sys.executable.startswith('#{HOMEBREW_PREFIX}'):
# Fix 1)
# A setuptools.pth and/or easy-install.pth sitting either in
# /Library/Python/2.7/site-packages or in
# ~/Library/Python/2.7/site-packages can inject the
# /System's Python site-packages. People then report
# "OSError: [Errno 13] Permission denied" because pip/easy_install
# attempts to install into
# /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
# See: https://github.com/mxcl/homebrew/issues/14712
sys.path = [ p for p in sys.path if not p.startswith('/System') ]
# Fix 2)
# Remove brewed Python's hard-coded site-packages
sys.path.remove('#{site_packages_cellar}')
# Fix 3)
# For all Pythons: Tell about homebrew's site-packages location.
# This is needed for Python to parse *.pth files.
site.addsitedir('#{site_packages}')
EOF
end
def caveats
text = <<-EOS.undent
Homebrew's Python3 framework
#{prefix}/Frameworks/Python.framework
Distribute and Pip have been installed. To update them
pip3 install --upgrade distribute
pip3 install --upgrade pip
@ -266,9 +233,6 @@ class Python3 < Formula
They will install into the site-package directory
#{site_packages}
Executable python scripts will be put in:
#{scripts_folder}
so you may want to put "#{scripts_folder}" in your PATH, too.
See: https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python
EOS
@ -289,6 +253,25 @@ class Python3 < Formula
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
system "#{bin}/python#{VER}", "-c", "import sqlite3"
# Check if some other modules import. Then the linked libs are working.
system "#{bin}/python#{VER}", "-c", "import tkinter"
system "#{bin}/python#{VER}", "-c", "import tkinter; root = tkinter.Tk()"
end
end
__END__
diff --git a/setup.py b/setup.py
index 9ddf2e9..60ab152 100644
--- a/setup.py
+++ b/setup.py
@@ -1624,9 +1624,9 @@ class PyBuildExt(build_ext):
# Rather than complicate the code below, detecting and building
# AquaTk is a separate method. Only one Tkinter will be built on
# Darwin - either AquaTk, if it is found, or X11 based Tk.
- if (host_platform == 'darwin' and
- self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
- return
+ # if (host_platform == 'darwin' and
+ # self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
+ # return
# Assume we haven't found any of the libraries or include files
# The versions with dots are used on Unix, and the versions without

View File

@ -7,9 +7,9 @@ class Qscintilla2 < Formula
depends_on 'pyqt'
depends_on 'sip'
depends_on :python
def install
ENV.prepend 'PYTHONPATH', "#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages", ':'
cd 'Qt4Qt5' do
inreplace 'qscintilla.pro' do |s|
@ -24,25 +24,22 @@ class Qscintilla2 < Formula
system "make", "install"
end
cd 'Python' do
(share/'sip').mkpath
system 'python', 'configure.py', "-o", lib, "-n", include,
"--apidir=#{prefix}/qsci",
"--destdir=#{lib}/#{which_python}/site-packages/PyQt4",
"--qsci-sipdir=#{share}/sip",
"--pyqt-sipdir=#{HOMEBREW_PREFIX}/share/sip"
system 'make'
system 'make', 'install'
python do
cd 'Python' do
(share/"sip#{python.if3then3}").mkpath
system python, 'configure.py', "-o", lib, "-n", include,
"--apidir=#{prefix}/qsci",
"--destdir=#{python.site_packages}/PyQt4",
"--qsci-sipdir=#{share}/sip#{python.if3then3}",
"--pyqt-sipdir=#{HOMEBREW_PREFIX}/share/sip#{python.if3then3}"
system 'make'
system 'make', 'install'
end
end
end
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
def caveats
python.standard_caveats if python
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end

View File

@ -17,4 +17,10 @@ class Qwt < Formula
system "make"
system "make install"
end
def caveats; <<-EOS.undent
The qwtmathml library contains code of the MML Widget from the Qt solutions package.
Beside the Qwt license you also have to take care of its license.
EOS
end
end

View File

@ -6,20 +6,23 @@ class RdiffBackup < Formula
sha1 '14ffe4f5b46a8a96ded536c1d03ae5e85faae318'
depends_on 'librsync'
depends_on :python
def install
# Find the arch for the Python we are building against.
# We remove 'ppc' support, so we can pass Intel-optimized CFLAGS.
archs = archs_for_command("python")
archs.remove_ppc!
archs.delete :x86_64 if Hardware.is_32_bit?
ENV['ARCHFLAGS'] = archs.as_arch_flags
system "python", "setup.py", "--librsync-dir=#{prefix}", "build"
python do
archs = archs_for_command(python.binary)
archs.remove_ppc!
archs.delete :x86_64 if Hardware.is_32_bit?
ENV['ARCHFLAGS'] = archs.as_arch_flags
system python, "setup.py", "--librsync-dir=#{python.site_packages}", "build"
python.site_packages.install Dir['build/lib.macosx*/rdiff_backup']
python.site_packages.install Dir['build/scripts-*/*']
man1.install Dir['*.1']
bin.install_symlink Dir["#{python.site_packages}/rdiff-backup*"]
end
libexec.install Dir['build/lib.macosx*/rdiff_backup']
libexec.install Dir['build/scripts-*/*']
man1.install Dir['*.1']
bin.install_symlink Dir["#{libexec}/rdiff-backup*"]
end
end

View File

@ -5,6 +5,8 @@ class Rubber < Formula
url 'http://launchpad.net/rubber/trunk/1.1/+download/rubber-20100306.tar.gz'
sha1 'cd382a19cc9fc65d114456ec9d6b042dc0e65b53'
depends_on :python
def patches
# Creates missing .in files and adds them to the configure phase
# otherwise rubber modules are not found after install

View File

@ -5,23 +5,18 @@ class Scons < Formula
url 'http://downloads.sourceforge.net/scons/scons-2.3.0.tar.gz'
sha1 '728edf20047a9f8a537107dbff8d8f803fd2d5e3'
depends_on :python
def install
man1.install gzip('scons-time.1', 'scons.1', 'sconsign.1')
system "/usr/bin/python", "setup.py", "install",
python do
system python, "setup.py", "install",
"--prefix=#{prefix}",
"--standalone-lib",
# SCons gets handsy with sys.path---`scons-local` is one place it
# will look when all is said and done.
"--install-lib=#{libexec}/scons-local",
"--install-scripts=#{bin}",
"--install-data=#{libexec}",
"--no-version-script", "--no-install-man"
# Re-root scripts to libexec so they can import SCons and symlink back into
# bin. Similar tactics are used in the duplicity formula.
bin.children.each do |p|
mv p, "#{libexec}/#{p.basename}.py"
bin.install_symlink "#{libexec}/#{p.basename}.py" => p.basename
end
end
end

View File

@ -7,48 +7,47 @@ class Shiboken < Formula
sha1 '2ffe9d47a3f536840ed9d7eff766a53040bb2a2e'
depends_on 'cmake' => :build
depends_on :python => :recommended
depends_on :python3 => :optional
depends_on 'qt'
def install
# Building the tests also runs them. Not building and running tests cuts
# install time in half. As of 1.1.1 the install fails unless you do an
# install time in half. As of 1.1.1 the install fails unless you do an
# out of tree build and put the source dir last in the args.
mkdir 'macbuild' do
args = std_cmake_args + %W[
-DBUILD_TESTS=OFF
]
python_prefix = `python-config --prefix`.strip
# Python is actually a library. The libpythonX.Y.dylib points to this lib, too.
if File.exist? "#{python_prefix}/Python"
# Python was compiled with --framework:
args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'"
if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library'
# For Xcode-only systems, the headers of system's python are inside of Xcode
args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'"
else
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'"
end
else
python_version = `python-config --libs`.match('-lpython(\d+\.\d+)').captures.at(0)
python_lib = "#{python_prefix}/lib/libpython#{python_version}"
if File.exists? "#{python_lib}.a"
args << "-DPYTHON_LIBRARY='#{python_lib}.a'"
else
args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'"
end
args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/#{which_python}'"
python do
# This block will be run for each python (2.x and 3.x if requested)!
mkdir "macbuild#{python.if3then3}" do
args = std_cmake_args
args << "-DBUILD_TESTS=OFF"
# For Xcode-only systems, the headers of system's python are inside of Xcode:
args << "-DPYTHON#{python.if3then3}_INCLUDE_DIR='#{python.incdir}'"
# Cmake picks up the system's python dylib, even if we have a brewed one:
args << "-DPYTHON#{python.if3then3}_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'"
args << "-DUSE_PYTHON3=ON" if python3
args << '..'
system 'cmake', *args
system "make install"
# To support 2.x and 3.x in parallel, we have to rename shiboken.pc at first
mv lib/'pkgconfig/shiboken.pc', lib/"pkgconfig/shiboken-py#{python.version.major}.pc"
end
end
# Rename shiboken-py2.pc back to the default shiboken.pc
mv lib/'pkgconfig/shiboken-py2.pc', lib/'pkgconfig/shiboken.pc' if python2
end
args << '..'
system 'cmake', *args
system "make install"
def caveats
if python3
<<-EOS.undent
If you build software that uses the pkgconfig file, and you want
shiboken with Python 3.x support: Please, instead of 'shiboken.pc', use:
#{HOMEBREW_PREFIX}/lib/pkgconfig/shiboken-py3.pc
EOS
end
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
def test
system 'python', "-c", "import shiboken" if Tab.for_formula('Shiboken').with? 'python'
system 'python3', "-c", "import shiboken" if Tab.for_formula('Shiboken').with? 'python3'
end
end

View File

@ -32,6 +32,7 @@ class Shocco < Formula
sha1 'e29d58fb8109040b4fb4a816f330bb1c67064f6d'
depends_on MarkdownProvider
depends_on :python
def patches
DATA

View File

@ -1,12 +1,5 @@
require 'formula'
# NOTE TO MAINTAINERS:
#
# Unless Riverbank policy changes in the future or the Mercurial archive
# becomes unavailable, *do not use* the SIP download URL from the Riverbank
# website. This URL will break as soon as a new version of SIP is released
# which causes panic and terror to flood the Homebrew issue tracker.
class Sip < Formula
homepage 'http://www.riverbankcomputing.co.uk/software/sip'
url 'http://download.sf.net/project/pyqt/sip/sip-4.14.6/sip-4.14.6.tar.gz'
@ -14,85 +7,46 @@ class Sip < Formula
head 'http://www.riverbankcomputing.co.uk/hg/sip', :using => :hg
def patches; DATA; end if build.head?
depends_on :python => :recommended
depends_on :python3 => :optional
def install
if build.head?
# Set fallback version to the same value it would have without the patch
# and link the Mercurial repository into the download directory so
# Link the Mercurial repository into the download directory so
# buid.py can use it to figure out a version number.
sip_version = "0.1.0"
ln_s downloader.cached_location + '.hg', '.hg'
inreplace 'build.py', /@SIP_VERSION@/, sip_version.to_s.gsub('.', ',')
system "python", "build.py", "prepare"
system python, "build.py", "prepare"
else
sip_version = version
end
system "python", "configure.py",
"--destdir=#{lib}/#{which_python}/site-packages",
"--bindir=#{bin}",
"--incdir=#{include}",
"--sipdir=#{HOMEBREW_PREFIX}/share/sip",
"CFLAGS=#{ENV.cflags}",
"LFLAGS=#{ENV.ldflags}"
system "make install"
# The python block is run once for each python (2.x and 3.x if requested)
python do
# To have sip (for 2.x) and sip3 for python3, we rename the sip binary:
inreplace "configure.py", 'os.path.join(opts.sipbindir, "sip")', "os.path.join(opts.sipbindir, 'sip3')" if python3
# Set --destdir such that the python modules will be in the HOMEBREWPREFIX/lib/pythonX.Y/site-packages
system python, "configure.py",
"--destdir=#{lib}/#{python.xy}/site-packages",
"--bindir=#{bin}",
"--incdir=#{include}",
"--sipdir=#{HOMEBREW_PREFIX}/share/sip#{python.if3then3}"
system "make"
if python3
bin.mkdir unless bin.exist?
bin.install 'sipgen/sip' => 'sip3'
end
system "make install"
system "make clean"
end
end
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
def caveats
s = ''
s += python.standard_caveats if python
s += "The sip-dir for Python #{python.version.major}.x is #{HOMEBREW_PREFIX}/share/sip#{python.if3then3}."
s
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end
__END__
Patch to allow the SIP build.py script to generate a reasonable version number
for installing from a Mercurial snapshot without the .hg directory from the
Mercurial repository. The install code hooks on to the @SIP_VERSION@ tag and
inserts a real version tuple
diff --git a/build.py b/build.py
index 927d7f1..fdf13a3 100755
--- a/build.py
+++ b/build.py
@@ -185,7 +185,7 @@ def _get_release():
changelog = None
name = os.path.basename(_RootDir)
- release_suffix = "-unknown"
+ release_suffix = ""
version = None
parts = name.split('-')
@@ -198,7 +198,7 @@ def _get_release():
# Format the results.
if version is None:
- version = (0, 1, 0)
+ version = (@SIP_VERSION@)
major, minor, micro = version
Patch to remove the seemingly unnecessary framework build requirement
diff --git a/siputils.py b/siputils.py
index 57e8911..1af6152 100644
--- a/siputils.py
+++ b/siputils.py
@@ -1485,8 +1485,8 @@ class ModuleMakefile(Makefile):
# 'real_prefix' exists if virtualenv is being used.
dl = getattr(sys, 'real_prefix', sys.exec_prefix).split(os.sep)
- if "Python.framework" not in dl:
- error("SIP requires Python to be built as a framework")
+ # if "Python.framework" not in dl:
+ # error("SIP requires Python to be built as a framework")
self.LFLAGS.append("-undefined dynamic_lookup")

View File

@ -8,7 +8,6 @@ class Subversion < Formula
option :universal
option 'java', 'Build Java bindings'
option 'perl', 'Build Perl bindings'
option 'python', 'Build Python bindings'
option 'ruby', 'Build Ruby bindings'
option 'unicode-path', 'Include support for OS X UTF-8-MAC filename'
@ -18,12 +17,13 @@ class Subversion < Formula
depends_on 'neon'
depends_on 'sqlite'
depends_on 'serf'
depends_on :python => :optional
# Building Ruby bindings requires libtool
depends_on :libtool if build.include? 'ruby'
# If building bindings, allow non-system interpreters
env :userpaths if (build.include? 'perl') or (build.include? 'python') or (build.include? 'ruby')
env :userpaths if (build.include? 'perl') or (build.include? 'ruby')
def patches
ps = []
@ -43,13 +43,13 @@ class Subversion < Formula
end
end
# When building Perl, Python or Ruby bindings, need to use a compiler that
# When building Perl or Ruby bindings, need to use a compiler that
# recognizes GCC-style switches, since that's what the system languages
# were compiled against.
fails_with :clang do
build 318
cause "core.c:1: error: bad value (native) for -march= switch"
end if (build.include? 'perl') or (build.include? 'python') or (build.include? 'ruby')
end if (build.include? 'perl') or (build.include? 'ruby')
def apr_bin
superbin or "/usr/bin"
@ -108,7 +108,7 @@ class Subversion < Formula
system "make install"
bash_completion.install 'tools/client-side/bash_completion' => 'subversion'
if build.include? 'python'
python do
system "make swig-py"
system "make install-swig-py"
end
@ -151,13 +151,7 @@ class Subversion < Formula
def caveats
s = ""
if build.include? 'python'
s += <<-EOS.undent
You may need to add the Python bindings to your PYTHONPATH from:
#{HOMEBREW_PREFIX}/lib/svn-python
EOS
end
s += python.standard_caveats if python
if build.include? 'perl'
s += <<-EOS.undent

View File

@ -5,27 +5,45 @@ class Swatchbooker < Formula
url 'http://launchpad.net/swatchbooker/trunk/0.7.3/+download/SwatchBooker-0.7.3.tar.gz'
sha1 'fd2e46c278e762dc0c3ed69f824ab620773f153e'
depends_on :python
depends_on 'little-cms' => 'with-python'
depends_on 'pil'
depends_on 'pyqt'
def patches
DATA
end
def install
# Tell launching shell scipts where the python library is
inreplace %w[data/swatchbooker data/sbconvert data/sbconvertor] do |s|
s.gsub! "/usr/lib", "#{HOMEBREW_PREFIX}/lib"
end
system "python", "setup.py", "build"
system "python", "setup.py", "install", "--prefix=#{prefix}"
python do
system python, "setup.py", "install", "--prefix=#{prefix}"
end
end
def caveats; <<-EOS.undent
For the graphical user interface to work, PyQT requires that you amend your PYTHONPATH:
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/python:$PYTHONPATH
EOS
def caveats
python.standard_caveats if python
end
def test
system "#{bin}/swatchbooker"
end
end
__END__
diff --git a/src/swatchbook/color.py b/src/swatchbook/color.py
index 48ae503..f3511a2 100644
--- a/src/swatchbook/color.py
+++ b/src/swatchbook/color.py
@@ -28,7 +28,7 @@ def dirpath(name):
if not name:
return name
elif os.path.islink(name):
- return os.path.dirname(os.path.abspath(os.path._resolve_link(name)))
+ return os.path.dirname(os.path.abspath(os.path.realpath(name)))
else:
return os.path.dirname(name)

View File

@ -8,6 +8,8 @@ class Swig < Formula
option :universal
depends_on 'pcre'
depends_on :python # assure swig find the "right" python
depends_on :python3 => :optional
def install
ENV.universal_binary if build.universal?

View File

@ -14,6 +14,7 @@ class Thrift < Formula
option "with-php", "Install Php binding"
depends_on 'boost'
depends_on :python => :optional
# Includes are fixed in the upstream. Please remove this patch in the next version > 0.9.0
def patches
@ -23,17 +24,17 @@ class Thrift < Formula
def install
system "./bootstrap.sh" if build.head?
exclusions = ["--without-python", "--without-ruby"]
exclusions = ["--without-ruby"]
exclusions << "--without-python" unless build.with? "python"
exclusions << "--without-haskell" unless build.include? "with-haskell"
exclusions << "--without-java" unless build.include? "with-java"
exclusions << "--without-perl" unless build.include? "with-perl"
exclusions << "--without-php" unless build.include? "with-php"
exclusions << "--without-erlang" unless build.include? "with-erlang"
# Language bindings try to install outside of Homebrew's prefix, so
# omit them here. For ruby you can install the gem, and for Python
# you can use pip or easy_install.
ENV["PY_PREFIX"] = prefix # So python bindins don't install to /usr!
system "./configure", "--disable-debug",
"--prefix=#{prefix}",
"--libdir=#{lib}",
@ -43,10 +44,8 @@ class Thrift < Formula
system "make install"
end
def caveats; <<-EOS.undent
To install Python bindings:
pip install thrift
def caveats
s = <<-EOS.undent
To install Ruby bindings:
gem install thrift
@ -54,7 +53,9 @@ class Thrift < Formula
export PHP_PREFIX=/path/to/homebrew/thrift/0.9.0/php
export PHP_CONFIG_PREFIX=/path/to/homebrew/thrift/0.9.0/php_extensions
brew install thrift --with-php
EOS
s += python.standard_caveats if python
end
end
__END__

View File

@ -5,10 +5,12 @@ class Treeline < Formula
url 'http://sourceforge.net/projects/treeline/files/1.4.1/treeline-1.4.1.tar.gz'
sha1 'ac5ef60fbb02e2295868134b8e3068c2f905c170'
depends_on :python
depends_on 'pyqt'
def install
ENV.prepend "PYTHONPATH", "#{HOMEBREW_PREFIX}/lib/python"
system "./install.py", "-p#{prefix}"
python do
system "./install.py", "-p#{prefix}"
end
end
end

View File

@ -5,14 +5,17 @@ class Uwsgi < Formula
url 'https://projects.unbit.it/downloads/uwsgi-1.9.11.tar.gz'
sha1 '2b3d4f225808decb50399b9cdb387e022dd3729d'
depends_on :python
depends_on 'pcre'
depends_on 'libyaml'
def install
arch = MacOS.prefer_64_bit? ? 'x86_64' : 'i386'
%w{CFLAGS LDFLAGS}.each { |e| ENV.append e, "-arch #{arch}" }
python do
arch = MacOS.prefer_64_bit? ? 'x86_64' : 'i386'
%w{CFLAGS LDFLAGS}.each { |e| ENV.append e, "-arch #{arch}" }
system "python", "uwsgiconfig.py", "--build"
bin.install "uwsgi"
system python, "uwsgiconfig.py", "--build"
bin.install "uwsgi"
end
end
end

View File

@ -7,7 +7,10 @@ class Vim < Formula
sha1 'f308d219dd9c6b56e84109ace4e7487a101088f5'
head 'https://vim.googlecode.com/hg/'
env :std # To find interpreters
# We only have special support for finding depends_on :python, but not yet for
# :ruby, :perl etc., so we use the standard environment that leaves the
# PATH as the user has set it right now.
env :std
depends_on :hg => :build if build.head?
@ -20,6 +23,9 @@ class Vim < Formula
option "without-#{language}", "Build vim without #{language} support"
end
depends_on :python unless build.without? 'python'
depends_on :python3 if build.with? 'python3'
option "disable-nls", "Build vim without National Language Support (translated messages, keymaps)"
def install

View File

@ -8,16 +8,13 @@ class Weechat < Formula
depends_on 'cmake' => :build
depends_on 'gnutls'
depends_on 'libgcrypt'
depends_on 'guile' if build.include? 'guile'
depends_on 'aspell' if build.include? 'aspell'
depends_on 'lua' if build.include? 'lua'
depends_on 'guile' => :optional
depends_on 'aspell' => :optional
depends_on 'lua' => :optional
depends_on :python => :optional
option 'lua', 'Build the lua module'
option 'perl', 'Build the perl module'
option 'ruby', 'Build the ruby module'
option 'guile', 'Build the guile module'
option 'python', 'Build the python module (requires framework Python)'
option 'aspell', 'Build the aspell module that checks your spelling'
# cmake finds brewed python when installed, but when searching for the
# libraries it searches for system libraries first. This patch disables
@ -38,26 +35,15 @@ class Weechat < Formula
%Q{\n STRING(REGEX REPLACE "#{archs}" "" PERL_CFLAGS "${PERL_CFLAGS}")} +
%Q{\n STRING(REGEX REPLACE "#{archs}" "" PERL_LFLAGS "${PERL_LFLAGS}")}
# FindPython.cmake queries the Python variable LINKFORSHARED which contains
# a path that only exists during Python install when using HB framework
# Python. So remove that and use what's common in every install of Python,
# namely -u _PyMac_Error. Without the invalid path, it links okay.
# Because Macports and Apple change LINKFORSHARED but HB does not, this
# will have to persist, and it's not reported upstream. Fixes the error
# no such file or directory: 'Python.framework/Versions/2.7/Python'
inreplace 'src/plugins/python/CMakeLists.txt',
'${PYTHON_LFLAGS}', '-u _PyMac_Error'
args = std_cmake_args + %W[
-DPREFIX=#{prefix}
-DENABLE_GTK=OFF
]
args << '-DENABLE_LUA=OFF' unless build.include? 'lua'
args << '-DENABLE_PERL=OFF' unless build.include? 'perl'
args << '-DENABLE_RUBY=OFF' unless build.include? 'ruby'
args << '-DENABLE_PYTHON=OFF' unless build.include? 'python'
args << '-DENABLE_ASPELL=OFF' unless build.include? 'aspell'
args << '-DENABLE_GUILE=OFF' unless build.include? 'guile'
args << '-DENABLE_LUA=OFF' unless build.with? 'lua'
args << '-DENABLE_PERL=OFF' unless build.with? 'perl'
args << '-DENABLE_RUBY=OFF' unless build.with? 'ruby'
args << '-DENABLE_ASPELL=OFF' unless build.with? 'aspell'
args << '-DENABLE_GUILE=OFF' unless build.with? 'guile'
# NLS/gettext support disabled for now since it doesn't work in stdenv
# see https://github.com/mxcl/homebrew/issues/18722
@ -65,7 +51,14 @@ class Weechat < Formula
args << '..'
mkdir 'build' do
system 'cmake', *args
if python do
system 'cmake', *args
end
else
# The same cmake call but without any python set up.
args << '-DENABLE_PYTHON=OFF'
system 'cmake', *args
end
system 'make install'
end
end

View File

@ -7,7 +7,6 @@ class Wireshark < Formula
option 'with-x', 'Include X11 support'
option 'with-qt', 'Use QT for GUI instead of GTK+'
option 'with-python', 'Enable experimental Python bindings'
depends_on 'pkg-config' => :build
depends_on 'gnutls2' => :optional
@ -15,6 +14,7 @@ class Wireshark < Formula
depends_on 'c-ares' => :optional
depends_on 'pcre' => :optional
depends_on 'qt' => :optional
depends_on :python => :optional
depends_on 'glib'
if build.with? 'x'

View File

@ -2,7 +2,6 @@ require 'formula'
class FrameworkPython < Requirement
fatal true
env :userpaths
satisfy do
q = `python -c "import distutils.sysconfig as c; print(c.get_config_var('PYTHONFRAMEWORK'))"`
@ -19,9 +18,8 @@ class Wxmac < Formula
url 'http://sourceforge.net/projects/wxpython/files/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.bz2'
sha1 'c292cd45b51e29c558c4d9cacf93c4616ed738b9'
option 'no-python', 'Do not build Python bindings'
depends_on FrameworkPython unless build.include? "no-python"
depends_on :python => :recommended
depends_on FrameworkPython if build.with? "python"
def install_wx_python
args = [
@ -40,15 +38,17 @@ class Wxmac < Formula
cd "wxPython" do
ENV.append_to_cflags '-arch x86_64' if MacOS.prefer_64_bit?
system "python", "setup.py",
python do
system python, "setup.py",
"build_ext",
"WXPORT=osx_cocoa",
*args
system "python", "setup.py",
system python, "setup.py",
"install",
"--prefix=#{prefix}",
"WXPORT=osx_cocoa",
*args
end
end
end
@ -77,7 +77,7 @@ class Wxmac < Formula
system "./configure", *args
system "make install"
unless build.include? "no-python"
if build.with? "python"
ENV['WXWIN'] = Dir.getwd
# We have already downloaded wxPython in a bundle with wxWidgets
install_wx_python
@ -87,7 +87,7 @@ class Wxmac < Formula
def caveats
s = ''
fp = FrameworkPython.new
unless build.include? 'no-python' or fp.satisfied?
unless build.without? 'python' or fp.satisfied?
s += fp.message
end

View File

@ -13,13 +13,14 @@ class Xapian < Formula
option "java", "Java bindings"
option "php", "PHP bindings"
option "python", "Python bindings"
option "ruby", "Ruby bindings"
depends_on :python => :optional
skip_clean :la
def build_any_bindings?
build.include? 'ruby' or build.include? 'python' or build.include? 'java' or build.include? 'php'
build.include? 'ruby' or build.with? 'python' or build.include? 'java' or build.include? 'php'
end
def install
@ -51,12 +52,8 @@ class Xapian < Formula
args << '--without-ruby'
end
if build.include? 'python'
python_lib = lib/which_python/'site-packages'
python_lib.mkpath
ENV.append 'PYTHONPATH', python_lib
ENV['OVERRIDE_MACOSX_DEPLOYMENT_TARGET'] = '10.4'
ENV['PYTHON_LIB'] = python_lib
if build.with? 'python'
ENV['PYTHON_LIB'] = python.site_packages
args << "--with-python"
else
args << "--without-python"
@ -76,13 +73,7 @@ class Xapian < Formula
def caveats
s = ''
if build.include? 'python'
s += <<-EOS.undent
The Python bindings won't function until you amend your PYTHONPATH like so:
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
EOS
end
s += python.standard_caveats if python
if build.include? 'ruby'
s += <<-EOS.undent
You may need to add the Ruby bindings to your RUBYLIB from:
@ -93,7 +84,4 @@ class Xapian < Formula
return s.empty? ? nil : s
end
def which_python
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end

View File

@ -7,14 +7,13 @@ class Yasm < Formula
head 'https://github.com/yasm/yasm.git'
option 'enable-python', 'Enable Python bindings'
if build.head?
depends_on 'gettext'
depends_on :automake
end
depends_on 'Cython' => :python if build.include? 'enable-python'
depends_on :python => :optional
depends_on 'Cython' => :python if build.with? 'python'
def install
args = %W[
@ -22,31 +21,18 @@ class Yasm < Formula
--prefix=#{prefix}
]
if build.include? 'enable-python'
if build.with? 'python'
args << '--enable-python'
args << '--enable-python-bindings'
end
# Avoid "ld: library not found for -lcrt1.10.6.o" on Xcode without CLT
ENV['LIBS'] = ENV.ldflags
ENV['INCLUDES'] = ENV.cppflags
system './autogen.sh' if build.head?
system './configure', *args
system 'make install'
end
def caveats
if build.include? 'enable-python' then <<-EOS.undent
Python bindings installed to:
#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages
For non-homebrew Python, you need to amend your PYTHONPATH like so:
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
EOS
end
python.standard_caveats if python
end
def which_python
'python' + `python -c 'import sys;print(sys.version[:3])'`.strip
end
end

View File

@ -7,14 +7,15 @@ class Zookeeper < Formula
head 'http://svn.apache.org/repos/asf/zookeeper/trunk'
option "c", "Build C bindings."
option "perl", "Build Perl bindings."
if build.head?
depends_on :automake
depends_on :libtool
end
option "c", "Build C bindings."
option "perl", "Build Perl bindings."
option "python", "Build Python bindings."
depends_on :python => :optional
def shim_script target
<<-EOS.undent
@ -59,9 +60,8 @@ class Zookeeper < Formula
end
end
build_python = build.include? "python"
build_perl = build.include? "perl"
build_c = build_python || build_perl || build.include?("c")
build_c = build.with?('python') || build_perl || build.include?("c")
# Build & install C libraries.
cd "src/c" do
@ -72,10 +72,12 @@ class Zookeeper < Formula
end if build_c
# Install Python bindings
cd "src/contrib/zkpython" do
system "python", "src/python/setup.py", "build"
system "python", "src/python/setup.py", "install", "--prefix=#{prefix}"
end if build_python
python do
cd "src/contrib/zkpython" do
system python, "src/python/setup.py", "build"
system python, "src/python/setup.py", "install", "--prefix=#{prefix}"
end
end
# Install Perl bindings
cd "src/contrib/zkperl" do