Gentoo Archives: gentoo-commits

From: "Mike Gilbert (floppym)" <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-python/pypy/files: 2.0.2-distutils-fix_handling_of_executables_and_flags.patch
Date: Sun, 26 May 2013 01:48:54
Message-Id: 20130526014849.A80362171D@flycatcher.gentoo.org
1 floppym 13/05/26 01:48:49
2
3 Added:
4 2.0.2-distutils-fix_handling_of_executables_and_flags.patch
5 Log:
6 Version bump.
7
8 (Portage version: 2.2.0_alpha177/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4)
9
10 Revision Changes Path
11 1.1 dev-python/pypy/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pypy/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-python/pypy/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch?rev=1.1&content-type=text/plain
15
16 Index: 2.0.2-distutils-fix_handling_of_executables_and_flags.patch
17 ===================================================================
18 http://bugs.python.org/issue1222585
19
20 --- lib-python/2.7/distutils/cygwinccompiler.py
21 +++ lib-python/2.7/distutils/cygwinccompiler.py
22 @@ -132,9 +132,13 @@
23 self.set_executables(compiler='gcc -mcygwin -O -Wall',
24 compiler_so='gcc -mcygwin -mdll -O -Wall',
25 compiler_cxx='g++ -mcygwin -O -Wall',
26 + compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
27 linker_exe='gcc -mcygwin',
28 linker_so=('%s -mcygwin %s' %
29 - (self.linker_dll, shared_option)))
30 + (self.linker_dll, shared_option)),
31 + linker_exe_cxx='g++ -mcygwin',
32 + linker_so_cxx=('%s -mcygwin %s' %
33 + (self.linker_dll, shared_option)))
34
35 # cygwin and mingw32 need different sets of libraries
36 if self.gcc_version == "2.91.57":
37 @@ -160,8 +164,12 @@
38 raise CompileError, msg
39 else: # for other files use the C-compiler
40 try:
41 - self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
42 - extra_postargs)
43 + if self.detect_language(src) == 'c++':
44 + self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
45 + extra_postargs)
46 + else:
47 + self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
48 + extra_postargs)
49 except DistutilsExecError, msg:
50 raise CompileError, msg
51
52 @@ -322,10 +330,15 @@
53 self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
54 compiler_so='gcc -mno-cygwin -mdll -O -Wall',
55 compiler_cxx='g++ -mno-cygwin -O -Wall',
56 + compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall',
57 linker_exe='gcc -mno-cygwin',
58 linker_so='%s -mno-cygwin %s %s'
59 % (self.linker_dll, shared_option,
60 - entry_point))
61 + entry_point),
62 + linker_exe_cxx='g++ -mno-cygwin',
63 + linker_so_cxx='%s -mno-cygwin %s %s'
64 + % (self.linker_dll, shared_option,
65 + entry_point))
66 # Maybe we should also append -mthreads, but then the finished
67 # dlls need another dll (mingwm10.dll see Mingw32 docs)
68 # (-mthreads: Support thread-safe exception handling on `Mingw32')
69 --- lib-python/2.7/distutils/emxccompiler.py
70 +++ lib-python/2.7/distutils/emxccompiler.py
71 @@ -65,8 +65,12 @@
72 # XXX optimization, warnings etc. should be customizable.
73 self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
74 compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
75 + compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
76 + compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
77 linker_exe='gcc -Zomf -Zmt -Zcrtdll',
78 - linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
79 + linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
80 + linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
81 + linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
82
83 # want the gcc library statically linked (so that we don't have
84 # to distribute a version dependent on the compiler we have)
85 @@ -83,8 +87,12 @@
86 raise CompileError, msg
87 else: # for other files use the C-compiler
88 try:
89 - self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
90 - extra_postargs)
91 + if self.detect_language(src) == 'c++':
92 + self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
93 + extra_postargs)
94 + else:
95 + self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
96 + extra_postargs)
97 except DistutilsExecError, msg:
98 raise CompileError, msg
99
100 --- lib-python/2.7/distutils/sysconfig_cpython.py
101 +++ lib-python/2.7/distutils/sysconfig_cpython.py
102 @@ -150,10 +150,12 @@
103 varies across Unices and is stored in Python's Makefile.
104 """
105 if compiler.compiler_type == "unix":
106 - (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
107 - get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
108 - 'CCSHARED', 'LDSHARED', 'SO', 'AR',
109 - 'ARFLAGS')
110 + (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
111 + get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
112 + 'SO', 'AR', 'ARFLAGS')
113 +
114 + cflags = ''
115 + cxxflags = ''
116
117 newcc = None
118 if 'CC' in os.environ:
119 @@ -191,19 +193,27 @@
120 cxx = os.environ['CXX']
121 if 'LDSHARED' in os.environ:
122 ldshared = os.environ['LDSHARED']
123 + if 'LDCXXSHARED' in os.environ:
124 + ldcxxshared = os.environ['LDCXXSHARED']
125 if 'CPP' in os.environ:
126 cpp = os.environ['CPP']
127 else:
128 cpp = cc + " -E" # not always
129 if 'LDFLAGS' in os.environ:
130 ldshared = ldshared + ' ' + os.environ['LDFLAGS']
131 + ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
132 if 'CFLAGS' in os.environ:
133 - cflags = opt + ' ' + os.environ['CFLAGS']
134 + cflags = os.environ['CFLAGS']
135 ldshared = ldshared + ' ' + os.environ['CFLAGS']
136 + if 'CXXFLAGS' in os.environ:
137 + cxxflags = os.environ['CXXFLAGS']
138 + ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
139 if 'CPPFLAGS' in os.environ:
140 cpp = cpp + ' ' + os.environ['CPPFLAGS']
141 cflags = cflags + ' ' + os.environ['CPPFLAGS']
142 + cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
143 ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
144 + ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
145 if 'AR' in os.environ:
146 ar = os.environ['AR']
147 if 'ARFLAGS' in os.environ:
148 @@ -212,13 +222,17 @@
149 archiver = ar + ' ' + ar_flags
150
151 cc_cmd = cc + ' ' + cflags
152 + cxx_cmd = cxx + ' ' + cxxflags
153 compiler.set_executables(
154 preprocessor=cpp,
155 compiler=cc_cmd,
156 compiler_so=cc_cmd + ' ' + ccshared,
157 - compiler_cxx=cxx,
158 + compiler_cxx=cxx_cmd,
159 + compiler_so_cxx=cxx_cmd + ' ' + ccshared,
160 linker_so=ldshared,
161 linker_exe=cc,
162 + linker_so_cxx=ldcxxshared,
163 + linker_exe_cxx=cxx,
164 archiver=archiver)
165
166 compiler.shared_lib_extension = so_ext
167 @@ -530,7 +544,7 @@
168 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
169 # a number of derived variables. These need to be
170 # patched up as well.
171 - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
172 + 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
173 flags = _config_vars[key]
174 flags = re.sub('-arch\s+\w+\s', ' ', flags)
175 flags = re.sub('-isysroot [^ \t]*', ' ', flags)
176 @@ -549,7 +563,7 @@
177 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
178 # a number of derived variables. These need to be
179 # patched up as well.
180 - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
181 + 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
182
183 flags = _config_vars[key]
184 flags = re.sub('-arch\s+\w+\s', ' ', flags)
185 @@ -573,7 +587,7 @@
186 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
187 # a number of derived variables. These need to be
188 # patched up as well.
189 - 'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
190 + 'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
191
192 flags = _config_vars[key]
193 flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags)
194 --- lib-python/2.7/distutils/sysconfig_pypy.py
195 +++ lib-python/2.7/distutils/sysconfig_pypy.py
196 @@ -114,13 +114,56 @@
197 optional C speedup components.
198 """
199 if compiler.compiler_type == "unix":
200 - compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit'])
201 + cc = ' '.join(compiler.compiler)
202 + cxx = ' '.join(compiler.compiler_cxx)
203 + ldshared = ' '.join(compiler.linker_so)
204 + ldcxxshared = ' '.join(compiler.linker_so_cxx)
205 +
206 + cflags = ''
207 + cxxflags = ''
208 + ccshared = '-fPIC'
209 +
210 + if 'CC' in os.environ:
211 + cc = os.environ['CC']
212 + if 'CXX' in os.environ:
213 + cxx = os.environ['CXX']
214 + if 'LDSHARED' in os.environ:
215 + ldshared = os.environ['LDSHARED']
216 + if 'LDCXXSHARED' in os.environ:
217 + ldcxxshared = os.environ['LDCXXSHARED']
218 + if 'CPP' in os.environ:
219 + cpp = os.environ['CPP']
220 + else:
221 + cpp = cc + " -E" # not always
222 + if 'LDFLAGS' in os.environ:
223 + ldshared = ldshared + ' ' + os.environ['LDFLAGS']
224 + ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
225 + if 'CFLAGS' in os.environ:
226 + cflags = os.environ['CFLAGS']
227 + ldshared = ldshared + ' ' + os.environ['CFLAGS']
228 + if 'CXXFLAGS' in os.environ:
229 + cxxflags = os.environ['CXXFLAGS']
230 + ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
231 + if 'CPPFLAGS' in os.environ:
232 + cpp = cpp + ' ' + os.environ['CPPFLAGS']
233 + cflags = cflags + ' ' + os.environ['CPPFLAGS']
234 + cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
235 + ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
236 + ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
237 +
238 + cc_cmd = cc + ' ' + cflags
239 + cxx_cmd = cxx + ' ' + cxxflags
240 + compiler.set_executables(
241 + preprocessor=cpp,
242 + compiler=cc_cmd,
243 + compiler_so=cc_cmd + ' ' + ccshared,
244 + compiler_cxx=cxx_cmd,
245 + compiler_so_cxx=cxx_cmd + ' ' + ccshared,
246 + linker_so=ldshared,
247 + linker_exe=cc,
248 + linker_so_cxx=ldcxxshared,
249 + linker_exe_cxx=cxx)
250 compiler.shared_lib_extension = get_config_var('SO')
251 - if "CFLAGS" in os.environ:
252 - cflags = os.environ["CFLAGS"]
253 - compiler.compiler.append(cflags)
254 - compiler.compiler_so.append(cflags)
255 - compiler.linker_so.append(cflags)
256
257
258 from sysconfig_cpython import (
259 --- lib-python/2.7/distutils/unixccompiler.py
260 +++ lib-python/2.7/distutils/unixccompiler.py
261 @@ -114,14 +114,17 @@
262 # are pretty generic; they will probably have to be set by an outsider
263 # (eg. using information discovered by the sysconfig about building
264 # Python extensions).
265 - executables = {'preprocessor' : None,
266 - 'compiler' : ["cc"],
267 - 'compiler_so' : ["cc"],
268 - 'compiler_cxx' : ["cc"],
269 - 'linker_so' : ["cc", "-shared"],
270 - 'linker_exe' : ["cc"],
271 - 'archiver' : ["ar", "-cr"],
272 - 'ranlib' : None,
273 + executables = {'preprocessor' : None,
274 + 'compiler' : ["cc"],
275 + 'compiler_so' : ["cc"],
276 + 'compiler_cxx' : ["c++"],
277 + 'compiler_so_cxx' : ["c++"],
278 + 'linker_so' : ["cc", "-shared"],
279 + 'linker_exe' : ["cc"],
280 + 'linker_so_cxx' : ["c++", "-shared"],
281 + 'linker_exe_cxx' : ["c++"],
282 + 'archiver' : ["ar", "-cr"],
283 + 'ranlib' : None,
284 }
285
286 if sys.platform[:6] == "darwin":
287 @@ -171,11 +174,18 @@
288
289 def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
290 compiler_so = self.compiler_so
291 + compiler_so_cxx = self.compiler_so_cxx
292 if sys.platform == 'darwin':
293 compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs)
294 + compiler_so_cxx = _darwin_compiler_fixup(compiler_so_cxx, cc_args +
295 + extra_postargs)
296 try:
297 - self.spawn(compiler_so + cc_args + [src, '-o', obj] +
298 - extra_postargs)
299 + if self.detect_language(src) == 'c++':
300 + self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
301 + extra_postargs)
302 + else:
303 + self.spawn(compiler_so + cc_args + [src, '-o', obj] +
304 + extra_postargs)
305 except DistutilsExecError, msg:
306 raise CompileError, msg
307
308 @@ -232,23 +242,16 @@
309 ld_args.extend(extra_postargs)
310 self.mkpath(os.path.dirname(output_filename))
311 try:
312 - if target_desc == CCompiler.EXECUTABLE:
313 - linker = self.linker_exe[:]
314 + if target_lang == "c++":
315 + if target_desc == CCompiler.EXECUTABLE:
316 + linker = self.linker_exe_cxx[:]
317 + else:
318 + linker = self.linker_so_cxx[:]
319 else:
320 - linker = self.linker_so[:]
321 - if target_lang == "c++" and self.compiler_cxx:
322 - # skip over environment variable settings if /usr/bin/env
323 - # is used to set up the linker's environment.
324 - # This is needed on OSX. Note: this assumes that the
325 - # normal and C++ compiler have the same environment
326 - # settings.
327 - i = 0
328 - if os.path.basename(linker[0]) == "env":
329 - i = 1
330 - while '=' in linker[i]:
331 - i = i + 1
332 -
333 - linker[i] = self.compiler_cxx[i]
334 + if target_desc == CCompiler.EXECUTABLE:
335 + linker = self.linker_exe[:]
336 + else:
337 + linker = self.linker_so[:]
338
339 if sys.platform == 'darwin':
340 linker = _darwin_compiler_fixup(linker, ld_args)