X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=buildtools%2Fgen-pmdinfo-cfile.py;h=5fbd51658a282bbb0ed0074b2d1c76fb7b060161;hb=082becbf1f35;hp=f1f289ffee1fc3f29a4c6ad0014b543564cf31d2;hpb=e6e9730c7066246856546563c0f5dcf5be10372d;p=dpdk.git diff --git a/buildtools/gen-pmdinfo-cfile.py b/buildtools/gen-pmdinfo-cfile.py index f1f289ffee..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)], capture_output=True, 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)