Main.py (SCons-4.3.0) | : | Main.py (SCons-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 35 | skipping to change at line 35 | |||
Architecturally, this *is* the scons script, and will likely only be | Architecturally, this *is* the scons script, and will likely only be | |||
called from the external "scons" wrapper. Consequently, anything here | called from the external "scons" wrapper. Consequently, anything here | |||
should not be, or be considered, part of the build engine. If it's | should not be, or be considered, part of the build engine. If it's | |||
something that we expect other software to want to use, it should go in | something that we expect other software to want to use, it should go in | |||
some other module. If it's specific to the "scons" script invocation, | some other module. If it's specific to the "scons" script invocation, | |||
it goes here. | it goes here. | |||
""" | """ | |||
# these define the range of versions SCons supports | # these define the range of versions SCons supports | |||
unsupported_python_version = (3, 5, 0) | minimum_python_version = (3, 6, 0) | |||
deprecated_python_version = (3, 6, 0) | deprecated_python_version = (3, 6, 0) | |||
import SCons.compat | import SCons.compat | |||
import atexit | import atexit | |||
import importlib.util | import importlib.util | |||
import os | import os | |||
import re | import re | |||
import sys | import sys | |||
import time | import time | |||
skipping to change at line 67 | skipping to change at line 67 | |||
import SCons.Node.FS | import SCons.Node.FS | |||
import SCons.Platform | import SCons.Platform | |||
import SCons.Platform.virtualenv | import SCons.Platform.virtualenv | |||
import SCons.SConf | import SCons.SConf | |||
import SCons.Script | import SCons.Script | |||
import SCons.Taskmaster | import SCons.Taskmaster | |||
import SCons.Util | import SCons.Util | |||
import SCons.Warnings | import SCons.Warnings | |||
import SCons.Script.Interactive | import SCons.Script.Interactive | |||
from SCons import __version__ as SConsVersion | ||||
# Global variables | # Global variables | |||
first_command_start = None | first_command_start = None | |||
last_command_end = None | last_command_end = None | |||
print_objects = False | print_objects = False | |||
print_memoizer = False | print_memoizer = False | |||
print_stacktrace = False | print_stacktrace = False | |||
print_time = False | print_time = False | |||
print_action_timestamps = False | print_action_timestamps = False | |||
sconscript_time = 0 | sconscript_time = 0 | |||
cumulative_command_time = 0 | cumulative_command_time = 0 | |||
skipping to change at line 445 | skipping to change at line 447 | |||
func = self.get_derived_children | func = self.get_derived_children | |||
else: | else: | |||
func = self.get_all_children | func = self.get_all_children | |||
s = self.status and 2 or 0 | s = self.status and 2 or 0 | |||
SCons.Util.print_tree(t, func, prune=self.prune, showtags=s, lastChild=T rue, singleLineDraw=self.sLineDraw) | SCons.Util.print_tree(t, func, prune=self.prune, showtags=s, lastChild=T rue, singleLineDraw=self.sLineDraw) | |||
def python_version_string(): | def python_version_string(): | |||
return sys.version.split()[0] | return sys.version.split()[0] | |||
def python_version_unsupported(version=sys.version_info): | def python_version_unsupported(version=sys.version_info): | |||
return version < unsupported_python_version | return version < minimum_python_version | |||
def python_version_deprecated(version=sys.version_info): | def python_version_deprecated(version=sys.version_info): | |||
return version < deprecated_python_version | return version < deprecated_python_version | |||
class FakeOptionParser: | class FakeOptionParser: | |||
""" | """ | |||
A do-nothing option parser, used for the initial OptionsParser variable. | A do-nothing option parser, used for the initial OptionsParser variable. | |||
During normal SCons operation, the OptionsParser is created right | During normal SCons operation, the OptionsParser is created right | |||
away by the main() function. Certain tests scripts however, can | away by the main() function. Certain tests scripts however, can | |||
skipping to change at line 780 | skipping to change at line 782 | |||
Order is significant; we load them in order from most generic | Order is significant; we load them in order from most generic | |||
(machine-wide) to most specific (topdir). | (machine-wide) to most specific (topdir). | |||
The verbose argument is only for testing. | The verbose argument is only for testing. | |||
""" | """ | |||
platform = SCons.Platform.platform_default() | platform = SCons.Platform.platform_default() | |||
def homedir(d): | def homedir(d): | |||
return os.path.expanduser('~/'+d) | return os.path.expanduser('~/'+d) | |||
if platform == 'win32' or platform == 'cygwin': | if platform == 'win32' or platform == 'cygwin': | |||
# Note we use $ here instead of %...% because older | ||||
# pythons (prior to 2.6?) didn't expand %...% on Windows. | ||||
# This set of dirs should work on XP, Vista, 7 and later. | ||||
sysdirs=[ | sysdirs=[ | |||
os.path.expandvars('$ALLUSERSPROFILE\\Application Data\\scons'), | os.path.expandvars('%AllUsersProfile%\\scons'), | |||
os.path.expandvars('$USERPROFILE\\Local Settings\\Application Data\\ | # TODO older path, kept for compat | |||
scons')] | os.path.expandvars('%AllUsersProfile%\\Application Data\\scons'), | |||
appdatadir = os.path.expandvars('$APPDATA\\scons') | os.path.expandvars('%LocalAppData%\\scons')] | |||
appdatadir = os.path.expandvars('%AppData%\\scons') | ||||
if appdatadir not in sysdirs: | if appdatadir not in sysdirs: | |||
sysdirs.append(appdatadir) | sysdirs.append(appdatadir) | |||
sysdirs.append(homedir('.scons')) | sysdirs.append(homedir('.scons')) | |||
elif platform == 'darwin': # MacOS X | elif platform == 'darwin': # MacOS X | |||
sysdirs=['/Library/Application Support/SCons', | sysdirs=['/Library/Application Support/SCons', | |||
'/opt/local/share/scons', # (for MacPorts) | '/opt/local/share/scons', # (for MacPorts) | |||
'/sw/share/scons', # (for Fink) | '/sw/share/scons', # (for Fink) | |||
homedir('Library/Application Support/SCons'), | homedir('Library/Application Support/SCons'), | |||
homedir('.scons')] | homedir('.scons')] | |||
skipping to change at line 978 | skipping to change at line 979 | |||
if options.include_dir: | if options.include_dir: | |||
sys.path = options.include_dir + sys.path | sys.path = options.include_dir + sys.path | |||
# If we're about to start SCons in the interactive mode, | # If we're about to start SCons in the interactive mode, | |||
# inform the FS about this right here. Else, the release_target_info | # inform the FS about this right here. Else, the release_target_info | |||
# method could get called on some nodes, like the used "gcc" compiler, | # method could get called on some nodes, like the used "gcc" compiler, | |||
# when using the Configure methods within the SConscripts. | # when using the Configure methods within the SConscripts. | |||
# This would then cause subtle bugs, as already happened in #2971. | # This would then cause subtle bugs, as already happened in #2971. | |||
if options.interactive: | if options.interactive: | |||
SCons.Node.interactive = True | SCons.Node.interactive = True | |||
# That should cover (most of) the options. | # That should cover (most of) the options. | |||
# Next, set up the variables that hold command-line arguments, | # Next, set up the variables that hold command-line arguments, | |||
# so the SConscript files that we read and execute have access to them. | # so the SConscript files that we read and execute have access to them. | |||
# TODO: for options defined via AddOption which take space-separated | # TODO: for options defined via AddOption which take space-separated | |||
# option-args, the option-args will collect into targets here, | # option-args, the option-args will collect into targets here, | |||
# because we don't yet know to do any different. | # because we don't yet know to do any different. | |||
targets = [] | targets = [] | |||
xmit_args = [] | xmit_args = [] | |||
for a in parser.largs: | for a in parser.largs: | |||
# Skip so-far unrecognized options, and empty string args | # Skip so-far unrecognized options, and empty string args | |||
skipping to change at line 1366 | skipping to change at line 1366 | |||
global OptionsParser | global OptionsParser | |||
global exit_status | global exit_status | |||
global first_command_start | global first_command_start | |||
# Check up front for a Python version we do not support. We | # Check up front for a Python version we do not support. We | |||
# delay the check for deprecated Python versions until later, | # delay the check for deprecated Python versions until later, | |||
# after the SConscript files have been read, in case they | # after the SConscript files have been read, in case they | |||
# disable that warning. | # disable that warning. | |||
if python_version_unsupported(): | if python_version_unsupported(): | |||
msg = "scons: *** SCons version %s does not run under Python version %s. \n" | msg = "scons: *** SCons version %s does not run under Python version %s. \n" | |||
sys.stderr.write(msg % (SCons.__version__, python_version_string())) | sys.stderr.write(msg % (SConsVersion, python_version_string())) | |||
sys.stderr.write("scons: *** Minimum Python version is %d.%d.%d\n" %mini | ||||
mum_python_version) | ||||
sys.exit(1) | sys.exit(1) | |||
parts = ["SCons by Steven Knight et al.:\n"] | parts = ["SCons by Steven Knight et al.:\n"] | |||
try: | try: | |||
import SCons | import SCons | |||
parts.append(version_string("SCons", SCons)) | parts.append(version_string("SCons", SCons)) | |||
except (ImportError, AttributeError): | except (ImportError, AttributeError): | |||
# On Windows there is no scons.py, so there is no | # On Windows there is no scons.py, so there is no | |||
# __main__.__version__, hence there is no script version. | # __main__.__version__, hence there is no script version. | |||
pass | pass | |||
End of changes. 7 change blocks. | ||||
11 lines changed or deleted | 12 lines changed or added |