about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/math/sage/patches/python-5755-hotpatch.patch
blob: 1b64f39fe60f94f80b8ea22b40c1016efa5fc7b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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