improve PyPy support by following PEP 3149

This implement the suggestion is issue #467 but the test suite is
still not completely passing with pypy3.

* m4/pypath.m4: Detect the suffix for extensions.
* python/Makefile.am: Use it.
* tests/run.in: Recognize pypy3 as a Python version.
This commit is contained in:
Alexandre Duret-Lutz 2021-06-29 21:10:13 +02:00
parent d43f23b423
commit 47348a9755
3 changed files with 25 additions and 20 deletions

View file

@ -8,6 +8,10 @@ AC_DEFUN([adl_CHECK_PYTHON],
[adl_cv_python_inc],
[adl_cv_python_inc=`$PYTHON -c "import sys; from distutils import sysconfig;]
[sys.stdout.write(sysconfig.get_python_inc())" 2>/dev/null`])
AC_CACHE_CHECK([for $am_display_PYTHON extension suffix],
[adl_cv_python_ext],
[adl_cv_python_ext=`$PYTHON -c "import importlib.machinery as i; print(i.EXTENSION_SUFFIXES[[0]])"`])
AC_SUBST([PYEXT], [${adl_cv_python_ext%.*}])
AC_SUBST([PYTHONINC], [$adl_cv_python_inc])
adl_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$adl_save_CPPFLAGS -I$PYTHONINC"

View file

@ -1,5 +1,5 @@
## -*- coding: utf-8 -*-
## Copyright (C) 2010, 2011, 2013-2020 Laboratoire de Recherche
## Copyright (C) 2010, 2011, 2013-2021 Laboratoire de Recherche
## et Development de l'Epita (LRDE).
## Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
## département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -36,8 +36,8 @@ nobase_pyexec_PYTHON = \
spot/gen.py \
spot/jupyter.py \
buddy.py
nobase_pyexec_LTLIBRARIES = _buddy.la spot/_impl.la \
spot/_ltsmin.la spot/_gen.la
nobase_pyexec_LTLIBRARIES = _buddy@PYEXT@.la spot/_impl@PYEXT@.la \
spot/_ltsmin@PYEXT@.la spot/_gen@PYEXT@.la
MAINTAINERCLEANFILES = \
@ -69,9 +69,9 @@ am__depfiles_remade = ./$(DEPDIR)/buddy_wrap.Plo \
## spot
spot__impl_la_SOURCES = spot/impl_wrap.cxx
spot__impl_la_LDFLAGS = -avoid-version -module $(SYMBOLIC_LDFLAGS)
spot__impl_la_LIBADD = $(top_builddir)/spot/libspot.la -lpthread
spot__impl@PYEXT@_la_SOURCES = spot/impl_wrap.cxx
spot__impl@PYEXT@_la_LDFLAGS = -avoid-version -module $(SYMBOLIC_LDFLAGS)
spot__impl@PYEXT@_la_LIBADD = $(top_builddir)/spot/libspot.la -lpthread
am__depfiles_remade += ./spot/$(DEPDIR)/impl_wrap.Pcxx
@AMDEP_TRUE@@am__include@ @am__quote@./spot/$(DEPDIR)/impl_wrap.Pcxx@am__quote@ # am--include-marker
@ -88,11 +88,11 @@ spot/impl.py: spot/impl.i
## spot-ltsmin
spot__ltsmin_la_SOURCES = spot/ltsmin_wrap.cxx
spot__ltsmin_la_LDFLAGS = -avoid-version -module $(SYMBOLIC_LDFLAGS)
spot__ltsmin_la_LIBADD = $(top_builddir)/spot/libspot.la \
$(top_builddir)/spot/ltsmin/libspotltsmin.la \
-lpthread
spot__ltsmin@PYEXT@_la_SOURCES = spot/ltsmin_wrap.cxx
spot__ltsmin@PYEXT@_la_LDFLAGS = -avoid-version -module $(SYMBOLIC_LDFLAGS)
spot__ltsmin@PYEXT@_la_LIBADD = $(top_builddir)/spot/libspot.la \
$(top_builddir)/spot/ltsmin/libspotltsmin.la \
-lpthread
am__depfiles_remade += ./spot/$(DEPDIR)/ltsmin_wrap.Pcxx
@AMDEP_TRUE@@am__include@ @am__quote@./spot/$(DEPDIR)/ltsmin_wrap.Pcxx@am__quote@ # am--include-marker
@ -107,11 +107,11 @@ spot/ltsmin.py: spot/ltsmin.i
## spot-gen
spot__gen_la_SOURCES = spot/gen_wrap.cxx
spot__gen_la_LDFLAGS = -avoid-version -module $(SYMBOLIC_LDFLAGS)
spot__gen_la_LIBADD = $(top_builddir)/spot/libspot.la \
$(top_builddir)/spot/gen/libspotgen.la \
-lpthread
spot__gen@PYEXT@_la_SOURCES = spot/gen_wrap.cxx
spot__gen@PYEXT@_la_LDFLAGS = -avoid-version -module $(SYMBOLIC_LDFLAGS)
spot__gen@PYEXT@_la_LIBADD = $(top_builddir)/spot/libspot.la \
$(top_builddir)/spot/gen/libspotgen.la \
-lpthread
am__depfiles_remade += ./spot/$(DEPDIR)/gen_wrap.Pcxx
@AMDEP_TRUE@@am__include@ @am__quote@./spot/$(DEPDIR)/gen_wrap.Pcxx@am__quote@ # am--include-marker
@ -126,8 +126,9 @@ spot/gen.py: spot/gen.i
## buddy
_buddy_la_SOURCES = buddy_wrap.cxx
_buddy_la_LDFLAGS = -avoid-version -module $(BUDDY_LDFLAGS) $(SYMBOLIC_LDFLAGS)
_buddy@PYEXT@_la_SOURCES = buddy_wrap.cxx
_buddy@PYEXT@_la_LDFLAGS = -avoid-version -module \
$(BUDDY_LDFLAGS) $(SYMBOLIC_LDFLAGS)
am__depfiles_remade += ./$(DEPDIR)/buddy_wrap.Pcxx
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buddy_wrap.Pcxx@am__quote@ # am--include-marker

View file

@ -1,6 +1,6 @@
#!/bin/sh
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2011, 2014-2016, 2018-2020 Laboratoire de Recherche
# Copyright (C) 2010-2011, 2014-2016, 2018-2021 Laboratoire de Recherche
# et Developpement de l'EPITA (LRDE).
# Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6
# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
@ -114,7 +114,7 @@ case $1 in
exec sh -x "$@";;
*.pl)
exec $PERL "$@";;
*python*|*jupyter*)
*python*|*jupyter*|*pypy*)
PYTHONPATH=$pypath DYLD_LIBRARY_PATH=$modpath:$DYLD_LIBRARY_PATH \
exec $PREFIXCMD "$@";;
*)