Author: cito
Date: Fri Nov 20 06:16:03 2015
New Revision: 553

Log:
Require at least Python 2.6 for the trunk (5.x)

Support for even older Python versions is maintained in the 4.x branch.
The goal for 5.x is to be a single-source code for both Python 2 and 3,
and this is only possible by dropping support for Python 2.5 and older.
For instance, the new except .. as syntax works only since Python 2.6.
Otherwise we would need to use 2to3 and things would be very ugly.
Note that Python 2.6 is now 7 years old. We may want to drop Python 2.6
as well at some point if it turns out to be a burden.

Modified:
   trunk/docs/install.rst
   trunk/docs/install.txt
   trunk/docs/introduction.rst
   trunk/docs/readme.txt
   trunk/module/TEST_PyGreSQL_classic.py
   trunk/module/TEST_PyGreSQL_classic_connection.py
   trunk/module/TEST_PyGreSQL_classic_dbwrapper.py
   trunk/module/TEST_PyGreSQL_classic_functions.py
   trunk/module/TEST_PyGreSQL_classic_largeobj.py
   trunk/module/TEST_PyGreSQL_dbapi20.py
   trunk/module/pg.py
   trunk/module/pgdb.py
   trunk/module/setup.py

Modified: trunk/docs/install.rst
==============================================================================
--- trunk/docs/install.rst      Fri Nov 20 05:44:08 2015        (r552)
+++ trunk/docs/install.rst      Fri Nov 20 06:16:03 2015        (r553)
@@ -11,8 +11,8 @@
 ``PATH`` environment variable.
 
 The current version of PyGreSQL has been tested with Python 2.7 and
-PostGreSQL 9.2. Older version should work as well, but you will need
-at least Python 2.5 and PostgreSQL 8.3.
+PostGreSQL 9.4. Older version should work as well, but you will need
+at least Python 2.6 and PostgreSQL 9.0.
 
 PyGreSQL will be installed as three modules, a dynamic module called
 _pg.pyd, and two pure Python wrapper modules called pg.py and pgdb.py.

Modified: trunk/docs/install.txt
==============================================================================
--- trunk/docs/install.txt      Fri Nov 20 05:44:08 2015        (r552)
+++ trunk/docs/install.txt      Fri Nov 20 06:16:03 2015        (r553)
@@ -16,8 +16,8 @@
 ``PATH`` environment variable.
 
 The current version of PyGreSQL has been tested with Python 2.7 and
-PostGreSQL 9.2. Older version should work as well, but you will need
-at least Python 2.5 and PostgreSQL 8.3.
+PostGreSQL 9.4. Older version should work as well, but you will need
+at least Python 2.6 and PostgreSQL 9.0.
 
 PyGreSQL will be installed as three modules, a dynamic module called
 _pg.pyd, and two pure Python wrapper modules called pg.py and pgdb.py.

Modified: trunk/docs/introduction.rst
==============================================================================
--- trunk/docs/introduction.rst Fri Nov 20 05:44:08 2015        (r552)
+++ trunk/docs/introduction.rst Fri Nov 20 06:16:03 2015        (r553)
@@ -38,4 +38,4 @@
 D'Arcy ([email protected]) renamed it to PyGreSQL starting with
 version 2.0 and serves as the "BDFL" of PyGreSQL.
 
-The current version PyGreSQL 4.2 needs PostgreSQL 8.3 and Python 2.5 or above.
+The current version PyGreSQL 5.0 needs PostgreSQL 9.0 and Python 2.6 or above.

Modified: trunk/docs/readme.txt
==============================================================================
--- trunk/docs/readme.txt       Fri Nov 20 05:44:08 2015        (r552)
+++ trunk/docs/readme.txt       Fri Nov 20 06:16:03 2015        (r553)
@@ -77,7 +77,7 @@
 D'Arcy ([email protected]) renamed it to PyGreSQL starting with
 version 2.0 and serves as the "BDFL" of PyGreSQL.
 
