[PATCH] setup: print subprocess stderr if there is any

Mads Kiilerich mads at kiilerich.com
Sat Nov 10 14:12:04 CST 2012


Bryan O'Sullivan wrote, On 11/10/2012 01:06 AM:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1352505972 28800
> # Node ID 123560a9b0f5b45858feb54d95ee5d6da5730783
> # Parent  fb14a5dcdc62987512820531fe60719d650491b6
> setup: print subprocess stderr if there is any
>
> I just spent 1.5 days trying to debug a failing buildbot because
> setup.py was silently dropping the errors that were being printed
> by in-place hg.
>
> diff --git a/setup.py b/setup.py
> --- a/setup.py
> +++ b/setup.py
> @@ -151,6 +151,8 @@ def runhg(cmd, env):
>              if not e.startswith(b('Not trusting file')) \
>                 and not e.startswith(b('warning: Not importing'))]
>       if err:
> +        print >> sys.stderr, 'stderr from %r:' % (' '.join(cmd))

We should avoid using %r for paths. Some windows users will be confused 
when they see their path element separators doubled.

We should perhaps make it a general rule to use '%s'  instead of %r in 
user facing messages. It is nice that the repr encoding is unambiguous, 
but it is also leaking an implementation detail and quite hard to parse 
correctly without Python eval, especially when it automagically chooses 
' or ". One goal metric could be to reduce the number of %r in i18n/hg.pot.

/Mads


More information about the Mercurial-devel mailing list