summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Managan <ramanagan@att.net>2013-05-30 18:04:35 (GMT)
committerRob Managan <ramanagan@att.net>2013-05-30 18:04:35 (GMT)
commit64277cb37bfe6430a4b13bf78c42678e795210aa (patch)
treef540880be4a6fdf10ed5dc60c3e58e9eedd30552
parent320244104f2de73a758b0644d12185981c111582 (diff)
downloadSCons-64277cb37bfe6430a4b13bf78c42678e795210aa.zip
SCons-64277cb37bfe6430a4b13bf78c42678e795210aa.tar.gz
SCons-64277cb37bfe6430a4b13bf78c42678e795210aa.tar.bz2
Add code to delete any current symlink before trying to crete them. Before the step of creating the symlink would fail.
Also update the code in install.py to create the same chain of links as __init__.py did. The installed links to the shared library all pointed at the shared library instead of to the next one in the chain with more version numbers
-rw-r--r--src/engine/SCons/Tool/__init__.py18
-rw-r--r--src/engine/SCons/Tool/install.py36
2 files changed, 45 insertions, 9 deletions
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 89aabb5..d76b721 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -337,15 +337,23 @@ symlinks for the platform we are on"""
for count in range(len(linknames)):
linkname = linknames[count]
if count > 0:
- os.symlink(os.path.basename(linkname),lastname)
+ try:
+ os.remove(lastlinkname)
+ except:
+ pass
+ os.symlink(os.path.basename(linkname),lastlinkname)
if Verbose:
- print "VerShLib: made sym link of %s -> %s" % (lastname,linkname)
- lastname = linkname
+ print "VerShLib: made sym link of %s -> %s" % (lastlinkname,linkname)
+ lastlinkname = linkname
# finish chain of sym links with link to the actual library
if len(linknames)>0:
- os.symlink(lib_ver,lastname)
+ try:
+ os.remove(lastlinkname)
+ except:
+ pass
+ os.symlink(lib_ver,lastlinkname)
if Verbose:
- print "VerShLib: made sym link of %s -> %s" % (lib_ver,linkname)
+ print "VerShLib: made sym link of %s -> %s" % (linkname, lib_ver)
return result
ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None)
diff --git a/src/engine/SCons/Tool/install.py b/src/engine/SCons/Tool/install.py
index 9aa9d46..100743a 100644
--- a/src/engine/SCons/Tool/install.py
+++ b/src/engine/SCons/Tool/install.py
@@ -133,6 +133,11 @@ def copyFuncVersionedLib(dest, source, env):
if os.path.isdir(source):
raise SCons.Errors.UserError("cannot install directory `%s' as a version library" % str(source) )
else:
+ # remove the link if it is already there
+ try:
+ os.remove(dest)
+ except:
+ pass
shutil.copy2(source, dest)
st = os.stat(source)
os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
@@ -196,11 +201,34 @@ def versionedLibLinks(dest, source, env):
if version != None:
# libname includes the version number if one was given
linknames = SCons.Tool.VersionShLibLinkNames(version,libname,env)
- for linkname in linknames:
- if Verbose:
- print "make link of %s to %s" %(libname, os.path.join(install_dir, linkname))
+ if Verbose:
+ print "versionedLibLinks: linknames ",linknames
+ # Here we just need the file name w/o path as the target of the link
+ lib_ver = libname
+ # make symlink of adjacent names in linknames
+ for count in range(len(linknames)):
+ linkname = linknames[count]
fulllinkname = os.path.join(install_dir, linkname)
- os.symlink(libname,fulllinkname)
+ if Verbose:
+ print "full link name ",fulllinkname
+ if count > 0:
+ try:
+ os.remove(lastlinkname)
+ except:
+ pass
+ os.symlink(os.path.basename(fulllinkname),lastlinkname)
+ if Verbose:
+ print "versionedLibLinks: made sym link of %s -> %s" % (lastlinkname,os.path.basename(fulllinkname))
+ lastlinkname = fulllinkname
+ # finish chain of sym links with link to the actual library
+ if len(linknames)>0:
+ try:
+ os.remove(lastlinkname)
+ except:
+ pass
+ os.symlink(lib_ver,lastlinkname)
+ if Verbose:
+ print "versionedLibLinks: made sym link of %s -> %s" % (lib_ver,lastlinkname)
return
def installFunc(target, source, env):