summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Talbert <swt@techie.net>2022-09-13 16:02:43 -0400
committerScott Talbert <swt@techie.net>2022-09-13 16:02:43 -0400
commit78a01acebb81b83013fb0efe80906500a6e25136 (patch)
tree86c93600a48ca0ce8a1d2120908c7f2019945661
parent39f4ceb33e292f2a2d9e3d76a6612a7f9fdb2855 (diff)
downloadpycurl-78a01acebb81b83013fb0efe80906500a6e25136.tar.gz
Fix tests/building docs with newer setuptools
In newer setuptools/distutils, the build directory has been changed from using the Python version (e.g., 3.10) to using the cache tag (e.g., cpython-38). So, support both variants by making the dot optional.
-rw-r--r--Makefile12
-rwxr-xr-xtests/run.sh5
2 files changed, 9 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 77973d0..1365444 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,9 @@ PYTHON = python
PYTEST = pytest
PYFLAKES = pyflakes
+PYTHONMAJOR=$$($(PYTHON) -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1}')
+PYTHONMINOR=$$($(PYTHON) -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$2}')
+
# -c on linux
# freebsd does not understand -c
CHMOD_VERBOSE=-v
@@ -111,8 +114,7 @@ test-release: build-release do-test
# rails-style alias
c: console
console:
- PYTHONSUFFIX=$$(python -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1 "." $$2}') && \
- PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \
+ PYTHONPATH=$$(ls -d build/lib.*$$PYTHONMAJOR*$$PYTHONMINOR):$$PYTHONPATH \
$(PYTHON)
# (needs GNU binutils)
@@ -145,8 +147,7 @@ run-quickstart:
docs: build
mkdir -p build/docstrings
for file in doc/docstrings/*.rst; do tail -n +3 $$file >build/docstrings/`basename $$file`; done
- PYTHONSUFFIX=$$($(PYTHON) -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1 "." $$2}') && \
- PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \
+ PYTHONPATH=$$(ls -d build/lib.*$$PYTHONMAJOR*$$PYTHONMINOR):$$PYTHONPATH \
$(PYTHON) -m sphinx doc build/doc
cp ChangeLog build/doc
@@ -157,8 +158,7 @@ docs-force: build
# sphinx-docs has an -a option but it does not seem to always
# rebuild everything
rm -rf build/doc
- PYTHONSUFFIX=$$($(PYTHON) -V 2>&1 |awk '{print $$2}' |awk -F. '{print $$1 "." $$2}') && \
- PYTHONPATH=$$(ls -d build/lib.*$$PYTHONSUFFIX):$$PYTHONPATH \
+ PYTHONPATH=$$(ls -d build/lib.*$$PYTHONMAJOR*$$PYTHONMINOR):$$PYTHONPATH \
$(PYTHON) -m sphinx doc build/doc
cp ChangeLog build/doc
diff --git a/tests/run.sh b/tests/run.sh
index 36a6fb1..52b5227 100755
--- a/tests/run.sh
+++ b/tests/run.sh
@@ -7,8 +7,9 @@ test -n "$PYTHON" || PYTHON=python
test -n "$PYTEST" || PYTEST=pytest
mkdir -p tests/tmp
-export PYTHONSUFFIX=$($PYTHON -V 2>&1 |awk '{print $2}' |awk -F. '{print $1 "." $2}')
-export PYTHONPATH=$(ls -d build/lib.*$PYTHONSUFFIX):$PYTHONPATH
+export PYTHONMAJOR=$($PYTHON -V 2>&1 |awk '{print $2}' |awk -F. '{print $1}')
+export PYTHONMINOR=$($PYTHON -V 2>&1 |awk '{print $2}' |awk -F. '{print $2}')
+export PYTHONPATH=$(ls -d build/lib.*$PYTHONMAJOR*$PYTHONMINOR):$PYTHONPATH
extra_attrs=
if test "$CI" = true; then