Commits

Anonymous committed a1071a0

Fix regression tests (imports not happening as expected)

  • Participants
  • Parent commits 156f283

Comments (0)

Files changed (5)

src/engine/SCons/Taskmaster.py

                 T.write(self.trace_message('       removing node %s from the pending children set\n' %
                         self.trace_node(n)))
         try:
-            while True:
+            while len(to_visit):
                 node = to_visit.pop()
                 node_func(node)
 

src/engine/SCons/compat/__init__.py

     Used for purely cosmetic name changes in Python 3.x.
     """
     try:
-        sys.modules[new] = imp.load_module(new, *imp.find_module(old))
+        sys.modules[new] = imp.load_module(old, *imp.find_module(old))
         return True
     except ImportError:
         return False
 
 
 try:
-    import dbm
-except ImportError:
-    dbm = import_as('_scons_dbm', 'dbm')
-try:
-    dbm.whichdb
-except AttributeError:
-    # Pre-3.0 Python has no dbm.whichdb function.
-    import whichdb
-    dbm.whichdb = whichdb.whichdb
-    del whichdb
-
-
-try:
     import io
 except ImportError:
     # Pre-2.6 Python has no io module.

src/script/sconsign.py

 __developer__ = "__DEVELOPER__"
 
 import os
-import os.path
 import sys
 import time
 
 # END STANDARD SCons SCRIPT HEADER
 ##############################################################################
 
-import SCons.compat
+import SCons.compat   # so pickle will import cPickle instead
 
-import dbm
+import whichdb
+import pickle
 import imp
-import pickle
 
 import SCons.SConsign
 
-# Monkey-patch in a whichdb()-like function so any use of dbm.whichdb()
-# can detect our internal .dblite format,
 def my_whichdb(filename):
     if filename[-7:] == ".dblite":
         return "SCons.dblite"
         pass
     return _orig_whichdb(filename)
 
-_orig_whichdb = dbm.whichdb
-dbm.whichdb = my_whichdb
+_orig_whichdb = whichdb.whichdb
+whichdb.whichdb = my_whichdb
 
 def my_import(mname):
     if '.' in mname:
         Do_Call(a)
 else:
     for a in args:
-        dbm_name = dbm.whichdb(a)
+        dbm_name = whichdb.whichdb(a)
         if dbm_name:
             Map_Module = {'SCons.dblite' : 'dblite'}
             dbm = my_import(dbm_name)

test/SConscript/SConscript.py

 SConscript('SConscript5')
 
 try:
-    from io import UserList
+    from collections import UserList
 except ImportError:
-    from UserList import UserList
+    exec('from UserList import UserList')
 x7 = "SConstruct x7"
 x8 = "SConstruct x8"
 x9 = SConscript('SConscript6', UserList(["x7", "x8"]))

test/subclassing.py

 env.Command('f0.out', 'f0.in', copy_action)
 
 try:
-    from io import UserString
+    from collections import UserString
 except ImportError:
-    from UserString import UserString
+    exec('from UserString import UserString')
 try:
     class mystr(str):
         pass