python3: ENV.minimal_optimization and cleanup

- Since 3.2.3, the "2to3" script has a version suffix already.
- Added `--without-gcc` to ensure python uses clang.
- Avoid optimization flags that are remembers by python
  (e.g. `python3.2-config --cflags`) and lead to problems
  with certain C-extensions.

Closes Homebrew/homebrew#14198.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
master
samueljohn 2012-08-15 10:22:14 +02:00 committed by Jack Nagel
parent 909605ebc1
commit 7a0646c8e1
1 changed files with 14 additions and 7 deletions

View File

@ -67,9 +67,20 @@ class Python3 < Formula
end
def install
args = [ "--prefix=#{prefix}",
"--enable-ipv6",
"--enable-framework=#{prefix}/Frameworks" ]
args = %W[--prefix=#{prefix}
--enable-ipv6
--datarootdir=#{share}
--datadir=#{share}
--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)
@ -78,7 +89,6 @@ class Python3 < 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
# Allow sqlite3 module to load extensions:
@ -112,9 +122,6 @@ class Python3 < Formula
# Make sure homebrew symlinks it to HOMEBREW_PREFIX/bin.
ln_s "#{bin}/python3.2", "#{bin}/python3" unless (bin/"python3").exist?
# Python 2 has a 2to3, too. (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/"python3.2/distutils/distutils.cfg").write <<-EOF.undent