-The current version PyGreSQL 4.2 needs PostgreSQL 8.3 and Python 2.5 or above.
+The current version PyGreSQL 5.0 needs PostgreSQL 9.0 and Python 2.6 or above.
 
 
 Where to get ... ?

Modified: trunk/module/TEST_PyGreSQL_classic.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic.py       Fri Nov 20 05:44:08 2015        
(r552)
+++ trunk/module/TEST_PyGreSQL_classic.py       Fri Nov 20 06:16:03 2015        
(r553)
@@ -1,6 +1,6 @@
 #! /usr/bin/python
 
-from __future__ import with_statement, print_function
+from __future__ import print_function
 
 import sys
 from functools import partial

Modified: trunk/module/TEST_PyGreSQL_classic_connection.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic_connection.py    Fri Nov 20 05:44:08 
2015        (r552)
+++ trunk/module/TEST_PyGreSQL_classic_connection.py    Fri Nov 20 06:16:03 
2015        (r553)
@@ -12,9 +12,10 @@
 """
 
 try:
-    import unittest2 as unittest  # for Python < 2.6
+    import unittest2 as unittest  # for Python < 2.7
 except ImportError:
     import unittest
+
 import sys
 import threading
 import time
@@ -22,10 +23,8 @@
 import pg  # the module under test
 
 from decimal import Decimal
-try:
-    from collections import namedtuple
-except ImportError:  # Python < 2.6
-    namedtuple = None
+
+from collections import namedtuple
 
 from StringIO import StringIO
 

Modified: trunk/module/TEST_PyGreSQL_classic_dbwrapper.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic_dbwrapper.py     Fri Nov 20 05:44:08 
2015        (r552)
+++ trunk/module/TEST_PyGreSQL_classic_dbwrapper.py     Fri Nov 20 06:16:03 
2015        (r553)
@@ -11,10 +11,8 @@
 
 """
 
-from __future__ import with_statement
-
 try:
-    import unittest2 as unittest  # for Python < 2.6
+    import unittest2 as unittest  # for Python < 2.7
 except ImportError:
     import unittest
 

Modified: trunk/module/TEST_PyGreSQL_classic_functions.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic_functions.py     Fri Nov 20 05:44:08 
2015        (r552)
+++ trunk/module/TEST_PyGreSQL_classic_functions.py     Fri Nov 20 06:16:03 
2015        (r553)
@@ -13,7 +13,7 @@
 
 
 try:
-    import unittest2 as unittest  # for Python < 2.6
+    import unittest2 as unittest  # for Python < 2.7
 except ImportError:
     import unittest
 

