[Needs review] Fix python site-packages dir#3916
[Needs review] Fix python site-packages dir#3916NTULINUX wants to merge 1 commit intoLinuxCNC:masterfrom
Conversation
|
Looks like this needs to be fixed to account for Debian..
Ah, looks like various parts of the tree are also hard-coded to use Did not see these. Any tips? The issue is that depending on the exact version of python that debian uses will affect the installation path, which will vary from each debian release, that's the tricky part to make this work across all versions. Not sure on a clean way to avoid the hard-coded variables either, as those will also change. |
|
Is there a distro independent way to find out where python packages need to be installed? |
|
Well that's what this should do: https://github.com/LinuxCNC/linuxcnc/blob/master/src/m4/ax_python_devel.m4#L340 That's where I got PYTHON_SITE_PKG from. There's also That's going to change though distro to distro... The commands themselves are universal, the result is not. PYTHON_SITE_PKG works but
Using PYTHON_SITE_PKG works for both a system-wide install though, and run-in-place. I just checked in my Trixie VM and PYTHON_SITE_PKG is working as intended (both rip and system-wide install.) Another problem is accounting for Fedora. PYTHON_SITE_PKG works there too but the hard-codes need to be fixed with a simple one-linger, not some 10 line script from autotools. Luckily, this works:
Now I need to fix the other hard-codes but the upcoming code might be wrong.. |
9fc2a6c to
b9b3f0a
Compare
b9b3f0a to
6146ae4
Compare
|
This might be ready now. Not 100% certain. |
6146ae4 to
d4304da
Compare
|
Fixed typo, trimmed SITEPY a little. Fixed echo lines as $SITEPY was literal. |
Fixes the need for PYTHONPATH on Gentoo Signed-off-by: Alec Ari <neotheuser@ymail.com>
d4304da to
3aac8b9
Compare
| AC_MSG_RESULT([$PYTHON_TK_VERSION]) | ||
|
|
||
| AC_MSG_CHECKING(for site-package location) | ||
| SITEPY="$($PYTHON -c 'import sysconfig; s = sysconfig.get_scheme_names(); m=list(set(("deb_system", "rpm_prefix")) & set(s)); print(sysconfig.get_path("platlib", m.__getitem__(0))) if m else print("/usr/lib/python3/dist-packages");')" |
There was a problem hiding this comment.
On Fedora 43, this returns:
/usr/lib64/python3.14/site-packages.
The other instances, in install_script and setup_designer.in, using import site; print([p for p in site.getsitepackages() if p.startswith('/usr/lib') and '/lib64/' not in p][0]) returns:
/usr/lib/python3.14/site-packages.
lib/lib64 difference... very strange.
There was a problem hiding this comment.
As ugly as it may be, I can copy the logic from m4 and put it in install_script and setup_designer.in
I was just trying to avoid that..
There was a problem hiding this comment.
Nevermind, you're talking about the old one, not PYTHON_SITE_PKG. I misunderstood. Currently, on fedora with my latest forced push, PYTHON_SITE_PKG and SITEPY in those files match.
There was a problem hiding this comment.
When I look in those two directories, then both are populated, but with different packages. I have no clue what goes into where. Maybe fedora docs can help?
There was a problem hiding this comment.
Yeah I noticed that too, I figured since PYTHON_SITE_PKG uses /lib instead of /lib64 to use that, plus /lib is more heavily populated.
fedora@fedora:~/dev/linuxcnc/src$ ls /usr/lib64/python3.14/site-packages | wc -l
120
fedora@fedora:~/dev/linuxcnc/src$ ls /usr/lib/python3.14/site-packages | wc -l
200
There was a problem hiding this comment.
There must be some documentation which distro wants what where. Better do it right than guess wrong?
There was a problem hiding this comment.
/usr/lib64/python3.14/site-packages/: This directory is used for architecture-specific (binary) packages.
/usr/lib/python3.14/site-packages/: This directory is used for architecture-independent (pure Python) packages. These "noarch" packages consist only of .py files and byte-compiled .pyc files, which are not tied to a specific hardware architecture.
There was a problem hiding this comment.
And that applies to Debian, Ubuntu, Gentoo and other distros too?
There was a problem hiding this comment.
Debian uses /usr/lib/python3/dist-packages for everything
Gentoo uses /usr/lib/python3.14/site-packages for everything
Fedora... :P
Fixes the need for PYTHONPATH on Gentoo