build,python: Fix uninstalling in distcheck

* lang/python/Makefile.am (uninstall-local): Get platlib path relative
to data path.
--

For unknown reasons (at least on my system) Python 3.1x's sysconfig
returns a platlib (== directory for site-specific, platform-specific
files) starting with /usr/local although the prefix config variable is
/usr. This broke uninstallation because a wrong folder was (tried to)
remove. Python 2.7 and 3.9 return a platlib starting with just /usr. In
order to always get the correct relative path we use the data path
instead of the prefix config variable as anchor directory.
This commit is contained in:
Ingo Klöcker 2024-12-04 16:35:02 +01:00
parent 27da4ec635
commit 7a42ec5d46
No known key found for this signature in database
GPG Key ID: F5A5D1692277A1E9

View File

@ -105,7 +105,7 @@ uninstall-local:
GV=$$(echo $(VERSION) | tr - _); \ GV=$$(echo $(VERSION) | tr - _); \
normalizedGV=$$(echo $$GV | sed s/_beta/b/); \ normalizedGV=$$(echo $$GV | sed s/_beta/b/); \
for PYTHON in $(PYTHONS); do \ for PYTHON in $(PYTHONS); do \
PLATLIB="$(prefix)/$$("$${PYTHON}" -c 'import sysconfig, os; print(os.path.relpath(sysconfig.get_path("platlib", scheme="posix_prefix"), sysconfig.get_config_var("prefix")))')" ; \ PLATLIB="$(prefix)/$$("$${PYTHON}" -c 'import sysconfig, os; print(os.path.relpath(sysconfig.get_path("platlib", scheme="posix_prefix"), sysconfig.get_path("data", scheme="posix_prefix")))')" ; \
rm -rf -- "$(DESTDIR)$${PLATLIB}/gpg" \ rm -rf -- "$(DESTDIR)$${PLATLIB}/gpg" \
"$(DESTDIR)$${PLATLIB}"/gpg-$$GV-py*.egg-info \ "$(DESTDIR)$${PLATLIB}"/gpg-$$GV-py*.egg-info \
"$(DESTDIR)$${PLATLIB}"/gpg-$$normalizedGV-py*.egg ; \ "$(DESTDIR)$${PLATLIB}"/gpg-$$normalizedGV-py*.egg ; \