summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/link.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-03 06:25:00 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2017-10-03 06:25:00 +0200
commitd4ed069896a9d49eb33966a0f871e39b5c24da8a (patch)
tree1c923e288e1641b8a08a71891e3ee5ea1e4dfde5 /engine/SCons/Tool/link.py
parent3765e33b76c51c81dd7bbbfacab0c4e76a1713cb (diff)
parent13e92f02338ad8d28d58fcd7c9f46d0d5e970e54 (diff)
Merge branch 'release/3.0.0-1'3.0.0-1
Diffstat (limited to 'engine/SCons/Tool/link.py')
-rw-r--r--engine/SCons/Tool/link.py70
1 files changed, 38 insertions, 32 deletions
diff --git a/engine/SCons/Tool/link.py b/engine/SCons/Tool/link.py
index 720a66c..e8c11ed 100644
--- a/engine/SCons/Tool/link.py
+++ b/engine/SCons/Tool/link.py
@@ -1,3 +1,4 @@
+
"""SCons.Tool.link
Tool-specific initialization for the generic Posix linker.
@@ -9,7 +10,7 @@ selection method.
"""
#
-# Copyright (c) 2001 - 2016 The SCons Foundation
+# Copyright (c) 2001 - 2017 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -30,8 +31,9 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
+from __future__ import print_function
-__revision__ = "src/engine/SCons/Tool/link.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
+__revision__ = "src/engine/SCons/Tool/link.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
import sys
import re
@@ -45,7 +47,9 @@ from SCons.Tool.FortranCommon import isfortran
from SCons.Tool.DCommon import isD
-cplusplus = __import__('c++', globals(), locals(), [])
+import SCons.Tool.cxx
+cplusplus = SCons.Tool.cxx
+# cplusplus = __import__(__package__+'.cxx', globals(), locals(), ['*'])
issued_mixed_link_warning = False
@@ -76,20 +80,20 @@ def smart_link(source, target, env, for_signature):
def _lib_emitter(target, source, env, **kw):
Verbose = False
if Verbose:
- print "_lib_emitter: target[0]=%r" % target[0].get_path()
+ print("_lib_emitter: target[0]={:r}".format(target[0].get_path()))
for tgt in target:
tgt.attributes.shared = 1
-
+
try:
symlink_generator = kw['symlink_generator']
except KeyError:
pass
else:
if Verbose:
- print "_lib_emitter: symlink_generator=%r" % symlink_generator
+ print("_lib_emitter: symlink_generator={:r}".format(symlink_generator))
symlinks = symlink_generator(env, target[0])
if Verbose:
- print "_lib_emitter: symlinks=%r" % symlinks
+ print("_lib_emitter: symlinks={:r}".format(symlinks))
if symlinks:
SCons.Tool.EmitLibSymlinks(env, symlinks, target[0])
@@ -108,28 +112,28 @@ def _versioned_lib_name(env, libnode, version, prefix, suffix, prefix_generator,
Verbose = False
if Verbose:
- print "_versioned_lib_name: libnode=%r" % libnode.get_path()
- print "_versioned_lib_name: version=%r" % version
- print "_versioned_lib_name: prefix=%r" % prefix
- print "_versioned_lib_name: suffix=%r" % suffix
- print "_versioned_lib_name: suffix_generator=%r" % suffix_generator
+ print("_versioned_lib_name: libnode={:r}".format(libnode.get_path()))
+ print("_versioned_lib_name: version={:r}".format(version))
+ print("_versioned_lib_name: prefix={:r}".format(prefix))
+ print("_versioned_lib_name: suffix={:r}".format(suffix))
+ print("_versioned_lib_name: suffix_generator={:r}".format(suffix_generator))
versioned_name = os.path.basename(libnode.get_path())
if Verbose:
- print "_versioned_lib_name: versioned_name=%r" % versioned_name
+ print("_versioned_lib_name: versioned_name={:r}".format(versioned_name))
versioned_prefix = prefix_generator(env, **kw)
versioned_suffix = suffix_generator(env, **kw)
if Verbose:
- print "_versioned_lib_name: versioned_prefix=%r" % versioned_prefix
- print "_versioned_lib_name: versioned_suffix=%r" % versioned_suffix
+ print("_versioned_lib_name: versioned_prefix={:r}".format(versioned_prefix))
+ print("_versioned_lib_name: versioned_suffix={:r}".format(versioned_suffix))
versioned_prefix_re = '^' + re.escape(versioned_prefix)
versioned_suffix_re = re.escape(versioned_suffix) + '$'
name = re.sub(versioned_prefix_re, prefix, versioned_name)
name = re.sub(versioned_suffix_re, suffix, name)
if Verbose:
- print "_versioned_lib_name: name=%r" % name
+ print("_versioned_lib_name: name={:r}".format(name))
return name
def _versioned_shlib_name(env, libnode, version, prefix, suffix, **kw):
@@ -146,33 +150,33 @@ def _versioned_lib_suffix(env, suffix, version):
"""For suffix='.so' and version='0.1.2' it returns '.so.0.1.2'"""
Verbose = False
if Verbose:
- print "_versioned_lib_suffix: suffix=%r" % suffix
- print "_versioned_lib_suffix: version=%r" % version
+ print("_versioned_lib_suffix: suffix={:r}".format(suffix))
+ print("_versioned_lib_suffix: version={:r}".format(version))
if not suffix.endswith(version):
suffix = suffix + '.' + version
if Verbose:
- print "_versioned_lib_suffix: return suffix=%r" % suffix
+ print("_versioned_lib_suffix: return suffix={:r}".format(suffix))
return suffix
def _versioned_lib_soname(env, libnode, version, prefix, suffix, name_func):
"""For libnode='/optional/dir/libfoo.so.X.Y.Z' it returns 'libfoo.so.X'"""
Verbose = False
if Verbose:
- print "_versioned_lib_soname: version=%r" % version
+ print("_versioned_lib_soname: version={:r}".format(version))
name = name_func(env, libnode, version, prefix, suffix)
if Verbose:
- print "_versioned_lib_soname: name=%r" % name
+ print("_versioned_lib_soname: name={:r}".format(name))
major = version.split('.')[0]
soname = name + '.' + major
if Verbose:
- print "_versioned_lib_soname: soname=%r" % soname
+ print("_versioned_lib_soname: soname={:r}".format(soname))
return soname
def _versioned_shlib_soname(env, libnode, version, prefix, suffix):
- return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_shlib_name)
+ return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_shlib_name)
def _versioned_ldmod_soname(env, libnode, version, prefix, suffix):
- return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_ldmod_name)
+ return _versioned_lib_soname(env, libnode, version, prefix, suffix, _versioned_ldmod_name)
def _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, soname_func):
"""Generate link names that should be created for a versioned shared lirbrary.
@@ -181,23 +185,23 @@ def _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, so
Verbose = False
if Verbose:
- print "_versioned_lib_symlinks: libnode=%r" % libnode.get_path()
- print "_versioned_lib_symlinks: version=%r" % version
+ print("_versioned_lib_symlinks: libnode={:r}".format(libnode.get_path()))
+ print("_versioned_lib_symlinks: version={:r}".format(version))
if sys.platform.startswith('openbsd'):
# OpenBSD uses x.y shared library versioning numbering convention
# and doesn't use symlinks to backwards-compatible libraries
if Verbose:
- print "_versioned_lib_symlinks: return symlinks=%r" % None
+ print("_versioned_lib_symlinks: return symlinks={:r}".format(None))
return None
linkdir = libnode.get_dir()
if Verbose:
- print "_versioned_lib_symlinks: linkdir=%r" % linkdir.get_path()
+ print("_versioned_lib_symlinks: linkdir={:r}".format(linkdir.get_path()))
name = name_func(env, libnode, version, prefix, suffix)
if Verbose:
- print "_versioned_lib_symlinks: name=%r" % name
+ print("_versioned_lib_symlinks: name={:r}".format(name))
soname = soname_func(env, libnode, version, prefix, suffix)
@@ -213,7 +217,7 @@ def _versioned_lib_symlinks(env, libnode, version, prefix, suffix, name_func, so
symlinks = [ (link0, libnode), (link1, libnode) ]
if Verbose:
- print "_versioned_lib_symlinks: return symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks)
+ print("_versioned_lib_symlinks: return symlinks={:r}".format(SCons.Tool.StringizeLibSymlinks(symlinks)))
return symlinks
@@ -239,15 +243,17 @@ def _versioned_lib_callbacks():
'VersionedLdModSoname' : _versioned_ldmod_soname,
}.copy()
-# Setup all variables required by the versioning machinery
def _setup_versioned_lib_variables(env, **kw):
+ """
+ Setup all variables required by the versioning machinery
+ """
tool = None
try: tool = kw['tool']
except KeyError: pass
use_soname = False
- try: use_soname = kw['use_soname']
+ try: use_soname = kw['use_soname']
except KeyError: pass
# The $_SHLIBVERSIONFLAGS define extra commandline flags used when