Drop support for EOL Python 2.6

This commit is contained in:
Hugo 2017-11-28 10:11:42 +02:00 committed by Daniele Varrazzo
parent e7529e4823
commit ffcc65d4f0
9 changed files with 10 additions and 34 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ doc/html/*
doc/psycopg2.txt
scripts/pypi_docs_upload.py
env
.idea
.tox
/rel
/wheels

View File

@ -7,7 +7,6 @@ language: python
python:
- 2.7
- 3.6
- 2.6
- 3.5
- 3.4
- 3.3

View File

@ -17,7 +17,7 @@ The current `!psycopg2` implementation supports:
..
NOTE: keep consistent with setup.py and the /features/ page.
- Python 2 versions from 2.6 to 2.7
- Python version 2.7
- Python 3 versions from 3.2 to 3.6
- PostgreSQL server versions from 7.4 to 10
- PostgreSQL client library version from 9.1

View File

@ -31,8 +31,8 @@
#include <stringobject.h>
#endif
#if PY_VERSION_HEX < 0x02060000
# error "psycopg requires Python >= 2.6"
#if PY_VERSION_HEX < 0x02070000
# error "psycopg requires Python >= 2.7"
#endif
/* hash() return size changed around version 3.2a4 on 64bit platforms. Before
@ -44,14 +44,6 @@ typedef long Py_hash_t;
typedef unsigned long Py_uhash_t;
#endif
/* Macros defined in Python 2.6 */
#ifndef Py_REFCNT
#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(x,n) PyObject_HEAD_INIT(x) n,
#endif
/* FORMAT_CODE_PY_SSIZE_T is for Py_ssize_t: */
#define FORMAT_CODE_PY_SSIZE_T "%" PY_FORMAT_SIZE_T "d"

View File

@ -76,7 +76,6 @@ License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
License :: OSI Approved :: Zope Public License
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.2
@ -297,7 +296,7 @@ class psycopg_build_ext(build_ext):
# For Python versions that use MSVC compiler 2008, re-insert the
# manifest into the resulting .pyd file.
if self.compiler_is_msvc() and sysVer in ((2, 6), (2, 7), (3, 0), (3, 1), (3, 2)):
if self.compiler_is_msvc() and sysVer in ((2, 7), (3, 0), (3, 1), (3, 2)):
platform = get_platform()
# Default to the x86 manifest
manifest = '_psycopg.vc9.x86.manifest'
@ -319,7 +318,6 @@ class psycopg_build_ext(build_ext):
def finalize_win32(self):
"""Finalize build system configuration on win32 platform."""
sysVer = sys.version_info[:2]
# Add compiler-specific arguments:
extra_compiler_args = []
@ -335,17 +333,6 @@ class psycopg_build_ext(build_ext):
# API code.
extra_compiler_args.append('-fno-strict-aliasing')
# Force correct C runtime library linkage:
if sysVer <= (2, 3):
# Yes: 'msvcr60', rather than 'msvcrt', is the correct value
# on the line below:
self.libraries.append('msvcr60')
elif sysVer in ((2, 4), (2, 5)):
self.libraries.append('msvcr71')
# Beyond Python 2.5, we take our chances on the default C runtime
# library, because we don't know what compiler those future
# versions of Python will use.
for extension in ext: # ext is a global list of Extension objects
extension.extra_compile_args.extend(extra_compiler_args)
# End of add-compiler-specific arguments section.
@ -414,7 +401,7 @@ class psycopg_build_ext(build_ext):
# *at least* PostgreSQL 7.4 is available (this is the only
# 7.x series supported by psycopg 2)
pgversion = pg_config_helper.query("version").split()[1]
except:
except Exception:
pgversion = "7.4.0"
verre = re.compile(
@ -619,7 +606,7 @@ try:
f = open("README.rst")
readme = f.read()
f.close()
except:
except Exception:
print("failed to read readme: ignoring...")
readme = __doc__
@ -633,6 +620,7 @@ setup(name="psycopg2",
download_url=download_url,
license="LGPL with exceptions or ZPL",
platforms=["any"],
python_requires='>=2.7,!=3.0.*,!=3.1.*',
description=readme.split("\n")[0],
long_description="\n".join(readme.split("\n")[2:]).lstrip(),
classifiers=[x for x in classifiers.split("\n") if x],

View File

@ -352,8 +352,7 @@ class ParseDsnTestCase(ConnectingTestCase):
"DSN with quoting parsed")
# Can't really use assertRaisesRegexp() here since we need to
# make sure that secret is *not* exposed in the error messgage
# (and it also requires python >= 2.7).
# make sure that secret is *not* exposed in the error message.
raised = False
try:
# unterminated quote after dbname:

View File

@ -32,7 +32,6 @@ from psycopg2 import sql
class SqlFormatTests(ConnectingTestCase):
@skip_before_python(2, 7)
def test_pos(self):
s = sql.SQL("select {} from {}").format(
sql.Identifier('field'), sql.Identifier('table'))
@ -91,7 +90,6 @@ class SqlFormatTests(ConnectingTestCase):
def test_compose_badnargs(self):
self.assertRaises(IndexError, sql.SQL("select {0};").format)
@skip_before_python(2, 7)
def test_compose_badnargs_auto(self):
self.assertRaises(IndexError, sql.SQL("select {};").format)
self.assertRaises(ValueError, sql.SQL("select {} {1};").format, 10, 20)

View File

@ -295,7 +295,6 @@ class TypesBasicTests(ConnectingTestCase):
else:
self.assertEqual(memoryview, type(o2))
@testutils.skip_before_python(2, 7)
def testAdaptMemoryview(self):
o1 = memoryview(bytearray(range(256)))
o2 = self.execute("select %s;", (o1,))

View File

@ -4,7 +4,7 @@
# and then run "tox" from this directory.
[tox]
envlist = py26, py27
envlist = py27
[testenv]
commands = make check