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

Remove use of deprecated python distutils #931

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scripts/postinst
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
#!/bin/sh

set -e
Python_SITELIB=$(python3 -c "from distutils import sysconfig;print(sysconfig.get_python_lib(plat_specific=False,standard_lib=False))")
Python_SITELIB=$(python3 <<EOF
import sys
if sys.version_info < (3, 10, 0):
from distutils import sysconfig
print(sysconfig.get_python_lib(plat_specific=False,standard_lib=False))
else:
from sysconfig import get_path; print(get_path('platlib', 'deb_system'))
Copy link
Member

Choose a reason for hiding this comment

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

Do you know where the deb_system scheme is documented?

Copy link
Member Author

Choose a reason for hiding this comment

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

No :(
Here is where I got that from: https://forum.freecad.org/viewtopic.php?t=67985
Which links to this "interesting" article: https://ffy00.github.io/blog/02-python-debian-and-the-install-locations/
Add this to the many things I hate about Python.

EOF
)

mkdir -p $Python_SITELIB
ln -sf @CMAKE_INSTALL_FULL_DATAROOTDIR@/spring_testing/tests/TestHarness $Python_SITELIB/TestHarness

Expand Down
11 changes: 10 additions & 1 deletion scripts/prerm
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
#!/bin/sh

# Cleanup symbolic links created during postinst
Python_SITELIB=$(python3 -c "from distutils import sysconfig;print(sysconfig.get_python_lib(plat_specific=False,standard_lib=False))")
Python_SITELIB=$(python3 <<EOF
import sys
if sys.version_info < (3, 10, 0):
from distutils import sysconfig
print(sysconfig.get_python_lib(plat_specific=False,standard_lib=False))
else:
from sysconfig import get_path; print(get_path('platlib', 'deb_system'))
EOF
)

rm -f $Python_SITELIB/TestHarness
rm -f @CMAKE_INSTALL_FULL_DATAROOTDIR@/spring_testing/bin