[Python-apps-team] Bug#620087: mercurial: /usr/bin/hg prepends /usr/lib/python2.5/site-packages/ to sys.path

Javi Merino cibervicho at gmail.com
Wed Mar 30 07:39:22 UTC 2011


On 29/03/11 23:15, Stefano Rivera wrote:
> An Ubuntu developer ran into
> https://bugs.launchpad.net/bugs/45250
> 
> Resulting in a crash:
>> AttributeError: 'module' object has no attribute 'BufferedIOBase'
> http://paste.ubuntu.com/587028/
> 
> Turns out we have the same problem.
> 
> It's caused by the python2.5 install happening before the 2.6 one, and
> the 2.6 one doesn't replace the hg script from the 2.5 install. (It
> would if we supplied --force)
> 
> I think the best fix here is to disable the path mangling, either by not
> replacing @LIBDIR@ (hg sanity-checks for this) or by disabling the
> sys.path mangling code in hg.
> 
> Here's a patch for disabling it in setup.py:
> 
> --- old/setup.py
> +++ new/setup.py
> @@ -306,7 +306,10 @@ class hginstallscripts(install_scripts):
>  cmdclass = {'build_mo': hgbuildmo,
>              'build_ext': hgbuildext,
>              'build_py': hgbuildpy,
> -            'install_scripts': hginstallscripts}
> +# Disabled on Debian. We install into the public namespace and don't need
> +# to hack sys.path.
> +#            'install_scripts': hginstallscripts}
> +           }
>  
>  packages = ['mercurial', 'mercurial.hgweb', 'hgext', 'hgext.convert',
>              'hgext.highlight', 'hgext.zeroconf']

The patch should just replace the 'install_scripts' line with a line
with "}". Add the comments at the beginning of the patch file, and
please start the name of the patch with "deb_specific__".

> I intend to commit this and Team Upload within a day or two, but would
> obviously love a rejection / go-ahead / upload from one of the package's
> maintainers.

You can go ahead, yes. As Thomas pointed out, this should be a temporal
hack while it is fixed upstream. I won't have time in the following week
(I hope this doesn't break things horribly), but while this may work
now, it may break in the future if mercurial devs add more stuff to
hginstallscripts, so we should try to fix it upstream.

Cheers,
Javi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-apps-team/attachments/20110330/959a019a/attachment.pgp>


More information about the Python-apps-team mailing list