summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/__init__.py18
-rw-r--r--setup.cfg11
3 files changed, 28 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f4f4951..d63f89d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-16 Federico Di Gregorio <fog@initd.org>
+
+ * lib/__init__.py: very nice hack from Harald Armin Massa to allow
+ py2exe and similar tools to do their work without problems.
+
2005-11-15 Federico Di Gregorio <fog@initd.org>
* psycopg/psycopgmodule.c: now bails out with correct exception when one
diff --git a/lib/__init__.py b/lib/__init__.py
index 0e87211..e738ffe 100644
--- a/lib/__init__.py
+++ b/lib/__init__.py
@@ -20,7 +20,23 @@ small and fast, and stable as a rock.
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
-# import the DBAPI-2.0 stuff into top-level module
+# Import modules needed by _psycopg to allow tools like py2exe to do
+# their work without bothering about the module dependencies.
+#
+# TODO: we should probably use the Warnings framework to signal a missing
+# module instead of raising an exception (in case we're running a thin
+# embedded Python or something even more devious.)
+
+import sys
+if sys.version_info[0] >= 2 and sys.version_info[1] >= 3:
+ import datetime as _psycopg_needs_datetime
+if sys.version_info[0] >= 2 and sys.version_info[1] >= 4:
+ import decimal as _psycopg_needs_decimal
+from psycopg2 import tz
+del sys
+
+# Import the DBAPI-2.0 stuff into top-level module.
+
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
from _psycopg import Binary, Date, Time, Timestamp
diff --git a/setup.cfg b/setup.cfg
index 54a2edf..220e5a6 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,17 +2,18 @@
define=PSYCOPG_DEBUG,PSYCOPG_EXTENSIONS,PSYCOPG_DISPLAY_SIZE,HAVE_PQFREEMEM,HAVE_PQPROTOCOL3
# PSYCOPG_EXTENSIONS enables extensions to PEP-249 (you really want this)
# PSYCOPG_DISPLAY_SIZE enable display size calculation (a little slower)
-# HAVE_PQFREEMEM should be defined on PostgreSQL >= 7.4
-# HAVE_PQPROTOCOL3 should be defined on PostgreSQL >= 8.0
+# HAVE_PQFREEMEM should be defined on PostgreSQL >= 7.3
+# HAVE_PQPROTOCOL3 should be defined on PostgreSQL >= 7.4
# PSYCOPG_DEBUG can be added to enable verbose debug information
-# PSYCOPG_OWN_QUOTING can be added above but it is deprecated
+# PSYCOPG_OWN_QUOTING can be added, but it is deprecated (will go away in 2.1)
# Set to 1 to use Python datatime objects for default date/time representation
use_pydatetime=1
# Set to 1 if you want to enable "Decimal" type on python 2.3.
# If the "decimal" module is found in the PYTHONPATH it will be used, else
-# fall back on the float type.
+# fall back on the float type (this is disabled by default to be compatible
+# with old versions of psycopg 1 and pre-beta versions of psycopg 2.)
use_decimal=0
# "include_dirs" is the preferred method for locating postgresql headers,
@@ -25,7 +26,7 @@ include_dirs=.:/usr/include/postgresql:/usr/include/postgresql/server
#include_dirs=.:/usr/include/pgsql:/usr/include/pgsql/server
# If postgresql is installed somewhere weird (i.e., not in your runtime library
-# path like /usr/lib), just add the right path in "library_dir" any extra
+# path like /usr/lib), just add the right path in "library_dirs" any extra
# libraries required to link in "libraries".
#library_dirs=
#libraries=