From 22fe6e7aad5b55923a8fdbf154a5fe740491257b Mon Sep 17 00:00:00 2001 From: Jason Erickson Date: Fri, 6 Nov 2015 15:01:32 -0700 Subject: [PATCH 1/3] Modify setup.py to support setuptools/wheel To support creation of whl files for PyPI, setuptools need to be imported instead of distutils. Created try/except case to fall back to integrated distutils if setuptools is not installed. --- setup.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2de8c5ef..570c5def 100644 --- a/setup.py +++ b/setup.py @@ -57,7 +57,10 @@ import os import sys import re import subprocess -from distutils.core import setup, Extension +try: + from setuptools import setup, Extension +except ImportError: + from distutils.core import setup, Extension from distutils.command.build_ext import build_ext from distutils.sysconfig import get_python_inc from distutils.ccompiler import get_default_compiler From 2d91864977be1fd590305e895402ebd3b655196e Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 7 Mar 2016 10:38:40 +0000 Subject: [PATCH 2/3] setuptools in the news --- NEWS | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS b/NEWS index 9467fea7..8f085599 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,7 @@ What's new in psycopg 2.6.2 - Raise `!NotSupportedError` on unhandled server response status (:ticket:`#352`). - Fixed `!PersistentConnectionPool` on Python 3 (:ticket:`#348`). +- Added support for setuptools/wheel (:ticket:`#370`). - Fixed `!errorcodes.lookup` initialization thread-safety (:ticket:`#382`). From 006693421d6bc9ef37be506798034433b538fe6e Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 8 Mar 2016 04:34:12 +0000 Subject: [PATCH 3/3] Fixed 'make sdist' to work with setuptools --- MANIFEST.in | 2 +- Makefile | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 66fc2656..0d34fd3d 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,4 +8,4 @@ recursive-include doc/src *.rst *.py *.css Makefile recursive-include scripts *.py *.sh include scripts/maketypes.sh scripts/buildtypes.py include AUTHORS README.rst INSTALL LICENSE NEWS -include PKG-INFO MANIFEST.in MANIFEST setup.py setup.cfg Makefile +include MANIFEST.in setup.py setup.cfg Makefile diff --git a/Makefile b/Makefile index 232f0d0b..a8f491e4 100644 --- a/Makefile +++ b/Makefile @@ -92,14 +92,9 @@ $(PACKAGE)/tests/%.py: tests/%.py $(PYTHON) setup.py build_py $(BUILD_OPT) touch $@ -$(SDIST): MANIFEST $(SOURCE) +$(SDIST): $(SOURCE) $(PYTHON) setup.py sdist $(SDIST_OPT) -MANIFEST: MANIFEST.in $(SOURCE) - # Run twice as MANIFEST.in includes MANIFEST - $(PYTHON) setup.py sdist --manifest-only - $(PYTHON) setup.py sdist --manifest-only - # docs depend on the build as it partly use introspection. doc/html/genindex.html: $(PLATLIB) $(PURELIB) $(SOURCE_DOC) $(MAKE) -C doc html @@ -111,5 +106,5 @@ doc/docs.zip: doc/html/genindex.html (cd doc/html && zip -r ../docs.zip *) clean: - rm -rf build MANIFEST + rm -rf build $(MAKE) -C doc clean