From 164db800912c68245c9ad419091a46a6653ba123 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Wed, 7 Jul 2010 13:15:59 -0700 Subject: Tweaks to Python 3.x Take features from Python (2.x) formula up to the Python 3.x formula. --- Library/Formula/python3.rb | 78 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 62 insertions(+), 16 deletions(-) (limited to 'Library/Formula/python3.rb') diff --git a/Library/Formula/python3.rb b/Library/Formula/python3.rb index 8de3c297f..7c75adec3 100644 --- a/Library/Formula/python3.rb +++ b/Library/Formula/python3.rb @@ -1,30 +1,56 @@ -# Lightly modified from the Python 2.6.5 formula. require 'formula' +<<-COMMENTS +Versions +-------- +This formula is currently tracking version 3.1.x. + +Python 2.x is available as a separate formula: + brew install python + +COMMENTS + +# Was a Framework build requested? +def build_framework?; ARGV.include? '--framework'; end + +# Are we installed or installing as a Framework? +def as_framework? + (self.installed? and File.exists? prefix+"Frameworks/Python.framework") or build_framework? +end + class Python3 :optional # Prefer over OS X's libedit. - depends_on 'sqlite' => :optional # Prefer over OS X's copy. - depends_on 'gdbm' => :optional - # With all dependencies installed should only have ossaudiodev and spwd not - # built from the stdlib. + depends_on 'readline' => :optional # Prefer over OS X's libedit + depends_on 'sqlite' => :optional # Prefer over OS X's older version + depends_on 'gdbm' => :optional def options [ ["--framework", "Do a 'Framework' build instead of a UNIX-style build."], - ["--universal", "Build for both 32 & 64 bit Intel."] + ["--universal", "Build for both 32 & 64 bit Intel."], + ["--static", "Build static libraries."] ] end - # XXX Overriding skip_clean? is deprecated - def skip_clean? path - # Need to keep the versioned binaries. - # Also, don't strip out pre-compiled # bytecode files. - path == bin+'python3' or path == bin+'python3.1' or - path == lib+'python3.1' + skip_clean ['bin', 'lib'] + + def site_packages + # The Cellar location of site-packages + if as_framework? + # If we're installed or installing as a Framework, then use that location. + return prefix+"Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages" + else + # Otherwise, use just the lib path. + return lib+"python3.1/site-packages" + end + end + + def prefix_site_packages + # The HOMEBREW_PREFIX location of site-packages + HOMEBREW_PREFIX+"lib/python3.1/site-packages" end def install @@ -32,13 +58,33 @@ class Python3