diff --git a/Makefile b/Makefile index 522c8b0e..1382f41c 100644 --- a/Makefile +++ b/Makefile @@ -61,13 +61,13 @@ $(GENDOCS): doc/%.rst: src/%.c tools/code2rst.py env PYTHONPATH=. http_proxy= $(PYTHON) tools/code2rst.py $(SQLITEVERSION) $< $@ build_ext: - $(PYTHON) setup.py fetch --version=$(SQLITEVERSION) --all build_ext --inplace --force --enable-all-extensions + env APSW_FORCE_DISTUTILS=t $(PYTHON) setup.py fetch --version=$(SQLITEVERSION) --all build_ext --inplace --force --enable-all-extensions coverage: - $(PYTHON) setup.py fetch --version=$(SQLITEVERSION) --all && env APSW_PY_COVERAGE=t tools/coverage.sh + env APSW_FORCE_DISTUTILS=t $(PYTHON) setup.py fetch --version=$(SQLITEVERSION) --all && env APSW_PY_COVERAGE=t tools/coverage.sh test: build_ext - $(PYTHON) tests.py + env APSW_FORCE_DISTUTILS=t $(PYTHON) tests.py debugtest: gcc -pthread -fno-strict-aliasing -g -fPIC -Wall -DAPSW_USE_SQLITE_CONFIG=\"sqlite3/sqlite3config.h\" -DEXPERIMENTAL -DSQLITE_DEBUG -DAPSW_USE_SQLITE_AMALGAMATION=\"sqlite3.c\" -DAPSW_NO_NDEBUG -DAPSW_TESTFIXTURES -I`$(PYTHON) -c "import distutils.sysconfig,sys; sys.stdout.write(distutils.sysconfig.get_python_inc())"` -I. -Isqlite3 -Isrc -c src/apsw.c @@ -128,26 +128,26 @@ compile-win: cmd /c del /s /q build cmd /c del /s /q apsw.egg-info -cmd /c md dist - c:/python35/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - "c:\program files (x86)\microsoft visual studio 14.0\vc\vcvarsall.bat" amd64 & c:/python35-64/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python34/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python34-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python33/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python33-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python32/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python32-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python31/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python31-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python27/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python27-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python26/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python26-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) - c:/python25/python setup.py $(WINBPREFIX) --compile=mingw32 $(WINBSUFFIX) $(WINBINST) - c:/python24/python setup.py $(WINBPREFIX) --compile=mingw32 $(WINBSUFFIX) $(WINBINST) - c:/python23/python setup.py $(WINBPREFIX) --compile=mingw32 $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python35/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & "c:\program files (x86)\microsoft visual studio 14.0\vc\vcvarsall.bat" amd64 & c:/python35-64/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python34/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python34-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python33/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python33-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python32/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python32-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python31/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python31-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python27/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python27-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python26/python setup.py $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python26-64/python setup.py $(WIN64HACK) $(WINBPREFIX) $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python25/python setup.py $(WINBPREFIX) --compile=mingw32 $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python24/python setup.py $(WINBPREFIX) --compile=mingw32 $(WINBSUFFIX) $(WINBINST) + set APSW_FORCE_DISTUTILS=t & c:/python23/python setup.py $(WINBPREFIX) --compile=mingw32 $(WINBSUFFIX) $(WINBINST) source_nocheck: docs - $(PYTHON) setup.py sdist --formats zip --add-doc + env APSW_FORCE_DISTUTILS=t $(PYTHON) setup.py sdist --formats zip --add-doc # Make the source and then check it builds and tests correctly. This will catch missing files etc source: source_nocheck diff --git a/doc/changes.rst b/doc/changes.rst index ad651ecf..d47a8b29 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -6,8 +6,10 @@ Change History ========= setup.py attempts to use setuptools if present, before falling back to -distutils. This allows setuptools only commands such as bdist_wheel to work. -(:issue:`207`) +distutils. This allows setuptools only commands such as bdist_wheel to work. You +can force use of distutils by setting the environment variable +APSW_FORCE_DISTUTILS to any value. Note that setuptools may also affect the +output file names. (:issue:`207`) 3.11.0-r1 ========== diff --git a/setup.py b/setup.py index ef95d906..8be50e86 100644 --- a/setup.py +++ b/setup.py @@ -8,11 +8,14 @@ import glob import re import time -import zipfile, tarfile -import socket +import zipfile +import tarfile try: - from setuptools import setup, Extension, Command + if not os.environ.get("APSW_FORCE_DISTUTILS"): + from setuptools import setup, Extension, Command + else: + raise ImportError() except ImportError: from distutils.core import setup, Extension, Command diff --git a/tools/megatest.py b/tools/megatest.py index f80f1ce6..a1910538 100755 --- a/tools/megatest.py +++ b/tools/megatest.py @@ -39,7 +39,7 @@ def run(cmd): raise Exception("Failed with signal "+`os.WTERMSIG(status)`+": "+cmd) def dotest(pyver, logdir, pybin, pylib, workdir, sqlitever): - run("set -e ; cd %s ; ( env LD_LIBRARY_PATH=%s %s setup.py fetch --version=%s --all build_test_extension build_ext --inplace --force --enable-all-extensions test -v ) >%s 2>&1" % (workdir, pylib, pybin, sqlitever, os.path.abspath(os.path.join(logdir, "buildruntests.txt")))) + run("set -e ; cd %s ; ( env LD_LIBRARY_PATH=%s APSW_FORCE_DISTUTILS=t %s setup.py fetch --version=%s --all build_test_extension build_ext --inplace --force --enable-all-extensions test -v ) >%s 2>&1" % (workdir, pylib, pybin, sqlitever, os.path.abspath(os.path.join(logdir, "buildruntests.txt")))) def runtest(workdir, pyver, ucs, sqlitever, logdir): pybin, pylib=buildpython(workdir, pyver, ucs, os.path.abspath(os.path.join(logdir, "pybuild.txt")))