mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [ptxdist] [PATCH v3] configure_helper.py: be more verbose when calling ptxdist fails
Date: Thu, 17 Oct 2019 10:41:21 +0200	[thread overview]
Message-ID: <20191017084121.5278-1-rhi@pengutronix.de> (raw)
In-Reply-To: <20190911075048.8125-1-rhi@pengutronix.de>

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 <rhi@pengutronix.de>
---
 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
ptxdist@pengutronix.de

      parent reply	other threads:[~2019-10-17  8:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-11  7:50 [ptxdist] [PATCH] configure_helper.py: check for emptyish ptxdist environment variables Roland Hieber
2019-09-23  8:46 ` Roland Hieber
2019-09-25 13:13 ` [ptxdist] [PATCH v2] " Roland Hieber
2019-10-16 10:53   ` Roland Hieber
2019-10-16 11:38     ` Michael Olbrich
2019-10-16 11:58       ` Roland Hieber
2019-10-16 13:26         ` Michael Olbrich
2019-10-17  8:24           ` Roland Hieber
2019-10-17  8:41 ` Roland Hieber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191017084121.5278-1-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox