X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=buildtools%2Fgen-pmdinfo-cfile.py;h=5fbd51658a282bbb0ed0074b2d1c76fb7b060161;hb=b232b2aa212be9a7f127ad368c40faf28989f678;hp=c60ecd7f6a377a9ab37bba7fad36e0e3574bc20a;hpb=a38eae8efae8a729c39b1dc85cab0325b27062b3;p=dpdk.git diff --git a/buildtools/gen-pmdinfo-cfile.py b/buildtools/gen-pmdinfo-cfile.py index c60ecd7f6a..5fbd51658a 100644 --- a/buildtools/gen-pmdinfo-cfile.py +++ b/buildtools/gen-pmdinfo-cfile.py @@ -7,13 +7,15 @@ import subprocess import sys import tempfile -_, ar, archive, output, *pmdinfogen = sys.argv -with tempfile.TemporaryDirectory() as temp: - proc = subprocess.run( - # Don't use "ar p", because its output is corrupted on Windows. - [ar, "xv", os.path.abspath(archive)], stdout=subprocess.PIPE, check=True, cwd=temp - ) - lines = proc.stdout.decode().splitlines() - names = [line[len("x - ") :] for line in lines] - paths = [os.path.join(temp, name) for name in names] +_, tmp_root, ar, archive, output, *pmdinfogen = sys.argv +with tempfile.TemporaryDirectory(dir=tmp_root) as temp: + paths = [] + for name in subprocess.run([ar, "t", archive], stdout=subprocess.PIPE, + check=True).stdout.decode().splitlines(): + if os.path.exists(name): + paths.append(name) + else: + subprocess.run([ar, "x", os.path.abspath(archive), name], + check=True, cwd=temp) + paths.append(os.path.join(temp, name)) subprocess.run(pmdinfogen + paths + [output], check=True)