From 0b50110107ea2998e65011ec31ce45931b446dab Mon Sep 17 00:00:00 2001 From: Samuel John Date: Mon, 21 Jan 2013 10:33:56 +0100 Subject: 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. --- Library/Formula/postgres-xc.rb | 46 ++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'Library/Formula/postgres-xc.rb') diff --git a/Library/Formula/postgres-xc.rb b/Library/Formula/postgres-xc.rb index 5b303d41d..c5ea941c2 100644 --- a/Library/Formula/postgres-xc.rb +++ b/Library/Formula/postgres-xc.rb @@ -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} - - 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. - - 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 + # 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 + + 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 + end end end -- cgit v1.2.3