setup.py --version is broken

Steve Borho steve at borho.org
Sat Dec 5 14:05:16 CST 2009


On Sat, Dec 5, 2009 at 12:26 PM, Steve Borho <steve at borho.org> wrote:
> On Sat, Dec 5, 2009 at 7:33 AM, Benoit Boissinot <bboissin at gmail.com> wrote:
>> On Sat, Dec 5, 2009 at 5:32 AM, Steve Borho <steve at borho.org> wrote:
>>> setup.py --version seems to be reporting 'hg tip' instead of 'hg id'.
>>> Or perhaps it's using a cached value because id reports a branch name
>>> now?  I don't have time to dig in tonight.
>>>
>>
>> Seems to work for me:
>>
>> tonfa at pirzuine:~/dev/mercurial/crew$ python setup.py --version
>> 1.4.1+25-54cd28258ea7
>> tonfa at pirzuine:~/dev/mercurial/crew$ hg shortlog -r .
>> 10014 54cd28258ea7 | 2009-11-30 23:51 +0100 | gilles: status: add the
>> --change option to display files changed in a revision
>> tonfa at pirzuine:~/dev/mercurial/crew$ hg up
>> 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
>> tonfa at pirzuine:~/dev/mercurial/crew$ python setup.py --version
>> 1.4.1+28-253d0da256b2
>> tonfa at pirzuine:~/dev/mercurial/crew$ hg shortlog -r .
>> 10017 253d0da256b2 | 2009-12-05 00:15 +0100 | mg: contrib: helper
>> extension to track memory usage
>
> This hack makes it work for me again:
>
> C:\thg-winbuild\build-hg>hg diff
> diff -r 2770d03ae49f setup.py
> --- a/setup.py  Thu Dec 03 11:06:55 2009 +0100
> +++ b/setup.py  Sat Dec 05 12:22:51 2009 -0600
> @@ -118,7 +118,7 @@
>     # includes the pure Python modules in mercurial/pure. We also take
>     # care to not use any hgrc files and do no localization.
>     pypath = ['mercurial', os.path.join('mercurial', 'pure')]
> -    env = {'PYTHONPATH': os.pathsep.join(pypath),
> +    env = {#'PYTHONPATH': os.pathsep.join(pypath),
>            'HGRCPATH': '',
>            'LANGUAGE': 'C'}
>     if 'LD_LIBRARY_PATH' in os.environ:
>
> The way it overrides PYTHONPATH like that, it can only ever work if
> you have done the equivalent of 'make local' in your repository.  This
> is not something that is commonly done on Windows.

Sorry, the workaround was correct but my analysis was bogus.  What
actually happens is the runcmd() function is returning an empty string
because python is outputting a warning to stderr:

err warning: Not importing directory 'C:\thg-winbuild\build-hg\mercurial\locale'
: missing __init__.py

This patch works around the problem as well, but it's not one that I
would recommend:

C:\thg-winbuild\build-hg>hg diff
diff -r 2770d03ae49f setup.py
--- a/setup.py  Thu Dec 03 11:06:55 2009 +0100
+++ b/setup.py  Sat Dec 05 14:03:34 2009 -0600
@@ -117,7 +117,7 @@
     # Execute hg out of this directory with a custom environment which
     # includes the pure Python modules in mercurial/pure. We also take
     # care to not use any hgrc files and do no localization.
-    pypath = ['mercurial', os.path.join('mercurial', 'pure')]
+    pypath = [os.path.join('mercurial', 'pure')]
     env = {'PYTHONPATH': os.pathsep.join(pypath),
            'HGRCPATH': '',
            'LANGUAGE': 'C'}

--
Steve Borho


More information about the Mercurial-devel mailing list