summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-10-11 00:10:53 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2016-10-11 00:11:55 +0100
commit91d2158de7954daccb0a22885021c8416d1d5c6c (patch)
tree0c6d537c377ee095d7d4d451477931d7a310dd11 /setup.py
parent4458c9b4c94e524237fb39c7821b248fc2a85e35 (diff)
downloadpsycopg2-91d2158de7954daccb0a22885021c8416d1d5c6c.tar.gz
Python source cleanup using flake8
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py75
1 files changed, 39 insertions, 36 deletions
diff --git a/setup.py b/setup.py
index 45b3b69..3f02183 100644
--- a/setup.py
+++ b/setup.py
@@ -25,34 +25,9 @@ UPDATEs. psycopg2 also provide full asynchronous operations and support
for coroutine libraries.
"""
-# note: if you are changing the list of supported Python version please fix
-# the docs in install.rst and the /features/ page on the website.
-classifiers = """\
-Development Status :: 5 - Production/Stable
-Intended Audience :: Developers
-License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
-License :: OSI Approved :: Zope Public License
-Programming Language :: Python
-Programming Language :: Python :: 2.6
-Programming Language :: Python :: 2.7
-Programming Language :: Python :: 3
-Programming Language :: Python :: 3.1
-Programming Language :: Python :: 3.2
-Programming Language :: Python :: 3.3
-Programming Language :: Python :: 3.4
-Programming Language :: Python :: 3.5
-Programming Language :: C
-Programming Language :: SQL
-Topic :: Database
-Topic :: Database :: Front-Ends
-Topic :: Software Development
-Topic :: Software Development :: Libraries :: Python Modules
-Operating System :: Microsoft :: Windows
-Operating System :: Unix
-"""
-
# Note: The setup.py must be compatible with both Python 2 and 3
+
import os
import sys
import re
@@ -87,7 +62,34 @@ except ImportError:
PSYCOPG_VERSION = '2.7.dev0'
-version_flags = ['dt', 'dec']
+
+# note: if you are changing the list of supported Python version please fix
+# the docs in install.rst and the /features/ page on the website.
+classifiers = """\
+Development Status :: 5 - Production/Stable
+Intended Audience :: Developers
+License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
+License :: OSI Approved :: Zope Public License
+Programming Language :: Python
+Programming Language :: Python :: 2.6
+Programming Language :: Python :: 2.7
+Programming Language :: Python :: 3
+Programming Language :: Python :: 3.1
+Programming Language :: Python :: 3.2
+Programming Language :: Python :: 3.3
+Programming Language :: Python :: 3.4
+Programming Language :: Python :: 3.5
+Programming Language :: C
+Programming Language :: SQL
+Topic :: Database
+Topic :: Database :: Front-Ends
+Topic :: Software Development
+Topic :: Software Development :: Libraries :: Python Modules
+Operating System :: Microsoft :: Windows
+Operating System :: Unix
+"""
+
+version_flags = ['dt', 'dec']
PLATFORM_IS_WINDOWS = sys.platform.lower().startswith('win')
@@ -208,7 +210,7 @@ or with the pg_config option in 'setup.cfg'.
# Support unicode paths, if this version of Python provides the
# necessary infrastructure:
if sys.version_info[0] < 3 \
- and hasattr(sys, 'getfilesystemencoding'):
+ and hasattr(sys, 'getfilesystemencoding'):
pg_config_path = pg_config_path.encode(
sys.getfilesystemencoding())
@@ -230,7 +232,7 @@ class psycopg_build_ext(build_ext):
('use-pydatetime', None,
"Use Python datatime objects for date and time representation."),
('pg-config=', None,
- "The name of the pg_config binary and/or full path to find it"),
+ "The name of the pg_config binary and/or full path to find it"),
('have-ssl', None,
"Compile with OpenSSL built PostgreSQL libraries (Windows only)."),
('static-libpq', None,
@@ -388,7 +390,7 @@ class psycopg_build_ext(build_ext):
if not getattr(self, 'link_objects', None):
self.link_objects = []
self.link_objects.append(
- os.path.join(pg_config_helper.query("libdir"), "libpq.a"))
+ os.path.join(pg_config_helper.query("libdir"), "libpq.a"))
else:
self.libraries.append("pq")
@@ -417,7 +419,7 @@ class psycopg_build_ext(build_ext):
else:
sys.stderr.write(
"Error: could not determine PostgreSQL version from '%s'"
- % pgversion)
+ % pgversion)
sys.exit(1)
define_macros.append(("PG_VERSION_NUM", "%d%02d%02d" %
@@ -445,6 +447,7 @@ class psycopg_build_ext(build_ext):
if hasattr(self, "finalize_" + sys.platform):
getattr(self, "finalize_" + sys.platform)()
+
def is_py_64():
# sys.maxint not available since Py 3.1;
# sys.maxsize not available before Py 2.6;
@@ -511,7 +514,7 @@ parser.read('setup.cfg')
# Choose a datetime module
have_pydatetime = True
have_mxdatetime = False
-use_pydatetime = int(parser.get('build_ext', 'use_pydatetime'))
+use_pydatetime = int(parser.get('build_ext', 'use_pydatetime'))
# check for mx package
if parser.has_option('build_ext', 'mx_include_dir'):
@@ -547,8 +550,8 @@ you probably need to install its companion -dev or -devel package."""
sys.exit(1)
# generate a nice version string to avoid confusion when users report bugs
-version_flags.append('pq3') # no more a choice
-version_flags.append('ext') # no more a choice
+version_flags.append('pq3') # no more a choice
+version_flags.append('ext') # no more a choice
if version_flags:
PSYCOPG_VERSION_EX = PSYCOPG_VERSION + " (%s)" % ' '.join(version_flags)
@@ -580,8 +583,8 @@ for define in parser.get('build_ext', 'define').split(','):
# build the extension
-sources = [ os.path.join('psycopg', x) for x in sources]
-depends = [ os.path.join('psycopg', x) for x in depends]
+sources = [os.path.join('psycopg', x) for x in sources]
+depends = [os.path.join('psycopg', x) for x in depends]
ext.append(Extension("psycopg2._psycopg", sources,
define_macros=define_macros,