Commit 735e9566 authored by Marcel Huber's avatar Marcel Huber
Browse files

reformatted code

parent 9f4ac242
......@@ -200,17 +200,18 @@ try:
from SCons.Tool import EmitLibSymlinks
except:
from SCons.Util import is_List
# copied over from scons 2.4.1
def EmitLibSymlinks(env, symlinks, libnode, **kw):
"""Used by emitters to handle (shared/versioned) library symlinks"""
nodes = list(set([ x for x,_ in symlinks ] + [libnode]))
"""Used by emitters to handle (shared/versioned) library symlinks."""
nodes = list(set([x for x, _ in symlinks] + [libnode]))
clean_targets = kw.get('clean_targets', [])
if not is_List(clean_targets):
clean_targets = [ clean_targets ]
clean_targets = [clean_targets]
for link, linktgt in symlinks:
env.SideEffect(link, linktgt)
clean_list = filter(lambda x : x != linktgt, nodes)
clean_list = filter(lambda x: x != linktgt, nodes)
env.Clean(list(set([linktgt] + clean_targets)), clean_list)
......@@ -218,15 +219,15 @@ except:
# and SCons.Tool.install.versionedLibVersion as of scons 2.3.6
# adapted to accept non-patch versions too
def versionedLibVersion(dest, source, env):
if (hasattr(source[0], 'attributes') and
hasattr(source[0].attributes, 'shlibname')):
if (hasattr(source[0], 'attributes') and hasattr(source[0].attributes, 'shlibname')):
libname = source[0].attributes.shlibname
else:
libname = os.path.basename(str(dest))
shlib_suffix = env.subst('$SHLIBSUFFIX')
version_pattern = r'(?P<version>(?P<major>[0-9]+)\.(?P<minor>[0-9]+)(\.?(?P<patch>[0-9a-zA-Z]+))?)'
version = None
versioned_re = re.compile(r'(?P<libname>.*)(?P<suffix>' + re.escape(shlib_suffix) + r')\.' + version_pattern)
versioned_re = re.compile(r'(?P<libname>.*)(?P<suffix>' + re.escape(shlib_suffix) + r')\.' +
version_pattern)
result = versioned_re.search(libname)
linknames = []
if result:
......@@ -234,11 +235,12 @@ def versionedLibVersion(dest, source, env):
if version and version.count(".") >= 1:
# For libfoo.so.x.y.z, linknames libfoo.so libfoo.so.x.y libfoo.so.x
# First linkname has no version number
linkname = result.group('libname')+result.group('suffix')
linkname = result.group('libname') + result.group('suffix')
linknames.append(linkname)
major_name = linkname + "." + result.group('major')
for linkname in [major_name, ]:
for linkname in [
major_name,
]:
linknames.append(linkname)
return (version, linknames)
......@@ -335,8 +335,8 @@ Original exception message:
dep_targets = deps.get(fulltargetname, callerdeps.get(fulltargetname, None))
if dep_targets is None and ext is not None:
callerdeps.get('pending', []).extend([fulltargetname])
dep_targets = self.getPackageTargetDependencies(
*self.splitFulltargetname(fulltargetname), callerdeps=callerdeps)
dep_targets = self.getPackageTargetDependencies(*self.splitFulltargetname(fulltargetname),
callerdeps=callerdeps)
callerdeps.get('pending', []).remove(fulltargetname)
if dep_targets is not None:
callerdeps.setdefault(fulltargetname, dep_targets)
......
......@@ -62,6 +62,7 @@ def real_lib_path(env, target):
node = env.File(os.path.realpath(node.get_abspath()))
return node
def installSystemLibs(source):
"""This function is called during the build phase and adds targets
dynamically to the dependency tree."""
......@@ -94,7 +95,7 @@ def installSystemLibs(source):
for libnode in deplibs:
real_libnode = real_lib_path(env, libnode)
# tag file node as shared library
real_libnode, _ = SharedObjectEmitter([real_libnode],None,None)
real_libnode, _ = SharedObjectEmitter([real_libnode], None, None)
real_libnode = real_libnode[0]
node_name = real_libnode.name
target = []
......
......@@ -255,12 +255,14 @@ def generate(env):
PrecompLibAction = SCons.Action.Action(wrapPrecompLibAction,
"Installing precompiled library '$SOURCE' as '$TARGET'")
PrecompLibBuilder = SCons.Builder.Builder(
action=[PrecompLibAction],
emitter=[precompLibNamesEmitter, SCons.Defaults.SharedObjectEmitter, install.add_versioned_targets_to_INSTALLED_FILES],
multi=0,
source_factory=env.fs.Entry,
single_source=True)
PrecompLibBuilder = SCons.Builder.Builder(action=[PrecompLibAction],
emitter=[
precompLibNamesEmitter, SCons.Defaults.SharedObjectEmitter,
install.add_versioned_targets_to_INSTALLED_FILES
],
multi=0,
source_factory=env.fs.Entry,
single_source=True)
env.Append(BUILDERS={'PrecompiledLibraryInstallBuilder': PrecompLibBuilder})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment