summaryrefslogtreecommitdiff
path: root/engine/SCons/Tool/cyglink.py
diff options
context:
space:
mode:
Diffstat (limited to 'engine/SCons/Tool/cyglink.py')
-rw-r--r--engine/SCons/Tool/cyglink.py50
1 files changed, 27 insertions, 23 deletions
diff --git a/engine/SCons/Tool/cyglink.py b/engine/SCons/Tool/cyglink.py
index 921f0eb..f69b886 100644
--- a/engine/SCons/Tool/cyglink.py
+++ b/engine/SCons/Tool/cyglink.py
@@ -7,6 +7,9 @@ It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
+
+from __future__ import absolute_import, print_function
+
import re
import os
@@ -14,12 +17,13 @@ import SCons.Action
import SCons.Util
import SCons.Tool
-import gnulink
-import link
+#MAYBE: from . import gnulink
+from . import gnulink
+from . import link
def _lib_generator(target, source, env, for_signature, **kw):
try: cmd = kw['cmd']
- except KeyError: cmd = SCons.Util.CLVar(['$SHLINK'])
+ except KeyError: cmd = SCons.Util.CLVar(['$SHLINK'])
try: vp = kw['varprefix']
except KeyError: vp = 'SHLIB'
@@ -40,7 +44,7 @@ def _lib_generator(target, source, env, for_signature, **kw):
])
else:
cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS'])
-
+
return [cmd]
@@ -58,37 +62,37 @@ 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" % target[0].get_path())
try: vp = kw['varprefix']
except KeyError: vp = 'SHLIB'
try: libtype = kw['libtype']
except KeyError: libtype = 'ShLib'
-
+
dll = env.FindIxes(target, '%sPREFIX' % vp, '%sSUFFIX' % vp)
no_import_lib = env.get('no_import_lib', 0)
if Verbose:
- print "_lib_emitter: dll=%r" % dll.get_path()
+ print("_lib_emitter: dll=%r" % dll.get_path())
if not dll or len(target) > 1:
raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$%sSUFFIX" % vp))
-
+
# Remove any "lib" after the prefix
pre = env.subst('$%sPREFIX' % vp)
if dll.name[len(pre):len(pre)+3] == 'lib':
dll.name = pre + dll.name[len(pre)+3:]
if Verbose:
- print "_lib_emitter: dll.name=%r" % dll.name
+ print("_lib_emitter: dll.name=%r" % dll.name)
orig_target = target
target = [env.fs.File(dll)]
target[0].attributes.shared = 1
if Verbose:
- print "_lib_emitter: after target=[env.fs.File(dll)]: target[0]=%r" % target[0].get_path()
+ print("_lib_emitter: after target=[env.fs.File(dll)]: target[0]=%r" % target[0].get_path())
# Append an import lib target
if not no_import_lib:
@@ -97,11 +101,11 @@ def _lib_emitter(target, source, env, **kw):
'%sPREFIX' % vp, '%sSUFFIX' % vp,
'IMPLIBPREFIX', 'IMPLIBSUFFIX')
if Verbose:
- print "_lib_emitter: target_strings=%r" % target_strings
-
+ print("_lib_emitter: target_strings=%r" % target_strings)
+
implib_target = env.fs.File(target_strings)
if Verbose:
- print "_lib_emitter: implib_target=%r" % implib_target.get_path()
+ print("_lib_emitter: implib_target=%r" % implib_target.get_path())
implib_target.attributes.shared = 1
target.append(implib_target)
@@ -109,7 +113,7 @@ def _lib_emitter(target, source, env, **kw):
implib_libtype=libtype,
generator_libtype=libtype+'ImpLib')
if Verbose:
- print "_lib_emitter: implib symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks)
+ print("_lib_emitter: implib symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks))
if symlinks:
SCons.Tool.EmitLibSymlinks(env, symlinks, implib_target, clean_targets = target[0])
implib_target.attributes.shliblinks = symlinks
@@ -121,19 +125,19 @@ def shlib_emitter(target, source, env):
def ldmod_emitter(target, source, env):
return _lib_emitter(target, source, env, varprefix='LDMODULE', libtype='LdMod')
-
+
def _versioned_lib_suffix(env, suffix, version):
"""Generate versioned shared library suffix from a unversioned one.
If suffix='.dll', and version='0.1.2', then it returns '-0-1-2.dll'"""
Verbose = False
if Verbose:
- print "_versioned_lib_suffix: suffix= ", suffix
- print "_versioned_lib_suffix: version= ", version
+ print("_versioned_lib_suffix: suffix= ", suffix)
+ print("_versioned_lib_suffix: version= ", version)
cygversion = re.sub('\.', '-', version)
if not suffix.startswith('-' + cygversion):
suffix = '-' + cygversion + suffix
if Verbose:
- print "_versioned_lib_suffix: return suffix= ", suffix
+ print("_versioned_lib_suffix: return suffix= ", suffix)
return suffix
def _versioned_implib_name(env, libnode, version, prefix, suffix, **kw):
@@ -149,8 +153,8 @@ def _versioned_implib_symlinks(env, libnode, version, prefix, suffix, **kw):
Verbose = False
if Verbose:
- print "_versioned_implib_symlinks: libnode=%r" % libnode.get_path()
- print "_versioned_implib_symlinks: version=%r" % version
+ print("_versioned_implib_symlinks: libnode=%r" % libnode.get_path())
+ print("_versioned_implib_symlinks: version=%r" % version)
try: libtype = kw['libtype']
except KeyError: libtype = 'ShLib'
@@ -158,13 +162,13 @@ def _versioned_implib_symlinks(env, libnode, version, prefix, suffix, **kw):
linkdir = os.path.dirname(libnode.get_path())
if Verbose:
- print "_versioned_implib_symlinks: linkdir=%r" % linkdir
+ print("_versioned_implib_symlinks: linkdir=%r" % linkdir)
name = SCons.Tool.ImpLibNameGenerator(env, libnode,
implib_libtype=libtype,
generator_libtype=libtype+'ImpLib')
if Verbose:
- print "_versioned_implib_symlinks: name=%r" % name
+ print("_versioned_implib_symlinks: name=%r" % name)
major = version.split('.')[0]
@@ -172,7 +176,7 @@ def _versioned_implib_symlinks(env, libnode, version, prefix, suffix, **kw):
symlinks = [(link0, libnode)]
if Verbose:
- print "_versioned_implib_symlinks: return symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks)
+ print("_versioned_implib_symlinks: return symlinks=%r" % SCons.Tool.StringizeLibSymlinks(symlinks))
return symlinks