X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=buildtools%2Fgen-pmdinfo-cfile.py;h=5fbd51658a282bbb0ed0074b2d1c76fb7b060161;hb=1835a22f342f23ae31e1fd778a997139ae4d2ca9;hp=58fe3ad152132300e251f480af1b258f94244d00;hpb=c85ebb39dbdd1b2696860858a10230dee8162929;p=dpdk.git diff --git a/buildtools/gen-pmdinfo-cfile.py b/buildtools/gen-pmdinfo-cfile.py index 58fe3ad152..5fbd51658a 100644 --- a/buildtools/gen-pmdinfo-cfile.py +++ b/buildtools/gen-pmdinfo-cfile.py @@ -9,12 +9,13 @@ import tempfile _, tmp_root, ar, archive, output, *pmdinfogen = sys.argv with tempfile.TemporaryDirectory(dir=tmp_root) as temp: - run_ar = lambda command: subprocess.run( - [ar, command, os.path.abspath(archive)], - stdout=subprocess.PIPE, check=True, cwd=temp - ) - # Don't use "ar p", because its output is corrupted on Windows. - run_ar("x") - names = run_ar("t").stdout.decode().splitlines() - paths = [os.path.join(temp, name) for name in names] + 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)