use importlib.machinery instead of the (deprecated) imp
[mass-build.git] / mass_build.py
index 93ae5a3280408cc800c7b4fa9a21e35e1021535e..88db907bd01ebb41fdfab6eadca4aa66d684cfec 100755 (executable)
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-import vcs, build_system, imp
+import vcs, build_system, importlib.machinery
 import argparse, os, sys, subprocess
 from collections import OrderedDict
 
@@ -81,7 +81,7 @@ if args.reset_source and not args.update:
 # load config
 old_val = sys.dont_write_bytecode
 sys.dont_write_bytecode = True
-config = imp.load_source('config', args.config).__dict__
+config = importlib.machinery.SourceFileLoader('config', args.config).load_module().__dict__
 sys.dont_write_bytecode = old_val
 
 # initialise variables holding the configuration
@@ -91,7 +91,7 @@ workProjects = [] # projects we work on
 
 # copy all items which don't exist below, except for those in the exclude list
 def inherit(subConfig, superConfig, exclude = ('name', 'projects')):
-       for name in list(superConfig.keys()):
+       for name in superConfig.keys():
                if (not name in subConfig) and (not name in exclude):
                        subConfig[name] = superConfig[name]