From 909605ebc17412d89a34828bac82dad1cf1ae3eb Mon Sep 17 00:00:00 2001 From: samueljohn Date: Wed, 15 Aug 2012 11:51:20 +0200 Subject: [PATCH] python: ENV.minimal_optimization. Remove 2to3 fix - Extras now in HOMEBREW_PREFIX/share/python/Extras instead of HOMEBREW_PREFIX/share/python2.7/Extras - Assure no '-march=...' or '-msse4' or similar flags are there because `python-config --cflags` reports them later and can break certain c-extensions. (happend for SciPy). Closes Homebrew/homebrew#14199. Signed-off-by: Jack Nagel --- Formula/python.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Formula/python.rb b/Formula/python.rb index ef677ff306..a5f5db2f33 100644 --- a/Formula/python.rb +++ b/Formula/python.rb @@ -67,10 +67,17 @@ class Python < Formula --enable-ipv6 --datarootdir=#{share} --datadir=#{share} - --without-gcc --enable-framework=#{prefix}/Frameworks ] + args << '--without-gcc' if ENV.compiler == :clang + + # Don't use optimizations other than "-Os" here, because Python's distutils + # remembers (hint: `python-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 @@ -78,7 +85,6 @@ class Python < Formula # 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 if build.universal? @@ -99,8 +105,8 @@ class Python < Formula ENV.deparallelize # Installs must be serialized # Tell Python not to install into /Applications (default for framework builds) system "make", "install", "PYTHONAPPSDIR=#{prefix}" - # Demos and Tools into HOMEBREW_PREFIX/share/python2.7 - system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{share}/python2.7" + # Demos and Tools into HOMEBREW_PREFIX/share/python + system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{share}/python" system "make", "quicktest" if build.include? 'quicktest' # Post-install, fix up the site-packages and install-scripts folders @@ -114,10 +120,6 @@ class Python < Formula # Symlink the prefix site-packages into the cellar. ln_s site_packages, site_packages_cellar - # Python 3 has a 2to3, too. Additionally there still is a 2to3-2.7. - # (https://github.com/mxcl/homebrew/issues/12581) - rm bin/"2to3" if (HOMEBREW_PREFIX/"bin/2to3").exist? and (bin/"2to3").exist? - # Tell distutils-based installers where to put scripts scripts_folder.mkpath (effective_lib+"python2.7/distutils/distutils.cfg").write <<-EOF.undent @@ -136,7 +138,7 @@ class Python < Formula #{prefix}/Frameworks/Python.framework You can find the Python demo at - #{HOMEBREW_PREFIX}/share/python2.7/Extras + #{HOMEBREW_PREFIX}/share/python/Extras You can `brew linkapps` to symlink "Idle" and the "Python Launcher".