Richard W.M. Jones
2022-Oct-24 13:14 UTC
[Libguestfs] distutils use in hivex libdnet libnbd (and more) [was: Re: Help needed triaging build failures without distutils]
[Sending 2nd email again since it didn't reach the Python-devel list first time] On Tue, Oct 18, 2022 at 11:13:47AM +0100, Richard W.M. Jones wrote:> On Tue, Oct 18, 2022 at 10:53:12AM +0100, Richard W.M. Jones wrote: > > https://github.com/libguestfs/libguestfs/blob/master/m4/guestfs-python.m4 > > Actually some help for how to replace it would be useful too as > sysconfig is not an exact replacement for distutils.sysconfig. In > particular get_python_lib doesn't exist, and I can't find an exact > replacement. > > Original code: > > $ python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0));' > /usr/lib64/python3.11/site-packages > > Potential replacement: > > $ python3 -c 'import sysconfig; print(sysconfig.get_path("platlib"));' > /usr/local/lib64/python3.11/site-packages > > Maybe the original code was wrong, but I guess we don't want to > install site packages in /usr/local when running under RPM at least. > Note it's used here: > > https://github.com/libguestfs/libguestfs/blob/master/python/Makefile.am#L50-L54 > > (We do not -- and cannot -- use ordinary Python install mechanisms.) > > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > nbdkit - Flexible, fast NBD server with plugins > https://gitlab.com/nbdkit/nbdkit-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Miro HronĨok
2022-Oct-24 16:00 UTC
[Libguestfs] distutils use in hivex libdnet libnbd (and more) [was: Re: Help needed triaging build failures without distutils]
On 24. 10. 22 15:14, Richard W.M. Jones wrote:> Original code: > > $ python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0));' > /usr/lib64/python3.11/site-packages > > Potential replacement: > > $ python3 -c 'import sysconfig; print(sysconfig.get_path("platlib"));' > /usr/local/lib64/python3.11/site-packagesThat is a correct replacement. It will return the same value in rpmbuild environment.> Maybe the original code was wrong, but I guess we don't want to > install site packages in /usr/local when running under RPM at least.$ python3 -c 'import sysconfig; print(sysconfig.get_path("platlib"));' /usr/local/lib64/python3.11/site-packages $ RPM_BUILD_ROOT=/ python3 -c 'import sysconfig; print(sysconfig.get_path("platlib"));' /usr/lib64/python3.11/site-packages -- Miro Hron?ok -- Phone: +420777974800 IRC: mhroncok
Richard W.M. Jones
2022-Oct-24 16:19 UTC
[Libguestfs] distutils use in hivex libdnet libnbd (and more) [was: Re: Help needed triaging build failures without distutils]
On Mon, Oct 24, 2022 at 06:00:31PM +0200, Miro Hron?ok wrote:> On 24. 10. 22 15:14, Richard W.M. Jones wrote: > >Original code: > > > > $ python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib(1,0));' > > /usr/lib64/python3.11/site-packages > > > >Potential replacement: > > > > $ python3 -c 'import sysconfig; print(sysconfig.get_path("platlib"));' > > /usr/local/lib64/python3.11/site-packages > > That is a correct replacement. It will return the same value in > rpmbuild environment. > > >Maybe the original code was wrong, but I guess we don't want to > >install site packages in /usr/local when running under RPM at least. > > $ python3 -c 'import sysconfig; print(sysconfig.get_path("platlib"));' > /usr/local/lib64/python3.11/site-packages > > $ RPM_BUILD_ROOT=/ python3 -c 'import sysconfig; > print(sysconfig.get_path("platlib"));' > /usr/lib64/python3.11/site-packagesAh ha! Good one, thanks :-) Here's the fix for libguestfs: https://github.com/libguestfs/libguestfs/commit/26940f64a740676103b0ee49bf0ca5ac4e297841 I'll leave this fix to stew for a while and if it works I'll fix various other projects in a similar way. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v