diff options
| author | Federico Di Gregorio <fog@initd.org> | 2005-11-15 16:05:15 +0000 |
|---|---|---|
| committer | Federico Di Gregorio <fog@initd.org> | 2005-11-15 16:05:15 +0000 |
| commit | 96b254193998ea273080a5413f241ac96ba4915f (patch) | |
| tree | 813919ce4b415b799e0b4953261c0a936625678d /lib/__init__.py | |
| parent | 65fe7db04d73c15b6fd4098c9caf97ca447b080b (diff) | |
| download | psycopg2-96b254193998ea273080a5413f241ac96ba4915f.tar.gz | |
Better fix for py2exe and related tools.
Diffstat (limited to 'lib/__init__.py')
| -rw-r--r-- | lib/__init__.py | 18 |
1 files changed, 17 insertions, 1 deletions
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 |
