From 46ed75d00786e7b859ad7a9b88acfa1dd0dbcb1b Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Mon, 19 Aug 2024 10:20:11 -0700 Subject: [PATCH] extensions: use setuptools over distutils Problem: distutils was deprecated in Python 3.10 and removed in Python 3.12. Use setuptools instead. Adjust calls to setup.py in python Makefile.am as needed, re-autogen. Fixes #65 --- src/extensions/python/Makefile.am | 6 +++--- src/extensions/python/Makefile.in | 6 +++--- src/extensions/python/genderssetup.py.in | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/extensions/python/Makefile.am b/src/extensions/python/Makefile.am index 3c115617..0c8c1e5c 100644 --- a/src/extensions/python/Makefile.am +++ b/src/extensions/python/Makefile.am @@ -17,13 +17,13 @@ all: genderssetup.py libgendersmodule.c genders.py $(PYTHON) genderssetup.py build install: - $(PYTHON) genderssetup.py install --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) + $(PYTHON) genderssetup.py install --single-version-externally-managed --root=/ --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) pure_install: - $(PYTHON) genderssetup.py install --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) + $(PYTHON) genderssetup.py install --single-version-externally-managed --root=/ --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) install-data-local: - $(PYTHON) genderssetup.py install --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) + $(PYTHON) genderssetup.py install --single-version-externally-managed --root=/ --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) clean: rm -rf build diff --git a/src/extensions/python/Makefile.in b/src/extensions/python/Makefile.in index 8898a7ca..ce9e13b4 100644 --- a/src/extensions/python/Makefile.in +++ b/src/extensions/python/Makefile.in @@ -489,13 +489,13 @@ uninstall-am: @WITH_PYTHON_EXTENSIONS_TRUE@ $(PYTHON) genderssetup.py build @WITH_PYTHON_EXTENSIONS_TRUE@install: -@WITH_PYTHON_EXTENSIONS_TRUE@ $(PYTHON) genderssetup.py install --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) +@WITH_PYTHON_EXTENSIONS_TRUE@ $(PYTHON) genderssetup.py install --single-version-externally-managed --root=/ --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) @WITH_PYTHON_EXTENSIONS_TRUE@pure_install: -@WITH_PYTHON_EXTENSIONS_TRUE@ $(PYTHON) genderssetup.py install --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) +@WITH_PYTHON_EXTENSIONS_TRUE@ $(PYTHON) genderssetup.py install --single-version-externally-managed --root=/ --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) @WITH_PYTHON_EXTENSIONS_TRUE@install-data-local: -@WITH_PYTHON_EXTENSIONS_TRUE@ $(PYTHON) genderssetup.py install --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) +@WITH_PYTHON_EXTENSIONS_TRUE@ $(PYTHON) genderssetup.py install --single-version-externally-managed --root=/ --prefix=$(PYTHON_DESTDIR)$(prefix) --exec-prefix=$(PYTHON_DESTDIR)$(exec_prefix) @WITH_PYTHON_EXTENSIONS_TRUE@clean: @WITH_PYTHON_EXTENSIONS_TRUE@ rm -rf build diff --git a/src/extensions/python/genderssetup.py.in b/src/extensions/python/genderssetup.py.in index db631828..53f4c85f 100644 --- a/src/extensions/python/genderssetup.py.in +++ b/src/extensions/python/genderssetup.py.in @@ -1,4 +1,4 @@ -from distutils.core import setup, Extension +from setuptools import setup, Extension libgendersmodule = Extension('libgenders', include_dirs = ['../../../config', '../../libgenders'],