aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python
diff options
context:
space:
mode:
authorAlon Bar-Lev <[email protected]>2017-04-08 13:34:30 +0000
committerJustus Winter <[email protected]>2017-04-10 12:44:16 +0000
commit25e6444b3f4601c7821beab06bc4520deacb007b (patch)
treef133e68bd9aafa4260eebbc23435d6bcefb07c35 /lang/python
parenttests: Do not use check-local magic as dependency (diff)
downloadgpgme-25e6444b3f4601c7821beab06bc4520deacb007b.tar.gz
gpgme-25e6444b3f4601c7821beab06bc4520deacb007b.zip
python: Remove usage of PYTHON_VERSIONS
* configure.ac: Remove PYTHON_VERSIONS subst. * lang/python/Makefile.am: Use basename of python as builddir prefix. * lang/python/tests/run-tests.py: Likewise. -- Two variables needs be at sync PYTHONS and PYTHON_VERSIONS, these may go out of sync in some cases, for example in Gentoo where default python is 3.4 we get: PYTHON='/usr/bin/python2' PYTHONS='/usr/bin/python /usr/bin/python2' PYTHON_VERSIONS='2.7 3.4' We can use the basename of the python interpreter to achieve similar effect without having to sync indexes between these two variables. Signed-off-by: Alon Bar-Lev <[email protected]>
Diffstat (limited to 'lang/python')
-rw-r--r--lang/python/Makefile.am23
-rw-r--r--lang/python/tests/run-tests.py4
2 files changed, 13 insertions, 14 deletions
diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index 4ebd214e..90075f7a 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -38,12 +38,11 @@ copystamp:
touch $@
all-local: copystamp
- set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
- PYTHON="$$1" ; shift ; \
+ set -e ; for PYTHON in $(PYTHONS); do \
CFLAGS="$(CFLAGS)" \
srcdir="$(srcdir)" \
top_builddir="$(top_builddir)" \
- $$PYTHON setup.py build --verbose --build-base=python$${VERSION}-gpg ; \
+ $$PYTHON setup.py build --verbose --build-base="$$(basename "$${PYTHON}")-gpg" ; \
done
python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc: copystamp
@@ -76,26 +75,26 @@ CLEANFILES = copystamp \
# permissions.
clean-local:
rm -rf -- build
- for VERSION in $(PYTHON_VERSIONS); do \
- find python$${VERSION}-gpg* -type d ! -perm -200 -exec chmod u+w {} ';' ; \
- rm -rf -- python$${VERSION}-gpg* ; \
+ for PYTHON in $(PYTHONS); do \
+ find "$$(basename "$${PYTHON}")-gpg" -type d ! -perm -200 -exec chmod u+w {} ';' ; \
+ rm -rf -- "$$(basename "$${PYTHON}")-gpg" ; \
done
install-exec-local:
- set -e ; set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
- PYTHON="$$1" ; shift ; \
+ set -e ; for PYTHON in $(PYTHONS); do \
srcdir="$(srcdir)" \
top_builddir="$(top_builddir)" \
$$PYTHON setup.py \
build \
- --build-base=python$${VERSION}-gpg \
+ --build-base="$$(basename "$${PYTHON}")-gpg" \
install \
--prefix "$(DESTDIR)$(prefix)" \
--verbose ; \
done
uninstall-local:
- GV=$$(echo $(VERSION) | tr - _); for PV in $(PYTHON_VERSIONS); do \
- rm -rf -- "$(DESTDIR)$(prefix)"/lib*/python$$PV/site-packages/gpg \
-"$(DESTDIR)$(prefix)"/lib*/python$$PV/site-packages/gpg-$$GV-py$$PV.egg-info ; \
+ GV=$$(echo $(VERSION) | tr - _); for PYTHON in $(PYTHONS); do \
+ PLATLIB="$(prefix)/$$("$${PYTHON}" -c 'import sysconfig, os; print(os.path.relpath(sysconfig.get_path("platlib"), sysconfig.get_config_var("prefix")))')" ; \
+ rm -rf -- "$(DESTDIR)$${PLATLIB}/gpg" \
+ "$(DESTDIR)$${PLATLIB}"/gpg-$$GV-py*.egg-info ; \
done
diff --git a/lang/python/tests/run-tests.py b/lang/python/tests/run-tests.py
index 9e2fb78c..f236712f 100644
--- a/lang/python/tests/run-tests.py
+++ b/lang/python/tests/run-tests.py
@@ -70,8 +70,8 @@ for interpreter in args.interpreters:
[interpreter, "-c", "import sys; print('{0}.{1}'.format(sys.version_info[0], sys.version_info[1]))"]).strip().decode()
pattern = os.path.join(args.builddir, "..",
- "python{0}-gpg".format(version),
- "lib*"+version)
+ "{0}-gpg".format(os.path.basename(interpreter)),
+ "lib*")
builddirs = glob.glob(pattern)
if len(builddirs) == 0:
sys.exit("Build directory matching {0!r} not found.".format(pattern))