MCPcopy Index your code
hub / github.com/RustPython/RustPython / _remove_unsupported_archs

Function _remove_unsupported_archs

Lib/_osx_support.py:274–311  ·  view source on GitHub ↗

Remove any unsupported archs from config vars

(_config_vars)

Source from the content-addressed store, hash-verified

272
273
274def _remove_unsupported_archs(_config_vars):
275 """Remove any unsupported archs from config vars"""
276 # Different Xcode releases support different sets for '-arch'
277 # flags. In particular, Xcode 4.x no longer supports the
278 # PPC architectures.
279 #
280 # This code automatically removes '-arch ppc' and '-arch ppc64'
281 # when these are not supported. That makes it possible to
282 # build extensions on OSX 10.7 and later with the prebuilt
283 # 32-bit installer on the python.org website.
284
285 # skip checks if the compiler was overridden with a CC env variable
286 if 'CC' in os.environ:
287 return _config_vars
288
289 if re.search(r'-arch\s+ppc', _config_vars['CFLAGS']) is not None:
290 # NOTE: Cannot use subprocess here because of bootstrap
291 # issues when building Python itself
292 status = os.system(
293 """echo 'int main{};' | """
294 """'%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/null"""
295 %(_config_vars['CC'].replace("'", "'\"'\"'"),))
296 if status:
297 # The compile failed for some reason. Because of differences
298 # across Xcode and compiler versions, there is no reliable way
299 # to be sure why it failed. Assume here it was due to lack of
300 # PPC support and remove the related '-arch' flags from each
301 # config variables not explicitly overridden by an environment
302 # variable. If the error was for some other reason, we hope the
303 # failure will show up again when trying to compile an extension
304 # module.
305 for cv in _UNIVERSAL_CONFIG_VARS:
306 if cv in _config_vars and cv not in os.environ:
307 flags = _config_vars[cv]
308 flags = re.sub(r'-arch\s+ppc\w*\s', ' ', flags)
309 _save_modified_value(_config_vars, cv, flags)
310
311 return _config_vars
312
313
314def _override_all_archs(_config_vars):

Callers 1

customize_compilerFunction · 0.85

Calls 4

_save_modified_valueFunction · 0.85
searchMethod · 0.45
replaceMethod · 0.45
subMethod · 0.45

Tested by

no test coverage detected