mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-14 04:56:33 +03:00
Don't build mx.DateTime support if the module can't be imported
Previously we only checked for the existence of the include files, but this doesn't imply the presence of the module. Particularly true in restricted environments such as virtualenv. Closes ticket #53.
This commit is contained in:
parent
c687f1d816
commit
af424821b7
7
NEWS
7
NEWS
|
@ -1,3 +1,10 @@
|
||||||
|
What's new in psycopg 2.4.2
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Don't build mx.DateTime support if the module can't be imported
|
||||||
|
(ticket #53).
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.4.1
|
What's new in psycopg 2.4.1
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -450,6 +450,12 @@ if parser.has_option('build_ext', 'mx_include_dir'):
|
||||||
else:
|
else:
|
||||||
mxincludedir = os.path.join(get_python_inc(plat_specific=1), "mx")
|
mxincludedir = os.path.join(get_python_inc(plat_specific=1), "mx")
|
||||||
if os.path.exists(mxincludedir):
|
if os.path.exists(mxincludedir):
|
||||||
|
# Check if mx.datetime is importable at all: see ticket #53
|
||||||
|
try:
|
||||||
|
import mx.DateTime
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
include_dirs.append(mxincludedir)
|
include_dirs.append(mxincludedir)
|
||||||
define_macros.append(('HAVE_MXDATETIME','1'))
|
define_macros.append(('HAVE_MXDATETIME','1'))
|
||||||
sources.append('adapter_mxdatetime.c')
|
sources.append('adapter_mxdatetime.c')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user