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

Function get_platform_osx

Lib/_osx_support.py:499–579  ·  view source on GitHub ↗

Filter values for get_platform()

(_config_vars, osname, release, machine)

Source from the content-addressed store, hash-verified

497
498
499def get_platform_osx(_config_vars, osname, release, machine):
500 """Filter values for get_platform()"""
501 # called from get_platform() in sysconfig and distutils.util
502 #
503 # For our purposes, we'll assume that the system version from
504 # distutils' perspective is what MACOSX_DEPLOYMENT_TARGET is set
505 # to. This makes the compatibility story a bit more sane because the
506 # machine is going to compile and link as if it were
507 # MACOSX_DEPLOYMENT_TARGET.
508
509 macver = _config_vars.get('MACOSX_DEPLOYMENT_TARGET', '')
510 if macver and '.' not in macver:
511 # Ensure that the version includes at least a major
512 # and minor version, even if MACOSX_DEPLOYMENT_TARGET
513 # is set to a single-label version like "14".
514 macver += '.0'
515 macrelease = _get_system_version() or macver
516 macver = macver or macrelease
517
518 if macver:
519 release = macver
520 osname = "macosx"
521
522 # Use the original CFLAGS value, if available, so that we
523 # return the same machine type for the platform string.
524 # Otherwise, distutils may consider this a cross-compiling
525 # case and disallow installs.
526 cflags = _config_vars.get(_INITPRE+'CFLAGS',
527 _config_vars.get('CFLAGS', ''))
528 if macrelease:
529 try:
530 macrelease = tuple(int(i) for i in macrelease.split('.')[0:2])
531 except ValueError:
532 macrelease = (10, 3)
533 else:
534 # assume no universal support
535 macrelease = (10, 3)
536
537 if (macrelease >= (10, 4)) and '-arch' in cflags.strip():
538 # The universal build will build fat binaries, but not on
539 # systems before 10.4
540
541 machine = 'fat'
542
543 archs = re.findall(r'-arch\s+(\S+)', cflags)
544 archs = tuple(sorted(set(archs)))
545
546 if len(archs) == 1:
547 machine = archs[0]
548 elif archs == ('arm64', 'x86_64'):
549 machine = 'universal2'
550 elif archs == ('i386', 'ppc'):
551 machine = 'fat'
552 elif archs == ('i386', 'x86_64'):
553 machine = 'intel'
554 elif archs == ('i386', 'ppc', 'x86_64'):
555 machine = 'fat3'
556 elif archs == ('ppc64', 'x86_64'):

Callers

nothing calls this directly

Calls 8

_get_system_versionFunction · 0.85
sortedFunction · 0.85
setFunction · 0.85
lenFunction · 0.85
getMethod · 0.45
splitMethod · 0.45
stripMethod · 0.45
findallMethod · 0.45

Tested by

no test coverage detected