summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-06-23 17:27:40 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2017-06-23 17:27:40 (GMT)
commit05e90800d7925074331b44794093894349e14449 (patch)
tree8c4c8c1ef817bcd2d09014b6fc88a23f347bfe87 /src/engine/SCons
parent640695cfb274dfba41a0c6cc74c95f2a00327f90 (diff)
parent4967ba7fe355283654561d02417564de82649f7e (diff)
downloadSCons-05e90800d7925074331b44794093894349e14449.zip
SCons-05e90800d7925074331b44794093894349e14449.tar.gz
SCons-05e90800d7925074331b44794093894349e14449.tar.bz2
merge from upstream
Diffstat (limited to 'src/engine/SCons')
-rw-r--r--src/engine/SCons/Tool/__init__.py28
-rw-r--r--src/engine/SCons/Tool/dmd.py6
-rw-r--r--src/engine/SCons/Tool/gdc.py4
-rw-r--r--src/engine/SCons/Tool/ldc.py14
4 files changed, 26 insertions, 26 deletions
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 61b7788..e5b4b05 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -118,6 +118,16 @@ class Tool(object):
if hasattr(module, 'options'):
self.options = module.options
+ def _load_dotted_module_py2(self, short_name, full_name, searchpaths=None):
+ splitname = short_name.split('.')
+ index = 0
+ srchpths = searchpaths
+ for item in splitname:
+ file, path, desc = imp.find_module(item, srchpths)
+ mod = imp.load_module(full_name, file, path, desc)
+ srchpths = [path]
+ return mod, file
+
def _tool_module(self):
oldpythonpath = sys.path
sys.path = self.toolpath + sys.path
@@ -127,15 +137,16 @@ class Tool(object):
# Py 2 code
try:
try:
- file, path, desc = imp.find_module(self.name, self.toolpath)
+ file = None
try:
- return imp.load_module(self.name, file, path, desc)
-
+ mod, file = self._load_dotted_module_py2(self.name, self.name, self.toolpath)
+ return mod
finally:
if file:
file.close()
except ImportError as e:
- if str(e)!="No module named %s"%self.name:
+ splitname = self.name.split('.')
+ if str(e)!="No module named %s"%splitname[0]:
raise SCons.Errors.EnvironmentError(e)
try:
import zipimport
@@ -169,8 +180,9 @@ class Tool(object):
found_name = self.name
add_to_scons_tools_namespace = False
for path in self.toolpath:
- file_path = os.path.join(path, "%s.py"%self.name)
- file_package = os.path.join(path, self.name)
+ sepname = self.name.replace('.', os.path.sep)
+ file_path = os.path.join(path, "%s.py"%sepname)
+ file_package = os.path.join(path, sepname)
if debug: sys.stderr.write("Trying:%s %s\n"%(file_path, file_package))
@@ -179,6 +191,7 @@ class Tool(object):
if debug: print("file_Path:%s FOUND"%file_path)
break
elif os.path.isdir(file_package):
+ file_package = os.path.join(file_package, '__init__.py')
spec = importlib.util.spec_from_file_location(self.name, file_package)
if debug: print("PACKAGE:%s Found"%file_package)
break
@@ -231,8 +244,7 @@ class Tool(object):
try:
smpath = sys.modules['SCons.Tool'].__path__
try:
- file, path, desc = imp.find_module(self.name, smpath)
- module = imp.load_module(full_name, file, path, desc)
+ module, file = self._load_dotted_module_py2(self.name, full_name, smpath)
setattr(SCons.Tool, self.name, module)
if file:
file.close()
diff --git a/src/engine/SCons/Tool/dmd.py b/src/engine/SCons/Tool/dmd.py
index 64beea5..7c142eb 100644
--- a/src/engine/SCons/Tool/dmd.py
+++ b/src/engine/SCons/Tool/dmd.py
@@ -75,7 +75,7 @@ def generate(env):
static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter)
shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter)
- env['DC'] = env.Detect(['dmd', 'gdmd'])
+ env['DC'] = env.Detect(['dmd', 'ldmd2', 'gdmd']) or 'dmd'
env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of$TARGET $SOURCES'
env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}'
@@ -129,7 +129,7 @@ def generate(env):
# __RPATH is set to $_RPATH in the platform specification if that
# platform supports it.
- env['DRPATHPREFIX'] = '-L-rpath='
+ env['DRPATHPREFIX'] = '-L-rpath,' if env['PLATFORM'] == 'darwin' else '-L-rpath='
env['DRPATHSUFFIX'] = ''
env['_DRPATH'] = '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}'
@@ -144,8 +144,6 @@ def generate(env):
env['DSHLIBVERSION'] = '$SHLIBVERSION'
env['DSHLIBVERSIONFLAGS'] = []
- SCons.Tool.createStaticLibBuilder(env)
-
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -of$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
emitter=DCommon.allAtOnceEmitter,
diff --git a/src/engine/SCons/Tool/gdc.py b/src/engine/SCons/Tool/gdc.py
index fdfe867..a8e037c 100644
--- a/src/engine/SCons/Tool/gdc.py
+++ b/src/engine/SCons/Tool/gdc.py
@@ -65,7 +65,7 @@ def generate(env):
static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter)
shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter)
- env['DC'] = env.Detect('gdc')
+ env['DC'] = env.Detect('gdc') or 'gdc'
env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -o $TARGET $SOURCES'
env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}'
@@ -128,8 +128,6 @@ def generate(env):
env['DSHLIBVERSION'] = '$SHLIBVERSION'
env['DSHLIBVERSIONFLAGS'] = '$SHLIBVERSIONFLAGS'
- SCons.Tool.createStaticLibBuilder(env)
-
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -o $TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
emitter=DCommon.allAtOnceEmitter,
diff --git a/src/engine/SCons/Tool/ldc.py b/src/engine/SCons/Tool/ldc.py
index 215c3e7..b10bb75 100644
--- a/src/engine/SCons/Tool/ldc.py
+++ b/src/engine/SCons/Tool/ldc.py
@@ -70,7 +70,7 @@ def generate(env):
static_obj.add_emitter('.d', SCons.Defaults.StaticObjectEmitter)
shared_obj.add_emitter('.d', SCons.Defaults.SharedObjectEmitter)
- env['DC'] = env.Detect('ldc2')
+ env['DC'] = env.Detect('ldc2') or 'ldc2'
env['DCOM'] = '$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -c -of=$TARGET $SOURCES'
env['_DINCFLAGS'] = '${_concat(DINCPREFIX, DPATH, DINCSUFFIX, __env__, RDirs, TARGET, SOURCE)}'
env['_DVERFLAGS'] = '${_concat(DVERPREFIX, DVERSIONS, DVERSUFFIX, __env__)}'
@@ -105,13 +105,7 @@ def generate(env):
env['DSHLINK'] = '$DC'
env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=phobos2-ldc')
- #### START DEPRECATION 2017-05-21
- # Hack for Fedora the packages of which use the wrong name :-(
- if os.path.exists('/usr/lib64/libphobos-ldc.so') or os.path.exists('/usr/lib32/libphobos-ldc.so') or os.path.exists('/usr/lib/libphobos-ldc.so'):
- env['DSHLINKFLAGS'] = SCons.Util.CLVar('$DLINKFLAGS -shared -defaultlib=phobos-ldc')
- #### END DEPRECATION 2017-05-21
-
- env['SHDLINKCOM'] = '$DLINK -of=$TARGET $DSHLINKFLAGS $__DSHLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS'
+ env['SHDLINKCOM'] = '$DLINK -of=$TARGET $DSHLINKFLAGS $__DSHLIBVERSIONFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS -L-ldruntime-ldc'
env['DLIBLINKPREFIX'] = '' if env['PLATFORM'] == 'win32' else '-L-l'
env['DLIBLINKSUFFIX'] = '.lib' if env['PLATFORM'] == 'win32' else ''
@@ -132,7 +126,7 @@ def generate(env):
# __RPATH is set to $_RPATH in the platform specification if that
# platform supports it.
- env['DRPATHPREFIX'] = '-L-rpath='
+ env['DRPATHPREFIX'] = '-L-Wl,-rpath,' if env['PLATFORM'] == 'darwin' else '-L-rpath='
env['DRPATHSUFFIX'] = ''
env['_DRPATH'] = '${_concat(DRPATHPREFIX, RPATH, DRPATHSUFFIX, __env__)}'
@@ -147,8 +141,6 @@ def generate(env):
env['DSHLIBVERSION'] = '$SHLIBVERSION'
env['DSHLIBVERSIONFLAGS'] = []
- SCons.Tool.createStaticLibBuilder(env)
-
env['BUILDERS']['ProgramAllAtOnce'] = SCons.Builder.Builder(
action='$DC $_DINCFLAGS $_DVERFLAGS $_DDEBUGFLAGS $_DFLAGS -of=$TARGET $DLINKFLAGS $__DRPATH $SOURCES $_DLIBDIRFLAGS $_DLIBFLAGS',
emitter=DCommon.allAtOnceEmitter,