For example, when one of the environment variables is empty, the
subprocess call only raises an unhelpful exception:

    PermissionError: [Errno 13] Permission denied: ''

At least print the called command line above the stacktrace to have some
more helpful information where to start looking.

Signed-off-by: Roland Hieber <[email protected]>
---
 scripts/configure_helper.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/scripts/configure_helper.py b/scripts/configure_helper.py
index c7b46f3b3846..bf2bf113b1f3 100755
--- a/scripts/configure_helper.py
+++ b/scripts/configure_helper.py
@@ -152,7 +152,7 @@ def abort(message):
 
 def ask_ptxdist(pkg):
        ptxdist = os.environ.get("PTXDIST", os.environ.get("ptxdist", 
"ptxdist"))
-       p = subprocess.Popen([ ptxdist, "-k", "make",
+       cmdline = [ ptxdist, "-k", "make",
                "/print-%s_DIR" % pkg,
                "/print-%s_SUBDIR" % pkg,
                "/print-%s_CONF_OPT" % pkg,
@@ -160,9 +160,14 @@ def ask_ptxdist(pkg):
                "/print-%s_CONF_TOOL" %pkg,
                "/print-CROSS_MESON_USR",
                "/print-CROSS_AUTOCONF_USR",
-               "/print-PTXDIST_SYSROOT_HOST"],
-               stdout=subprocess.PIPE,
-               universal_newlines=True)
+               "/print-PTXDIST_SYSROOT_HOST" ]
+       try:
+               p = subprocess.Popen(cmdline,
+                       stdout=subprocess.PIPE,
+                       universal_newlines=True)
+       except OSError as e:
+               print("Unable to execute ptxdist: ", cmdline)
+               raise
 
        d = p.stdout.readline().strip()
        subdir = p.stdout.readline().strip()
-- 
2.20.1


_______________________________________________
ptxdist mailing list
[email protected]

Reply via email to