main = Main.main
+# The following are global class definitions and variables that used to
+# live directly in this module back before 0.96.90, when it contained
+# a lot of code. Some SConscript files in widely-distributed packages
+# (Blender is the specific example) actually reached into SCons.Script
+# directly to use some of these. Rather than break those SConscript
+# files, we're going to propagate these names into the SCons.Script
+# namespace here.
+#
+# Some of these are commented out because it's *really* unlikely anyone
+# used them, but we're going to leave the comment here to try to make
+# it obvious what to do if the situation arises.
+BuildTask = Main.BuildTask
+CleanTask = Main.CleanTask
+QuestionTask = Main.QuestionTask
+#PrintHelp = Main.PrintHelp
+OptParser = Main.OptParser
+SConscriptSettableOptions = Main.SConscriptSettableOptions
+
+keep_going_on_error = Main.keep_going_on_error
+print_dtree = Main.print_dtree
+print_explanations = Main.print_explanations
+print_includes = Main.print_includes
+print_objects = Main.print_objects
+print_time = Main.print_time
+print_tree = Main.print_tree
+memory_stats = Main.memory_stats
+ignore_errors = Main.ignore_errors
+#sconscript_time = Main.sconscript_time
+#command_time = Main.command_time
+#exit_status = Main.exit_status
+#profiling = Main.profiling
+repositories = Main.repositories
+#num_jobs = Main.num_jobs # settable by SConscript.SetJobs()
+
+#
import SConscript
_SConscript = SConscript
'GetOption',
'Help',
'Import',
- 'SConscript',
+ #'SConscript', is handled separately, below.
'SConscriptChdir',
'SetOption',
for name in GlobalDefaultEnvironmentFunctions + GlobalDefaultBuilders:
exec "%s = _SConscript.DefaultEnvironmentCall(%s)" % (name, repr(name))
+# There are a handful of variables that used to live in the
+# Script/SConscript.py module that some SConscript files out there were
+# accessing directly as SCons.Script.SConscript.*. The problem is that
+# "SConscript" in this namespace is no longer a module, it's a global
+# function call--or more precisely, an object that implements a global
+# function call through the default Environment. Nevertheless, we can
+# aintain backwards compatibility for SConscripts that were reaching in
+# this way by hanging some attributes off the "SConscript" object here.
+SConscript = _SConscript.DefaultEnvironmentCall('SConscript')
+
+SConscript.Arguments = ARGUMENTS
+SConscript.ArgList = ARGLIST
+SConscript.BuildTargets = BUILD_TARGETS
+SConscript.CommandLineTargets = COMMAND_LINE_TARGETS
+SConscript.DefaultTargets = DEFAULT_TARGETS
+
# The global Command() function must be handled differently than the
# global functions for other construction environment methods because
# we want people to be able to use Actions that must expand $TARGET
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
-Test that a module that we import into an SConscript file
-can itself easily import the global SCons variables.
+Test that a module that we import into an SConscript file can itself
+easily import the global SCons variables, and a handful of other variables
+directly from SCons.Script modules.
"""
import TestSCons
test.write('SConscript', """\
import m2
+import m3
+import m4
""")
test.write("m2.py", """\
Command("file.out", "file.in", Copy("$TARGET", "$SOURCE"))
""")
+test.write("m3.py", """\
+import SCons.Script
+
+SCons.Script.BuildTask
+SCons.Script.CleanTask
+SCons.Script.QuestionTask
+#SCons.Script.PrintHelp
+SCons.Script.OptParser
+SCons.Script.SConscriptSettableOptions
+
+SCons.Script.keep_going_on_error
+SCons.Script.print_dtree
+SCons.Script.print_explanations
+SCons.Script.print_includes
+SCons.Script.print_objects
+SCons.Script.print_time
+SCons.Script.print_tree
+SCons.Script.memory_stats
+SCons.Script.ignore_errors
+#SCons.Script.sconscript_time
+#SCons.Script.command_time
+#SCons.Script.exit_status
+#SCons.Script.profiling
+SCons.Script.repositories
+""")
+
+test.write("m4.py", """\
+import SCons.Script.SConscript
+SCons.Script.SConscript.Arguments
+SCons.Script.SConscript.ArgList
+SCons.Script.SConscript.BuildTargets
+SCons.Script.SConscript.CommandLineTargets
+SCons.Script.SConscript.DefaultTargets
+""")
+
test.write("file.in", "file.in\n")
test.run(arguments = '.')