[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: detecting the right /usr/lib/python2.x in an upstream-compatible way



On Sun, Nov 26, 2006 at 02:31:06PM +0100, Thomas Viehmann wrote:
> Hi,
> 
> Matthias Klose filed a bug and patch against pyx because it had a
> hardcoded /usr/lib/python2.3. Thanks!
> The bugfix is to detect the python version and then use
> /usr/lib/python$(PYTHON_VERSION).
> While this is obviously correct for Debian, I'm wondering whether it
> would be better to use something like
>   $(python -c "import os.path, site ; print os.path.dirname(site.__file__)")
> in order be able to share with upstream who might want to cater for
> local python installations (pyx upstream has "import site; print
> site.here" in SVN but that doesn't work in python >= 2.4).

import sys
import os.path
print os.path.join(sys.prefix, 'lib', 'python'+sys.version[:3]) 

-- 
Alexandre Fayolle                              LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Informatique scientifique:               http://www.logilab.fr/science
Reprise et maintenance de sites CPS:     http://www.migration-cms.com/

Attachment: signature.asc
Description: Digital signature


Reply to: