doc: explain partially supported features for ice PMD
[dpdk.git] / buildtools / gen-pmdinfo-cfile.py
index c60ecd7..5fbd516 100644 (file)
@@ -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)