sword/migrate-to-setuptools.diff

82 lines
3.5 KiB
Diff

From 07b31a74ea920077fa0d69cdab2ab188dd17b322 Mon Sep 17 00:00:00 2001
From: Aaron Rainbolt <arraybolt3@gmail.com>
Date: Wed, 27 Sep 2023 10:51:27 -0600
Subject: [PATCH] Migrate to setuptools
---
bindings/swig/oldmake/Makefile.am | 2 +-
bindings/swig/package/Makefile.am | 3 +--
bindings/swig/package/Makefile.in | 3 +--
bindings/swig/python/CMakeLists.txt | 7 +++++--
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/bindings/swig/oldmake/Makefile.am b/bindings/swig/oldmake/Makefile.am
index 45a37ef..789813b 100644
--- a/bindings/swig/oldmake/Makefile.am
+++ b/bindings/swig/oldmake/Makefile.am
@@ -76,7 +76,7 @@ python_makebuild: $(PYTHONSWIG)
echo "writing python/setup.py"
@echo "#! /usr/bin/python" > python/setup.py
@echo "" >> python/setup.py
- @echo "from distutils.core import setup, Extension" >> python/setup.py
+ @echo "from setuptools import setup, Extension" >> python/setup.py
@echo "setup (name = \"sword\"," >> python/setup.py
@echo " version = \"$(VERSION)\"," >> python/setup.py
@echo " maintainer = \"Sword Developers\"," >> python/setup.py
diff --git a/bindings/swig/package/Makefile.am b/bindings/swig/package/Makefile.am
index 14500c3..f44974d 100644
--- a/bindings/swig/package/Makefile.am
+++ b/bindings/swig/package/Makefile.am
@@ -84,8 +84,7 @@ python_makebuild: $(PYTHONSWIG)
echo "writing python/setup.py"
@echo "#! /usr/bin/python" > python/setup.py
@echo "" >> python/setup.py
- @echo "from distutils.core import setup" >> python/setup.py
- @echo "from distutils.extension import Extension" >> python/setup.py
+ @echo "from setuptools import setup, Extension" >> python/setup.py
@echo "import commands" >> python/setup.py
@echo "" >> python/setup.py
@echo "def pkgconfig(*packages, **kw):" >> python/setup.py
diff --git a/bindings/swig/package/Makefile.in b/bindings/swig/package/Makefile.in
index b5f05c9..370a9e7 100644
--- a/bindings/swig/package/Makefile.in
+++ b/bindings/swig/package/Makefile.in
@@ -938,8 +938,7 @@ python_makebuild: $(PYTHONSWIG)
echo "writing python/setup.py"
@echo "#! /usr/bin/python" > python/setup.py
@echo "" >> python/setup.py
- @echo "from distutils.core import setup" >> python/setup.py
- @echo "from distutils.extension import Extension" >> python/setup.py
+ @echo "from setuptools import setup, Extension" >> python/setup.py
@echo "import commands" >> python/setup.py
@echo "" >> python/setup.py
@echo "def pkgconfig(*packages, **kw):" >> python/setup.py
diff --git a/bindings/swig/python/CMakeLists.txt b/bindings/swig/python/CMakeLists.txt
index cbb4058..247bc79 100644
--- a/bindings/swig/python/CMakeLists.txt
+++ b/bindings/swig/python/CMakeLists.txt
@@ -25,7 +25,7 @@ ENDIF(NOT PYTHONLIBS_FOUND)
SET(PY_SCRIPT "#!${PYTHON_EXECUTABLE}
-from distutils.core import setup, Extension
+from setuptools import setup, Extension
setup(
name='sword',
version='${SWORD_VERSION}',
@@ -51,8 +51,11 @@ ADD_CUSTOM_TARGET(swordswig_python${SWORD_PYTHON_VERSION} ALL
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
# Allow user installation to custom directory
+IF(NOT SWORD_PYTHON_INSTALL_ROOT STREQUAL "")
+ SET(SETUP_ARGS "\"--root=${SWORD_PYTHON_INSTALL_ROOT}\"")
+ENDIF(NOT SWORD_PYTHON_INSTALL_ROOT STREQUAL "")
IF(NOT SWORD_PYTHON_INSTALL_DIR STREQUAL "")
- SET(SETUP_ARGS "\"--prefix=${SWORD_PYTHON_INSTALL_DIR}\"")
+ SET(SETUP_ARGS "${SETUP_ARGS}\"--prefix=${SWORD_PYTHON_INSTALL_DIR}\"")
ENDIF(NOT SWORD_PYTHON_INSTALL_DIR STREQUAL "")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/install.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/install.cmake")
--
2.41.0