aboutsummaryrefslogtreecommitdiffstats
path: root/lang
diff options
context:
space:
mode:
authorBen Greiner <[email protected]>2024-05-29 13:17:58 +0000
committerIngo Klöcker <[email protected]>2024-05-29 15:04:10 +0000
commit5844d9e700239ad10a5956cd7789bd02360bb0fa (patch)
treef1fb2aa4bcb63fe19c99562df4fc4d9775dde72a /lang
parenttests: Add new files to distribution (diff)
downloadgpgme-5844d9e700239ad10a5956cd7789bd02360bb0fa.tar.gz
gpgme-5844d9e700239ad10a5956cd7789bd02360bb0fa.zip
build,python: Build Python bindings without distutils
* m4/python.m4: Add python3.12 and 3.11 as valid interpreters, remove EOL 3.4, 3.5, 3.7 (keep 3.6 because some distributions still ship and maintain it). * lang/python/Makefile.am (clean-local): Remove dist and gpg.egg-info created by Python 3.9+ on make install. * lang/python/setup.py.in: switch from distutils to setuptools where possible, remove obsolete and deprecated -py3 option of swig, add classifiers up to 3.12, remove 3.4, 3.5, 3.7. * lang/python/doc/src/gpgme-python-howto.org: replace distutils with setuptools * lang/python/examples/howto/advanced/cython/setup.py: replace distutils with setuptools -- This fixes building the Python bindings for Python 3.12 where distutils has been removed. Based on D545
Diffstat (limited to 'lang')
-rw-r--r--lang/python/Makefile.am2
-rw-r--r--lang/python/doc/src/gpgme-python-howto.org2
-rw-r--r--lang/python/examples/howto/advanced/cython/setup.py2
-rwxr-xr-xlang/python/setup.py.in19
4 files changed, 15 insertions, 10 deletions
diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index 68b98e8e..84b39c53 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -80,7 +80,7 @@ CLEANFILES = copystamp \
# 'make distclean' clears the write bit, breaking rm -rf. Fix the
# permissions.
clean-local:
- rm -rf -- build
+ rm -rf -- build dist gpg.egg-info
for PYTHON in $(PYTHONS); do \
find "$$(basename "$${PYTHON}")-gpg" -type d ! -perm -200 -exec chmod u+w {} ';' ; \
rm -rf -- "$$(basename "$${PYTHON}")-gpg" ; \
diff --git a/lang/python/doc/src/gpgme-python-howto.org b/lang/python/doc/src/gpgme-python-howto.org
index b4367872..c40e2249 100644
--- a/lang/python/doc/src/gpgme-python-howto.org
+++ b/lang/python/doc/src/gpgme-python-howto.org
@@ -2945,7 +2945,7 @@ Save that into a file called =keycount.pyx= and then create a
=setup.py= file which contains this:
#+BEGIN_SRC python -i
-from distutils.core import setup
+from setuptools import setup
from Cython.Build import cythonize
setup(
diff --git a/lang/python/examples/howto/advanced/cython/setup.py b/lang/python/examples/howto/advanced/cython/setup.py
index f8dce034..849639e2 100644
--- a/lang/python/examples/howto/advanced/cython/setup.py
+++ b/lang/python/examples/howto/advanced/cython/setup.py
@@ -1,4 +1,4 @@
-from distutils.core import setup
+from setuptools import setup
from Cython.Build import cythonize
setup(
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 6f36861d..7b64ba7b 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -18,8 +18,12 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-from distutils.core import setup, Extension
-from distutils.command.build import build
+try:
+ from setuptools import setup, Extension
+ from setuptools.command.build import build
+except ImportError:
+ from distutils.core import setup, Extension
+ from distutils.command.build import build
import glob
import os
@@ -225,9 +229,8 @@ class BuildExtFirstHack(build):
build.run(self)
-py3 = [] if sys.version_info.major < 3 else ['-py3']
swig_sources = []
-swig_opts = ['-threads'] + py3 + extra_swig_opts
+swig_opts = ['-threads'] + extra_swig_opts
swige = Extension(
'gpg._gpgme',
sources=swig_sources,
@@ -282,10 +285,12 @@ GPGME and these bindings is available here:
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
+ 'Programming Language :: Python :: 3.11',
+ 'Programming Language :: Python :: 3.12',
'Operating System :: POSIX',
'Operating System :: Microsoft :: Windows',
'Topic :: Communications :: Email',