[python3/python3.4] Don't add declaration-after-statement for extension modules

Matej Stuchlik mstuchli at fedoraproject.org
Sun May 18 22:51:03 UTC 2014


commit 06247262fead50272b205e7b98e99450c31cacd3
Author: Matej Stuchlik <mstuchli at redhat.com>
Date:   Fri May 16 15:11:42 2014 +0200

    Don't add declaration-after-statement for extension modules

 ...nt-add-Werror-declaration-after-statement.patch |   86 ++++++++++++++++++++
 python3.spec                                       |   14 +++-
 2 files changed, 99 insertions(+), 1 deletions(-)
---
diff --git a/00195-dont-add-Werror-declaration-after-statement.patch b/00195-dont-add-Werror-declaration-after-statement.patch
new file mode 100644
index 0000000..506d9ea
--- /dev/null
+++ b/00195-dont-add-Werror-declaration-after-statement.patch
@@ -0,0 +1,86 @@
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -71,12 +71,17 @@
+ BASECFLAGS=	@BASECFLAGS@
+ BASECPPFLAGS=	@BASECPPFLAGS@
+ CONFIGURE_CFLAGS=	@CFLAGS@
++# CFLAGS_NODIST is used for building the interpreter and stdlib C extensions.
++# Use it when a compiler flag should _not_ be part of the distutils CFLAGS
++# once Python is installed (Issue #21121).
++CONFIGURE_CFLAGS_NODIST=@CFLAGS_NODIST@
+ CONFIGURE_CPPFLAGS=	@CPPFLAGS@
+ CONFIGURE_LDFLAGS=	@LDFLAGS@
+ # Avoid assigning CFLAGS, LDFLAGS, etc. so users can use them on the
+ # command line to append to these values without stomping the pre-set
+ # values.
+ PY_CFLAGS=	$(BASECFLAGS) $(OPT) $(CONFIGURE_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
++PY_CFLAGS_NODIST=$(CONFIGURE_CFLAGS_NODIST) $(CFLAGS_NODIST)
+ # Both CPPFLAGS and LDFLAGS need to contain the shell's value for setup.py to
+ # be able to build extension modules using the directories specified in the
+ # environment variables
+@@ -91,7 +96,7 @@
+ # Extra C flags added for building the interpreter object files.
+ CFLAGSFORSHARED=@CFLAGSFORSHARED@
+ # C flags used for building the interpreter object files
+-PY_CORE_CFLAGS=	$(PY_CFLAGS) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
++PY_CORE_CFLAGS=	$(PY_CFLAGS) $(PY_CFLAGS_NODIST) $(PY_CPPFLAGS) $(CFLAGSFORSHARED) -DPy_BUILD_CORE
+ 
+ 
+ # Machine-dependent subdirectories
+diff --git a/configure b/configure
+--- a/configure
++++ b/configure
+@@ -662,6 +662,7 @@
+ LIBTOOL_CRUFT
+ OTHER_LIBTOOL_OPT
+ UNIVERSAL_ARCH_FLAGS
++CFLAGS_NODIST
+ BASECFLAGS
+ OPT
+ ABIFLAGS
+@@ -6504,7 +6505,7 @@
+ 
+     if test $ac_cv_declaration_after_statement_warning = yes
+     then
+-      BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement"
++      CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement"
+     fi
+ 
+     # if using gcc on alpha, use -mieee to get (near) full IEEE 754
+diff --git a/configure.ac b/configure.ac
+--- a/configure.ac
++++ b/configure.ac
+@@ -1147,6 +1147,7 @@
+ fi
+ 
+ AC_SUBST(BASECFLAGS)
++AC_SUBST(CFLAGS_NODIST)
+ 
+ # The -arch flags for universal builds on OSX
+ UNIVERSAL_ARCH_FLAGS=
+@@ -1231,7 +1232,7 @@
+ 
+     if test $ac_cv_declaration_after_statement_warning = yes
+     then
+-      BASECFLAGS="$BASECFLAGS -Werror=declaration-after-statement"
++      CFLAGS_NODIST="$CFLAGS_NODIST -Werror=declaration-after-statement"
+     fi
+ 
+     # if using gcc on alpha, use -mieee to get (near) full IEEE 754
+diff --git a/setup.py b/setup.py
+--- a/setup.py
++++ b/setup.py
+@@ -19,6 +19,12 @@
+ 
+ cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
+ 
++# Add special CFLAGS reserved for building the interpreter and the stdlib
++# modules (Issue #21121).
++cflags = sysconfig.get_config_var('CFLAGS')
++py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST')
++sysconfig.get_config_vars()['CFLAGS'] = cflags + ' ' + py_cflags_nodist
++
+ def get_platform():
+     # cross build
+     if "_PYTHON_HOST_PLATFORM" in os.environ:
diff --git a/python3.spec b/python3.spec
index 4069f50..6425f47 100644
--- a/python3.spec
+++ b/python3.spec
@@ -128,7 +128,7 @@
 Summary: Version 3 of the Python programming language aka Python 3000
 Name: python3
 Version: %{pybasever}.0
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: Python
 Group: Development/Languages
 
@@ -663,6 +663,13 @@ Patch193: 00193-skip-correct-num-of-pycfile-bytes-in-modulefinder.patch
 # see rhbz#1088233
 Patch194: temporarily-disable-tests-requiring-SIGHUP.patch
 
+# 00195
+#
+# Don't declare Werror=declaration-after-statement for extension
+# modules through setup.py
+# http://bugs.python.org/issue21121
+Patch195: 00195-dont-add-Werror-declaration-after-statement.patch
+
 # (New patches go here ^^^)
 #
 # When adding new patches to "python" and "python3" in Fedora 17 onwards,
@@ -937,6 +944,7 @@ done
 %patch190 -p1
 %patch193 -p1
 %patch194 -p1
+%patch195 -p1
 
 # Currently (2010-01-15), http://docs.python.org/library is for 2.6, and there
 # are many differences between 2.6 and the Python 3 library.
@@ -1809,6 +1817,10 @@ rm -fr %{buildroot}
 # ======================================================
 
 %changelog
+* Fri May 16 2014 Matej Stuchlik <mstuchli at redhat.com> - 3.4.0-5
+- Don't add Werror=declaration-after-statement for extension
+  modules through setup.py (PyBT#21121)
+
 * Mon May 12 2014 Matej Stuchlik <mstuchli at redhat.com> - 3.4.0-4
 - Add setuptools and pip to Requires
 


More information about the scm-commits mailing list