Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropped use of depricated python3-setuptools / distutils. #3158

Conversation

petterreinholdtsen
Copy link
Collaborator

Make sure sysconfig.get_path("platlib") return correct path on Debian systems, where /usr/lib/ should be used over /usr/local/lib.

Based on e2c10a8 by Andy Pugh,

Fixes Debian issue #1080668.

@petterreinholdtsen
Copy link
Collaborator Author

See also #3154 and https://bugs.debian.org/1080668 .

@petterreinholdtsen
Copy link
Collaborator Author

I do not understand why configure still report "checking for site-package location... /usr/lib/python3.9/dist-packages" on bullseye, when it should be reporting /usr/lib/python3/dist-packages after my regex rewrite. When running the code in question manually on bullseye, the correct path show up.

@petterreinholdtsen
Copy link
Collaborator Author

petterreinholdtsen commented Oct 20, 2024 via email

@petterreinholdtsen petterreinholdtsen force-pushed the bug-debian-1080668-python3-setuptools branch 3 times, most recently from 7b169a6 to 3e3b97d Compare October 20, 2024 14:41
@andypugh
Copy link
Collaborator

[andypugh]
Bullseye is not supported by the master branch
Good point.

It wasn't a good point, I deleted it, but not fast enough.

Buster is not supported, Bullseye is still supported (and, in fact, current?)
http://wiki.linuxcnc.org/cgi-bin/wiki.pl?MinimumSoftwareVersions

Copy link

@stefanor stefanor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I don't have a whole lot of context for the package, abut I can comment on supporting installing on Debian's python.

src/configure.ac Outdated Show resolved Hide resolved
src/m4/ax_python_devel.m4 Outdated Show resolved Hide resolved
src/configure.ac Outdated Show resolved Hide resolved
@Eckeneckepen
Copy link

Eckeneckepen commented Oct 20, 2024

Configure has the following result:
2024-10-20T14:44:57.8858950Z checking for Python site-packages path... /usr/lib/python3.9/site-packages
instead of the required /usr/lib/python3/dist-packages

If you call your python statement, you get 3 rows. The last one is correct. Configure seems to consider the first row only:
python3 -c 'import sysconfig; import re; p1=sysconfig.get_path("platlib"); print(p1); p2=p1.replace("/site-packages", "/dist-packages"); print(p2); print(re.sub("/python3[^/]+/","/python3/", p2))'
=>

/usr/lib/python3.9/site-packages
/usr/lib/python3.9/dist-packages
/usr/lib/python3/dist-packages

If you remove the unnecessary print()s it should work on Bullseye:
python3 -c 'import sysconfig; import re; p1=sysconfig.get_path("platlib"); p2=p1.replace("/site-packages", "/dist-packages"); print(re.sub("/python3[^/]+/","/python3/", p2))'
=>
/usr/lib/python3/dist-packages

But it won't work on Bookworm due to an additional "local":
python3 -c 'import sysconfig; import re; p1=sysconfig.get_path("platlib"); p2=p1.replace("/site-packages", "/dist-packages"); print(re.sub("/python3[^/]+/","/python3/", p2))'
=>
/usr/local/lib/python3/dist-packages

Possible solution, but then you can also hardcode it directly:
python3 -c 'import sysconfig; import re; p1=sysconfig.get_path("platlib"); p2=p1.replace("/site-packages", "/dist-packages"); p3=re.sub("/python3[^/]+/","/python3/", p2); print(p3.replace("local/", ""))'

dist-packages is only used by Debian and its derivates and not by other distributions.
This solution is incompatible to non-Debian distributions.

Why not using my proposal?
#3155

It hard codes the old Bullseye only. This could be replaced by
python3 -c 'import sysconfig; import re; p1=sysconfig.get_path("platlib"); p2=p1.replace("/site-packages", "/dist-packages"); print(re.sub("/python3[^/]+/","/python3/", p2))'

@petterreinholdtsen petterreinholdtsen force-pushed the bug-debian-1080668-python3-setuptools branch 6 times, most recently from 9d53870 to c1c5283 Compare October 20, 2024 22:09
@petterreinholdtsen petterreinholdtsen changed the base branch from master to 2.9 October 20, 2024 22:09
@petterreinholdtsen
Copy link
Collaborator Author

See #3159 for new upstream editions of the ax_python*.m4 files.

@petterreinholdtsen petterreinholdtsen force-pushed the bug-debian-1080668-python3-setuptools branch 2 times, most recently from c8103d0 to 7463f84 Compare October 21, 2024 05:27
Make sure sysconfig.get_path("platlib") return correct path on Debian
and Ubuntu systems, where /usr/lib/ should be used over
/usr/local/lib.

Based on e2c10a8 by Andy Pugh and
pull request LinuxCNC#3155 by Eckeneckepen.

Fixes Debian issue #1080668.
@petterreinholdtsen petterreinholdtsen force-pushed the bug-debian-1080668-python3-setuptools branch from 61cc505 to 1709059 Compare October 21, 2024 05:53
@petterreinholdtsen petterreinholdtsen merged commit 538271c into LinuxCNC:2.9 Oct 21, 2024
11 checks passed
@petterreinholdtsen petterreinholdtsen deleted the bug-debian-1080668-python3-setuptools branch October 21, 2024 07:10
Eckeneckepen pushed a commit to Eckeneckepen/linuxcnc that referenced this pull request Oct 21, 2024
Dropped use of depricated python3-setuptools / distutils. LinuxCNC#3158
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants