forked from mia/Aegisub
Add some logic to copy files as links if they're links, and resolve all links to the final destination file then copy that. This is just part of the solution. The final solution will be to remove all symbolic links and change all library references (to symbolic links) to their actual versioned filename. Updates #964
Originally committed to SVN as r3342.
This commit is contained in:
parent
4eba7657a2
commit
d8200c669e
1 changed files with 16 additions and 3 deletions
|
@ -4,6 +4,7 @@ import re
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import stat
|
||||||
|
|
||||||
is_bad_lib = re.compile(r'(/usr/local|/opt)').match
|
is_bad_lib = re.compile(r'(/usr/local|/opt)').match
|
||||||
is_sys_lib = re.compile(r'(/usr|/System)').match
|
is_sys_lib = re.compile(r'(/usr|/System)').match
|
||||||
|
@ -28,15 +29,27 @@ def collectlibs(lib, masterlist, targetdir):
|
||||||
sys.exit("Linking with library in blacklisted location: " + l)
|
sys.exit("Linking with library in blacklisted location: " + l)
|
||||||
if not is_sys_lib(l) and not l in masterlist:
|
if not is_sys_lib(l) and not l in masterlist:
|
||||||
locallist.append(l)
|
locallist.append(l)
|
||||||
print "found ", l,
|
print "found %s:" % l
|
||||||
shutil.copy(l, targetdir)
|
|
||||||
print " ...copied to target"
|
check = l
|
||||||
|
while check:
|
||||||
|
if os.path.isfile(check) and not os.path.islink(check):
|
||||||
|
os.system("cp '%s' '%s'" % (check, targetdir))
|
||||||
|
print " FILE %s ... copied to target" % check
|
||||||
|
break
|
||||||
|
|
||||||
|
if os.path.islink(check):
|
||||||
|
os.system("cp -fR '%s' '%s'" % (check, targetdir))
|
||||||
|
print " LINK %s ... copied to target" % check
|
||||||
|
check = os.path.dirname(check) + "/" + os.readlink(check)
|
||||||
|
|
||||||
elif not l in goodlist and not l in masterlist:
|
elif not l in goodlist and not l in masterlist:
|
||||||
goodlist.append(l)
|
goodlist.append(l)
|
||||||
masterlist.extend(locallist)
|
masterlist.extend(locallist)
|
||||||
for l in locallist:
|
for l in locallist:
|
||||||
collectlibs(l, masterlist, targetdir)
|
collectlibs(l, masterlist, targetdir)
|
||||||
|
|
||||||
|
exit;
|
||||||
binname = sys.argv[1]
|
binname = sys.argv[1]
|
||||||
targetdir = os.path.dirname(binname)
|
targetdir = os.path.dirname(binname)
|
||||||
print "Searching for libraries in ", binname, "..."
|
print "Searching for libraries in ", binname, "..."
|
||||||
|
|
Loading…
Reference in a new issue