summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/python/python-3.7.4+-distutils-C++-testsuite.patch
blob: 99361087024d26c6145ebad6f6c49032910a51f7 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
This patch updates the distutils test suite for:
var/spack/repos/builtin/packages/python/python-3.7.4+-distutils-C++.patch

That patch fixes several shortcomings in the distutils C++ support,
most prominently missing support for passing CXXFLAGS from the environment.

Since it does not update the distutils testsuite, it causes the testsuite
to fail, which this patch updates to pass.

-----------------------------------------------------------------------------
Spack changelog
- Added patch header to aid understanding the patch and maintainance
- Updated the distutils testsuite in Lib/distutils/tests/test_sysconfig.py

-----------------------------------------------------------------------------
Upstream status

Upstream bug: https://bugs.python.org/issue1222585

Status: Closed, wont fix, comment by Eric Araujo, Python Core Dev:
"setuptools and other active build tools are the better target for this feature."
https://bugs.python.org/issue1222585#msg379348

But according to the last-but-oncomment, setuptools seems to be lacking there too.
https://bugs.python.org/issue1222585#msg371840

-----------------------------------------------------------------------------
Description

distutils has no support for CXXFLAGS, this patch adds it.

Upstream distutils requires to pass all CXXFLAGS (C++-specific CFLAGS)
as part of the CXX enviromnent variable instead.

This patch:
- adds CXXFLAGS support
- adds LDCXXSHARED like LDSHARED
- passes cflags to CXX like it passes them to CC.

The distutils testsuite is updated accordingly to pass the tests.
Since it passes, it is the authoritative info of the current effects of this patch.

See the update of the distutils testsuite in Lib/distutils/tests/test_sysconfig.py
below for details on the effect of this patch.

diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py
index db6674e..ccbe09a 100644
--- a/Lib/distutils/tests/test_sysconfig.py
+++ b/Lib/distutils/tests/test_sysconfig.py
@@ -89,8 +89,10 @@
             'CXX': 'sc_cxx',
             'ARFLAGS': '--sc-arflags',
             'CFLAGS': '--sc-cflags',
+            'CXXFLAGS': '--sc-cxxflags',
             'CCSHARED': '--sc-ccshared',
             'LDSHARED': 'sc_ldshared',
+            'LDCXXSHARED': 'sc_ldshared_cxx',
             'SHLIB_SUFFIX': 'sc_shutil_suffix',
 
             # On macOS, disable _osx_support.customize_compiler()
@@ -114,11 +116,13 @@
         os.environ['AR'] = 'env_ar'
         os.environ['CC'] = 'env_cc'
         os.environ['CPP'] = 'env_cpp'
-        os.environ['CXX'] = 'env_cxx --env-cxx-flags'
+        os.environ['CXX'] = 'env_cxx'
         os.environ['LDSHARED'] = 'env_ldshared'
+        os.environ['LDCXXSHARED'] = 'env_ldshared_cxx'
         os.environ['LDFLAGS'] = '--env-ldflags'
         os.environ['ARFLAGS'] = '--env-arflags'
         os.environ['CFLAGS'] = '--env-cflags'
+        os.environ['CXXFLAGS'] = '--env-cxxflags'
         os.environ['CPPFLAGS'] = '--env-cppflags'
 
         comp = self.customize_compiler()
@@ -128,16 +132,24 @@
                          'env_cpp --env-cppflags')
         self.assertEqual(comp.exes['compiler'],
                          'env_cc --sc-cflags --env-cflags --env-cppflags')
+        self.assertEqual(comp.exes['compiler_cxx'],
+                         'env_cxx --sc-cflags --env-cxxflags --env-cppflags')
         self.assertEqual(comp.exes['compiler_so'],
                          ('env_cc --sc-cflags '
                           '--env-cflags ''--env-cppflags --sc-ccshared'))
-        self.assertEqual(comp.exes['compiler_cxx'],
-                         'env_cxx --env-cxx-flags')
+        self.assertEqual(comp.exes['compiler_so_cxx'],
+                         ('env_cxx --sc-cflags '
+                          '--env-cxxflags ''--env-cppflags --sc-ccshared'))
         self.assertEqual(comp.exes['linker_exe'],
                          'env_cc')
+        self.assertEqual(comp.exes['linker_exe_cxx'],
+                         'env_cxx')
         self.assertEqual(comp.exes['linker_so'],
                          ('env_ldshared --env-ldflags --env-cflags'
                           ' --env-cppflags'))
+        self.assertEqual(comp.exes['linker_so_cxx'],
+                         ('env_ldshared_cxx --env-ldflags --env-cxxflags'
+                          ' --env-cppflags'))
         self.assertEqual(comp.shared_lib_extension, 'sc_shutil_suffix')
 
         del os.environ['AR']
@@ -145,9 +157,11 @@
         del os.environ['CPP']
         del os.environ['CXX']
         del os.environ['LDSHARED']
+        del os.environ['LDCXXSHARED']
         del os.environ['LDFLAGS']
         del os.environ['ARFLAGS']
         del os.environ['CFLAGS']
+        del os.environ['CXXFLAGS']
         del os.environ['CPPFLAGS']
 
         comp = self.customize_compiler()
@@ -157,14 +171,21 @@
                          'sc_cc -E')
         self.assertEqual(comp.exes['compiler'],
                          'sc_cc --sc-cflags')
+        # TODO: Likely this sould get --sc-cxxflags instead:
+        self.assertEqual(comp.exes['compiler_cxx'],
+                         'sc_cxx --sc-cflags')
         self.assertEqual(comp.exes['compiler_so'],
                          'sc_cc --sc-cflags --sc-ccshared')
-        self.assertEqual(comp.exes['compiler_cxx'],
-                         'sc_cxx')
+        self.assertEqual(comp.exes['compiler_so_cxx'],
+                         'sc_cxx --sc-cflags --sc-ccshared')
         self.assertEqual(comp.exes['linker_exe'],
                          'sc_cc')
+        self.assertEqual(comp.exes['linker_exe_cxx'],
+                         'sc_cxx')
         self.assertEqual(comp.exes['linker_so'],
                          'sc_ldshared')
+        self.assertEqual(comp.exes['linker_so_cxx'],
+                         'sc_ldshared_cxx')
         self.assertEqual(comp.shared_lib_extension, 'sc_shutil_suffix')
 
     def test_parse_makefile_base(self):