nixpkgs/pkgs/applications/science/math/sage/patches/python-5755-hotpatch.patch
2018-06-30 01:21:31 +02:00

29 lines
1016 B
Diff

diff --git a/src/sage/all.py b/src/sage/all.py
index ca309ef..be3186b 100644
--- a/src/sage/all.py
+++ b/src/sage/all.py
@@ -298,6 +298,23 @@ warnings.filterwarnings('ignore', module='matplotlib[.]font_manager')
warnings.filterwarnings('default',
'[\s\S]*See http://trac.sagemath.org/[0-9]* for details.')
+# Hotpatch around https://bugs.python.org/issue5755 which won't be fixed for
+# python 2.7. Idea by https://stackoverflow.com/a/36293331.
+from distutils.command.build_ext import build_ext
+from distutils.sysconfig import customize_compiler
+
+_build_extensions = build_ext.build_extensions
+
+def build_extensions_patched(self):
+ customize_compiler(self.compiler)
+ try:
+ self.compiler.compiler_so.remove("-Wstrict-prototypes")
+ except (AttributeError, ValueError):
+ pass
+ _build_extensions(self)
+
+build_ext.build_extensions = build_extensions_patched
+
# Set a new random number seed as the very last thing
# (so that printing initial_seed() and using that seed