Leverage set() to find unique items
This commit is contained in:
parent
d8117c1813
commit
abf8d96adb
1 changed files with 12 additions and 32 deletions
|
@ -5,40 +5,20 @@ import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
sofiles = []
|
sofiles = []
|
||||||
|
|
||||||
for dir in sys.argv[2:]:
|
for dir in sys.argv[2:]:
|
||||||
|
|
||||||
for fn in os.listdir(dir):
|
for fn in os.listdir(dir):
|
||||||
|
if fn.endswith(".so"):
|
||||||
fn = os.path.join(dir, fn)
|
fn = os.path.join(dir, fn)
|
||||||
|
if os.path.exists(fn + ".o") and os.path.exists(fn + ".libs"):
|
||||||
if not fn.endswith(".so"):
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not os.path.exists(fn + ".o"):
|
|
||||||
continue
|
|
||||||
if not os.path.exists(fn + ".libs"):
|
|
||||||
continue
|
|
||||||
|
|
||||||
sofiles.append(fn)
|
sofiles.append(fn)
|
||||||
|
|
||||||
# The raw argument list.
|
args = [] # The raw argument list.
|
||||||
args = [ ]
|
|
||||||
|
|
||||||
for fn in sofiles:
|
for fn in sofiles:
|
||||||
afn = fn + ".o"
|
args.append(fn + ".o")
|
||||||
libsfn = fn + ".libs"
|
args.extend(open(fn + ".libs").read().split(" "))
|
||||||
|
|
||||||
args.append(afn)
|
unique_args = ' '.join(x for x in sorted(set(args)) if x.endswith('.so.o'))
|
||||||
args.extend(open(libsfn).read().split(" "))
|
|
||||||
|
|
||||||
unique_args = [ ]
|
|
||||||
|
|
||||||
while args:
|
|
||||||
a = args.pop()
|
|
||||||
if a not in unique_args:
|
|
||||||
unique_args.insert(0, a)
|
|
||||||
|
|
||||||
|
|
||||||
unique_args = ' '.join([ x for x in unique_args if x.endswith('.so.o') ])
|
|
||||||
print('Biglink create %s library' % sys.argv[1])
|
print('Biglink create %s library' % sys.argv[1])
|
||||||
subprocess.Popen(("ar -q %s " % sys.argv[1]) + unique_args, shell=True).communicate()
|
cmd = "ar -q %s %s" % (sys.argv[1], unique_args)
|
||||||
|
print(cmd)
|
||||||
|
subprocess.Popen(cmd, shell=True).communicate()
|
||||||
|
|
Loading…
Reference in a new issue