From 4b06b18b329511119fc4f3f9926f12658664746b Mon Sep 17 00:00:00 2001 From: Samuel John Date: Fri, 7 Jun 2013 14:25:29 +0200 Subject: python3: Added HEAD and distrubute 0.6.45 * Use `build.with?` instead of `build.include? 'with…'` * Reuse PythonInstalled.new.modify_build_environment * Use `test do` instead of `def test` --- Library/Formula/python3.rb | 50 ++++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) (limited to 'Library/Formula/python3.rb') diff --git a/Library/Formula/python3.rb b/Library/Formula/python3.rb index df7926625..10bca6ca0 100644 --- a/Library/Formula/python3.rb +++ b/Library/Formula/python3.rb @@ -6,8 +6,8 @@ require 'formula' # `brew install python`. class Distribute < Formula - url 'https://pypi.python.org/packages/source/d/distribute/distribute-0.6.40.tar.gz' - sha1 '46654be10177014bbb502a4c516627173de67d15' + url 'https://pypi.python.org/packages/source/d/distribute/distribute-0.6.45.tar.gz' + sha1 '55b15037f2222828496a96f38447c0fa0228df85' end class Pip < Formula @@ -21,6 +21,8 @@ class Python3 < Formula sha1 'b28c36a9752b690059dc6df4fb9b4ec9d6c5708a' VER='3.3' # The . is used so often. + head 'http://hg.python.org/cpython', :using => :hg, :branch => VER + 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" @@ -30,11 +32,11 @@ class Python3 < Formula 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' + depends_on 'openssl' if build.with? 'brewed-openssl' + depends_on 'homebrew/dupes/tcl-tk' if build.with? 'brewed-tk' def patches - DATA if build.include? 'with-brewed-tk' + DATA if build.with? 'brewed-tk' end def site_packages_cellar @@ -112,9 +114,8 @@ class Python3 < Formula mv app, app.gsub(".app", " 3.app") end - # Post-install, fix up the site-packages and install-scripts folders - # so that user-installed Python software survives minor updates, such - # as going from 3.3.0 to 3.3.1: + # Post-install, fix up the site-packages so that user-installed Python + # software survives minor updates, such as going from 3.3.2 to 3.3.3: # Remove the site-packages that Python created in its Cellar. site_packages_cellar.rmtree @@ -127,11 +128,13 @@ class Python3 < Formula # Make sure homebrew symlinks it to HOMEBREW_PREFIX/bin. ln_s "#{bin}/python#{VER}", "#{bin}/python3" unless (bin/"python3").exist? - # Install distribute and pip for python3 and assure there's no name clash - # with what the python (2.x) formula installs. - ENV['PYTHONPATH'] = site_packages - setup_args = ["-s", "setup.py", "install", "--force", "--verbose", - "--install-scripts=#{bin}", "--install-lib=#{site_packages}" ] + # We ship distribute and pip and reuse the PythonInstalled + # Requirement here to write the sitecustomize.py + py = PythonInstalled.new(VER) + py.binary = bin/"python#{VER}" + py.modify_build_environment + 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 } @@ -147,23 +150,8 @@ class Python3 < Formula 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| - 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 - end - # A fix, because python and python3 both want to install Python.framework + # and therefore we can't link both into HOMEBREW_PREFIX/Frameworks # https://github.com/mxcl/homebrew/issues/15943 ["Headers", "Python", "Resources"].each{ |f| rm(prefix/"Frameworks/Python.framework/#{f}") } @@ -180,7 +168,7 @@ class Python3 < Formula 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' + unless build.with? 'brewed-tk' cflags += " -I#{MacOS.sdk_path}/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers" end end @@ -248,7 +236,7 @@ class Python3 < Formula return text end - def test + test do # Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions # and it can occur that building sqlite silently fails if OSX's sqlite is used. system "#{bin}/python#{VER}", "-c", "import sqlite3" -- cgit v1.2.3