Better fix for py2exe and related tools.

This commit is contained in:
Federico Di Gregorio 2005-11-15 16:05:15 +00:00
parent 65fe7db04d
commit 96b2541939
3 changed files with 28 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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=