Modified: trunk/module/TEST_PyGreSQL_classic_largeobj.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_classic_largeobj.py      Fri Nov 20 05:44:08 
2015        (r552)
+++ trunk/module/TEST_PyGreSQL_classic_largeobj.py      Fri Nov 20 06:16:03 
2015        (r553)
@@ -12,9 +12,10 @@
 """
 
 try:
-    import unittest2 as unittest  # for Python < 2.6
+    import unittest2 as unittest  # for Python < 2.7
 except ImportError:
     import unittest
+
 import tempfile
 
 import pg  # the module under test

Modified: trunk/module/TEST_PyGreSQL_dbapi20.py
==============================================================================
--- trunk/module/TEST_PyGreSQL_dbapi20.py       Fri Nov 20 05:44:08 2015        
(r552)
+++ trunk/module/TEST_PyGreSQL_dbapi20.py       Fri Nov 20 06:16:03 2015        
(r553)
@@ -1,8 +1,6 @@
 #! /usr/bin/python
 # $Id$
 
-from __future__ import with_statement
-
 import unittest
 import dbapi20
 import pgdb
@@ -109,24 +107,8 @@
             self.assertEqual(error.sqlstate, '22012')
 
     def test_float(self):
-        try:
-            nan = float('nan')
-        except ValueError:  # Python < 2.6
-            nan = 3.0e999 - 1.5e999999
-        try:
-            inf = float('inf')
-        except ValueError:  # Python < 2.6
-            inf = 3.0e999 * 1.5e999999
-        try:
-            from math import isnan, isinf
-        except ImportError:  # Python < 2.6
-            isnan = lambda x: x != x
-            isinf = lambda x: not isnan(x) and isnan(x * 0)
-        try:
-            from math import isnan, isinf
-        except ImportError:  # Python < 2.6
-            isnan = lambda x: x != x
-            isinf = lambda x: not isnan(x) and isnan(x * 0)
+        nan, inf = float('nan'), float('inf')
+        from math import isnan, isinf
         self.assert_(isnan(nan) and not isinf(nan))
         self.assert_(isinf(inf) and not isnan(inf))
         values = [0, 1, 0.03125, -42.53125, nan, inf, -inf]

Modified: trunk/module/pg.py
==============================================================================
--- trunk/module/pg.py  Fri Nov 20 05:44:08 2015        (r552)
+++ trunk/module/pg.py  Fri Nov 20 06:16:03 2015        (r553)
@@ -36,19 +36,11 @@
 
 import select
 import warnings
-try:
-    frozenset
-except NameError:  # Python < 2.4
-    from sets import ImmutableSet as frozenset
-try:
-    from decimal import Decimal
-    set_decimal(Decimal)
-except ImportError:  # Python < 2.4
-    Decimal = float
-try:
-    from collections import namedtuple
-except ImportError:  # Python < 2.6
-    namedtuple = None
+
+from decimal import Decimal
+from collections import namedtuple
+
+set_decimal(Decimal)
 
 
 # Auxiliary functions which are independent from a DB connection:

Modified: trunk/module/pgdb.py
==============================================================================
--- trunk/module/pgdb.py        Fri Nov 20 05:44:08 2015        (r552)
+++ trunk/module/pgdb.py        Fri Nov 20 06:16:03 2015        (r553)
@@ -64,28 +64,13 @@
 """
 
 from _pg import *
-try:
-    frozenset
-except NameError:  # Python < 2.4
-    from sets import ImmutableSet as frozenset
+
 from datetime import date, time, datetime, timedelta
 from time import localtime
-try:  # use Decimal if available
-    from decimal import Decimal
-    set_decimal(Decimal)
-except ImportError:  # otherwise (Python < 2.4)
-    Decimal = float  # use float instead of Decimal
-try:
-    from math import isnan, isinf
-except ImportError:  # Python < 2.6
-    isnan = lambda x: x != x
-    isinf = lambda x: not isnan(x) and isnan(x * 0)
-try:
-    inf = float('inf')
-    nan = float('nan')
-except ValueError:  # Python < 2.6
-    inf = 1.0e999
-    nan = inf * 0
+from decimal import Decimal
+from math import isnan, isinf
+
+set_decimal(Decimal)
 
 
 ### Module Constants

Modified: trunk/module/setup.py
==============================================================================
--- trunk/module/setup.py       Fri Nov 20 05:44:08 2015        (r552)
+++ trunk/module/setup.py       Fri Nov 20 06:16:03 2015        (r553)
@@ -1,7 +1,7 @@
 #! /usr/bin/python
 # $Id$
 
-"""Setup script for PyGreSQL version 4.1
+"""Setup script for PyGreSQL version 5.0
 
 PyGreSQL is an open-source Python module that interfaces to a
 PostgreSQL database. It embeds the PostgreSQL query library to allow
@@ -21,7 +21,7 @@
 * PostgreSQL pg_config tool (usually included in the devel package)
   (the Windows installer has it as part of the database server feature)
 
-The supported versions are Python 2.5-3.4 and PostgreSQL 8.3-9.3.
+The supported versions are Python 2.6-3.5 and PostgreSQL 9.0-9.5.
 
 Use as follows:
 python setup.py build   # to build the module
@@ -35,12 +35,12 @@
 
 """
 
-version = '4.1.1'
+version = '5.0a0'
 
 
 import sys
 
-if not (2, 5) <= sys.version_info[:2] <= (3, 4):
+if not (2, 6) <= sys.version_info[:2] <= (3, 5):
     raise Exception("Sorry, PyGreSQL %s"
         " does not support this Python version" % version)
 
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to