MCPcopy Index your code
hub / github.com/python/cpython / checkEnvironment

Function checkEnvironment

Mac/BuildScript/build-installer.py:562–635  ·  view source on GitHub ↗

Check that we're running on a supported system.

()

Source from the content-addressed store, hash-verified

560 % (versionline, configfile))
561
562def checkEnvironment():
563 """
564 Check that we're running on a supported system.
565 """
566
567 if sys.version_info[0:2] < (2, 7):
568 fatal("This script must be run with Python 2.7 (or later)")
569
570 if platform.system() != 'Darwin':
571 fatal("This script should be run on a macOS 10.5 (or later) system")
572
573 if int(platform.release().split('.')[0]) < 8:
574 fatal("This script should be run on a macOS 10.5 (or later) system")
575
576 # Because we only support dynamic load of only one major/minor version of
577 # Tcl/Tk, if we are not using building and using our own private copy of
578 # Tcl/Tk, ensure:
579 # 1. there is a user-installed framework (usually ActiveTcl) in (or linked
580 # in) SDKROOT/Library/Frameworks. As of Python 3.7.0, we no longer
581 # enforce that the version of the user-installed framework also
582 # exists in the system-supplied Tcl/Tk frameworks. Time to support
583 # Tcl/Tk 8.6 even if Apple does not.
584 if not internalTk():
585 frameworks = {}
586 for framework in ['Tcl', 'Tk']:
587 fwpth = 'Library/Frameworks/%s.framework/Versions/Current' % framework
588 libfw = os.path.join('/', fwpth)
589 usrfw = os.path.join(os.getenv('HOME'), fwpth)
590 frameworks[framework] = os.readlink(libfw)
591 if not os.path.exists(libfw):
592 fatal("Please install a link to a current %s %s as %s so "
593 "the user can override the system framework."
594 % (framework, frameworks[framework], libfw))
595 if os.path.exists(usrfw):
596 fatal("Please rename %s to avoid possible dynamic load issues."
597 % usrfw)
598
599 if frameworks['Tcl'] != frameworks['Tk']:
600 fatal("The Tcl and Tk frameworks are not the same version.")
601
602 print(" -- Building with external Tcl/Tk %s frameworks"
603 % frameworks['Tk'])
604
605 # add files to check after build
606 EXPECTED_SHARED_LIBS['_tkinter.so'] = [
607 "/Library/Frameworks/Tcl.framework/Versions/%s/Tcl"
608 % frameworks['Tcl'],
609 "/Library/Frameworks/Tk.framework/Versions/%s/Tk"
610 % frameworks['Tk'],
611 ]
612 else:
613 print(" -- Building private copy of Tcl/Tk")
614 print("")
615
616 # Remove inherited environment variables which might influence build
617 environ_var_prefixes = ['CPATH', 'C_INCLUDE_', 'DYLD_', 'LANG', 'LC_',
618 'LD_', 'LIBRARY_', 'PATH', 'PYTHON']
619 for ev in list(os.environ):

Callers 1

mainFunction · 0.85

Calls 10

internalTkFunction · 0.85
listClass · 0.85
fatalFunction · 0.70
splitMethod · 0.45
releaseMethod · 0.45
joinMethod · 0.45
readlinkMethod · 0.45
existsMethod · 0.45
startswithMethod · 0.45
isdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…