[PATCH] path information on --version

Michael Ellerman michael at ellerman.id.au
Mon May 29 01:09:25 BST 2006


On 5/28/06, Lalo Martins <lalo.martins at gmail.com> wrote:
> A few days ago, I had to debug a problem with two conflicting bzr installs
> on the same machine (native windows and cygwin).  So I suggested on #bzr
> that we should print paths to things like the python interpreter, the
> python standard library, and bzrlib, somewhere.  I suggested a new
> builtin, someone else (maybe myself) said on --version.  I also thought it
> would be optional, but Rob said there's no point, this should just be
> always output in --version.  So here it is, enjoy.
>
> === modified file 'bzrlib/builtins.py'
> --- bzrlib/builtins.py
> +++ bzrlib/builtins.py
> @@ -1858,6 +1858,18 @@
>          print "  nick: %s" % (branch.nick,)
>          if rh:
>              print "  revid: %s" % (rh[-1],)

A blank line here might be nice to visually separate the revid etc.
from the paths.

> +    print "Using python interpreter:", sys.executable
> +    import site
> +    print "Using python standard library:", os.path.dirname(site.__file__)
> +    print "Using bzrlib:",
> +    if len(bzrlib.__path__) > 1:
> +        # print repr, which is a good enough way of making it clear it's
> +        # more than one element (eg ['/foo/bar', '/foo/bzr'])
> +        print repr(bzrlib.__path__)
> +    else:
> +        print bzrlib.__path__[0]
> +
> +    print
>      print bzrlib.__copyright__
>      print "http://bazaar-vcs.org/"
>      print

Not sure why you need to check the length of the bzrlib.__path__,
wouldn't repr() work for all cases?

Otherwise +1 from me FWIW.

cheers




More information about the bazaar mailing list