Additional clean up of how we import some SCons.* module names, including
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 13 Sep 2008 04:48:36 +0000 (04:48 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 13 Sep 2008 04:48:36 +0000 (04:48 +0000)
making SCons.Job.stack_size a variable that always exists, instead of
one that gets set from outside and requires SCons.Job to check for an
AttributeError.

git-svn-id: http://scons.tigris.org/svn/scons/trunk@3393 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Job.py
src/engine/SCons/Script/Interactive.py
src/engine/SCons/Script/Main.py

index e6d02e483e81a77f46421b00acc87766475b8557..86886e04225eb586139ca002425477a6b9bd761a 100644 (file)
@@ -34,7 +34,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 import os
 import signal
 
-import SCons
+import SCons.Errors
 
 # The default stack size (in kilobytes) of the threads used to execute
 # jobs in parallel.
@@ -44,6 +44,7 @@ import SCons
 # parallelized the build. For example, the default stack size on linux
 # is 8 MBytes.
 
+explicit_stack_size = None
 default_stack_size = 256
 
 interrupt_msg = 'Build interrupted.'
@@ -81,9 +82,8 @@ class Jobs:
 
         self.job = None
         if num > 1:
-            try:
-                stack_size = SCons.Job.stack_size
-            except AttributeError:
+            stack_size = explicit_stack_size
+            if stack_size is None:
                 stack_size = default_stack_size
                 
             try:
index a024a9e0811795f37412e443180889f7710db3a7..46582c582c165825c82d057257a0c91666267f54 100644 (file)
@@ -98,8 +98,6 @@ try:
 except ImportError:
     pass
 
-import SCons
-
 class SConsInteractiveCmd(cmd.Cmd):
     """\
     build [TARGETS]         Build the specified TARGETS and their dependencies.
@@ -163,6 +161,7 @@ class SConsInteractiveCmd(cmd.Cmd):
         build [TARGETS]         Build the specified TARGETS and their
                                 dependencies.  'b' is a synonym.
         """
+        import SCons.Node
         import SCons.SConsign
         import SCons.Script.Main
 
index dc24b226818396df9f7ce6156343b130f4e504cb..12e7fbad009905b348d9ecf2234aa0f36388afe2 100644 (file)
@@ -963,8 +963,8 @@ def _main(parser):
     SCons.Node.implicit_cache = options.implicit_cache
     SCons.Node.FS.set_duplicate(options.duplicate)
     fs.set_max_drift(options.max_drift)
-    if not options.stack_size is None:
-        SCons.Job.stack_size = options.stack_size
+
+    SCons.Job.explicit_stack_size = options.stack_size
 
     platform = SCons.Platform.platform_module()