summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-04-02 20:59:22 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2019-04-02 20:59:22 (GMT)
commit4af321601c6567d4fe44653b7b08c71d796ff0eb (patch)
tree9085b3436103c772006fa72910c3199c82444f6e /src/engine
parent50c9c963970a5b377b2202e884f7b0d8498f0a66 (diff)
parent4b2c0674a783c6d2d1f66d2588223bd5d99acda7 (diff)
downloadSCons-4af321601c6567d4fe44653b7b08c71d796ff0eb.zip
SCons-4af321601c6567d4fe44653b7b08c71d796ff0eb.tar.gz
SCons-4af321601c6567d4fe44653b7b08c71d796ff0eb.tar.bz2
Merge branch 'master' of github.com:SCons/scons into fix_mongo_bug_33111_multiple_targets_via_emitter_spurious_rebuilds
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Platform/__init__.py11
-rw-r--r--src/engine/SCons/Tool/__init__.py4
-rw-r--r--src/engine/SCons/Tool/cyglink.py2
-rw-r--r--src/engine/SCons/Tool/msvs.py8
-rw-r--r--src/engine/SCons/Tool/packaging/__init__.py8
-rw-r--r--src/engine/SCons/Tool/suncxx.py4
-rw-r--r--src/engine/SCons/compat/__init__.py15
7 files changed, 19 insertions, 33 deletions
diff --git a/src/engine/SCons/Platform/__init__.py b/src/engine/SCons/Platform/__init__.py
index 71d292e..e06eb0f 100644
--- a/src/engine/SCons/Platform/__init__.py
+++ b/src/engine/SCons/Platform/__init__.py
@@ -47,7 +47,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import SCons.compat
-import imp
+import importlib
import os
import sys
import tempfile
@@ -101,13 +101,8 @@ def platform_module(name = platform_default()):
eval(full_name)
else:
try:
- file, path, desc = imp.find_module(name,
- sys.modules['SCons.Platform'].__path__)
- try:
- mod = imp.load_module(full_name, file, path, desc)
- finally:
- if file:
- file.close()
+ # the specific platform module is a relative import
+ mod = importlib.import_module("." + name, __name__)
except ImportError:
try:
import zipimport
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 74dba75..8fbd587 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -37,8 +37,6 @@ tool definition.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import imp
-import importlib
import sys
import re
import os
@@ -121,6 +119,8 @@ class Tool(object):
self.options = module.options
def _load_dotted_module_py2(self, short_name, full_name, searchpaths=None):
+ import imp
+
splitname = short_name.split('.')
index = 0
srchpths = searchpaths
diff --git a/src/engine/SCons/Tool/cyglink.py b/src/engine/SCons/Tool/cyglink.py
index f69b886..c3d78de 100644
--- a/src/engine/SCons/Tool/cyglink.py
+++ b/src/engine/SCons/Tool/cyglink.py
@@ -133,7 +133,7 @@ def _versioned_lib_suffix(env, suffix, version):
if Verbose:
print("_versioned_lib_suffix: suffix= ", suffix)
print("_versioned_lib_suffix: version= ", version)
- cygversion = re.sub('\.', '-', version)
+ cygversion = re.sub(r'\.', '-', version)
if not suffix.startswith('-' + cygversion):
suffix = '-' + cygversion + suffix
if Verbose:
diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py
index f4439ba..ff81732 100644
--- a/src/engine/SCons/Tool/msvs.py
+++ b/src/engine/SCons/Tool/msvs.py
@@ -1080,7 +1080,7 @@ V10DSPPropertyGroupCondition = """\
V10DSPImportGroupCondition = """\
\t<ImportGroup Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'" Label="PropertySheets">
-\t\t<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+\t\t<Import Project="$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
\t</ImportGroup>
"""
@@ -1159,7 +1159,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
name = self.name
confkeys = sorted(self.configs.keys())
- self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\n')
+ self.file.write('\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.Default.props" />\n')
toolset = ''
if 'MSVC_VERSION' in self.env:
@@ -1170,7 +1170,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
platform = self.configs[kind].platform
self.file.write(V10DSPPropertyGroupCondition % locals())
- self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\n')
+ self.file.write('\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.props" />\n')
self.file.write('\t<ImportGroup Label="ExtensionSettings">\n')
self.file.write('\t</ImportGroup>\n')
@@ -1233,7 +1233,7 @@ class _GenerateV10DSP(_DSPGenerator, _GenerateV10User):
self.filters_file.write('</Project>')
self.filters_file.close()
- self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\n'
+ self.file.write('\t<Import Project="$(VCTargetsPath)\\Microsoft.Cpp.targets" />\n'
'\t<ImportGroup Label="ExtensionTargets">\n'
'\t</ImportGroup>\n'
'</Project>\n')
diff --git a/src/engine/SCons/Tool/packaging/__init__.py b/src/engine/SCons/Tool/packaging/__init__.py
index 6261f98..174ab8c 100644
--- a/src/engine/SCons/Tool/packaging/__init__.py
+++ b/src/engine/SCons/Tool/packaging/__init__.py
@@ -35,7 +35,7 @@ from SCons.Util import is_List, make_path_relative
from SCons.Warnings import warn, Warning
import os
-import imp
+import importlib
__all__ = [
'src_targz', 'src_tarbz2', 'src_xz', 'src_zip',
@@ -122,12 +122,12 @@ def Package(env, target=None, source=None, **kw):
# load the needed packagers.
def load_packager(type):
try:
- file,path,desc=imp.find_module(type, __path__)
- return imp.load_module(type, file, path, desc)
+ # the specific packager is a relative import
+ return importlib.import_module("." + type, __name__)
except ImportError as e:
raise EnvironmentError("packager %s not available: %s"%(type,str(e)))
- packagers=list(map(load_packager, PACKAGETYPE))
+ packagers = list(map(load_packager, PACKAGETYPE))
# set up targets and the PACKAGEROOT
try:
diff --git a/src/engine/SCons/Tool/suncxx.py b/src/engine/SCons/Tool/suncxx.py
index 29226ea..d526d86 100644
--- a/src/engine/SCons/Tool/suncxx.py
+++ b/src/engine/SCons/Tool/suncxx.py
@@ -56,7 +56,7 @@ def get_package_info(package_name, pkginfo, pkgchk):
except EnvironmentError:
pass
else:
- sadm_re = re.compile('^(\S*/bin/CC)(=\S*)? %s$' % package_name, re.M)
+ sadm_re = re.compile(r'^(\S*/bin/CC)(=\S*)? %s$' % package_name, re.M)
sadm_match = sadm_re.search(sadm_contents)
if sadm_match:
pathname = os.path.dirname(sadm_match.group(1))
@@ -69,7 +69,7 @@ def get_package_info(package_name, pkginfo, pkgchk):
pass
else:
pkginfo_contents = p.communicate()[0]
- version_re = re.compile('^ *VERSION:\s*(.*)$', re.M)
+ version_re = re.compile(r'^ *VERSION:\s*(.*)$', re.M)
version_match = version_re.search(pkginfo_contents)
if version_match:
version = version_match.group(1)
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py
index 7ab94c5..83b084a 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -61,27 +61,18 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
-import imp # Use the "imp" module to protect imports from fixers.
+import importlib
PYPY = hasattr(sys, 'pypy_translation_info')
-def import_as(module, name):
- """
- Imports the specified module (from our local directory) as the
- specified name, returning the loaded module object.
- """
- dir = os.path.split(__file__)[0]
- return imp.load_module(name, *imp.find_module(module, [dir]))
-
-
def rename_module(new, old):
"""
- Attempts to import the old module and load it under the new name.
+ Attempt to import the old module and load it under the new name.
Used for purely cosmetic name changes in Python 3.x.
"""
try:
- sys.modules[new] = imp.load_module(old, *imp.find_module(old))
+ sys.modules[new] = importlib.import_module(old)
return True
except ImportError:
return False