[Libguestfs] [PATCH] [hivex] Use Python's distutils to determine include and site-packages directories.

Richard W.M. Jones rjones at redhat.com
Mon May 9 15:29:40 UTC 2011


On Wed, May 04, 2011 at 12:29:39AM +0200, Hilko Bengen wrote:
> +    if test -z "$PYTHON_SITE_PACKAGES"; then
> +        PYTHON_SITE_PACKAGES=`$PYTHON -c "import distutils.sysconfig; \
> +                print (distutils.sysconfig.get_python_lib(0,0));"`

I think this line is wrong.  The arguments should be (1,0).

On Debian there is no difference:

$ python -c "import distutils.sysconfig; print (distutils.sysconfig.get_python_lib(0,0));"
/usr/lib/python2.6/dist-packages
$ python -c "import distutils.sysconfig; print (distutils.sysconfig.get_python_lib(1,0));"
/usr/lib/python2.6/dist-packages

But on Fedora, the second one returns the platform-dependent path
(because of the stupid /usr/lib vs /usr/lib64 thing that we suffer
under on Fedora):

$ python -c "import distutils.sysconfig; print (distutils.sysconfig.get_python_lib(0,0));"
/usr/lib/python2.7/site-packages
$ python -c "import distutils.sysconfig; print (distutils.sysconfig.get_python_lib(1,0));"
/usr/lib64/python2.7/site-packages

Related documentation link:
http://docs.python.org/distutils/apiref.html#module-distutils.sysconfig

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list