mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Better error message about missing headers (Closes: #9).
This commit is contained in:
parent
4805a93569
commit
1430849c81
|
@ -1,5 +1,8 @@
|
||||||
2005-04-10 Federico Di Gregorio <fog@debian.org>
|
2005-04-10 Federico Di Gregorio <fog@debian.org>
|
||||||
|
|
||||||
|
* setup.py: Added extensive error message on missing datetime
|
||||||
|
headers.
|
||||||
|
|
||||||
* Applied mingw patch from Daniele Varazzo.
|
* Applied mingw patch from Daniele Varazzo.
|
||||||
|
|
||||||
2005-04-03 Federico Di Gregorio <fog@debian.org>
|
2005-04-03 Federico Di Gregorio <fog@debian.org>
|
||||||
|
|
32
setup.py
32
setup.py
|
@ -11,6 +11,7 @@
|
||||||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
|
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
|
||||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
# for more details.
|
# for more details.
|
||||||
|
|
||||||
"""Python-PostgreSQL Database Adapter
|
"""Python-PostgreSQL Database Adapter
|
||||||
|
|
||||||
psycopg is a PostgreSQL database adapter for the Python programming
|
psycopg is a PostgreSQL database adapter for the Python programming
|
||||||
|
@ -58,19 +59,19 @@ version_flags = []
|
||||||
|
|
||||||
# to work around older distutil limitations
|
# to work around older distutil limitations
|
||||||
if sys.version < '2.2.3':
|
if sys.version < '2.2.3':
|
||||||
from distutils.dist import DistributionMetadata
|
from distutils.dist import DistributionMetadata
|
||||||
DistributionMetadata.classifiers = None
|
DistributionMetadata.classifiers = None
|
||||||
DistributionMetadata.download_url = None
|
DistributionMetadata.download_url = None
|
||||||
|
|
||||||
class psycopg_build_ext(build_ext):
|
class psycopg_build_ext(build_ext):
|
||||||
"""Conditionally complement the setup.cfg options file.
|
"""Conditionally complement the setup.cfg options file.
|
||||||
|
|
||||||
This class configures the include_dirs, libray_dirs, libraries options as
|
This class configures the include_dirs, libray_dirs, libraries
|
||||||
required by the system. Most of the configuration happens in
|
options as required by the system. Most of the configuration happens
|
||||||
finalize_options() method.
|
in finalize_options() method.
|
||||||
|
|
||||||
If you want to set up the build step for a peculiar platform, add a method
|
If you want to set up the build step for a peculiar platform, add a
|
||||||
finalize_PLAT(), where PLAT matches your sys.platform.
|
method finalize_PLAT(), where PLAT matches your sys.platform.
|
||||||
"""
|
"""
|
||||||
user_options = build_ext.user_options[:]
|
user_options = build_ext.user_options[:]
|
||||||
user_options.extend([
|
user_options.extend([
|
||||||
|
@ -99,6 +100,7 @@ class psycopg_build_ext(build_ext):
|
||||||
|
|
||||||
Address issues related to the different environmental configurations
|
Address issues related to the different environmental configurations
|
||||||
that can be met:
|
that can be met:
|
||||||
|
|
||||||
* msvc or gcc derived (mingw, cygwin) compiler;
|
* msvc or gcc derived (mingw, cygwin) compiler;
|
||||||
* source or bin PostgreSQL installation
|
* source or bin PostgreSQL installation
|
||||||
* static or dynamic linking vs. libpq.dll
|
* static or dynamic linking vs. libpq.dll
|
||||||
|
@ -179,6 +181,7 @@ class psycopg_build_ext(build_ext):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
__libpqdll = None
|
__libpqdll = None
|
||||||
|
|
||||||
def find_libpq_dll(self, *dirs):
|
def find_libpq_dll(self, *dirs):
|
||||||
"""Return the full libpq.dll path and name."""
|
"""Return the full libpq.dll path and name."""
|
||||||
if self.__libpqdll:
|
if self.__libpqdll:
|
||||||
|
@ -205,6 +208,7 @@ class psycopg_build_ext(build_ext):
|
||||||
|
|
||||||
# let's start with macro definitions (the ones not already in setup.cfg)
|
# let's start with macro definitions (the ones not already in setup.cfg)
|
||||||
define_macros = []
|
define_macros = []
|
||||||
|
include_dirs = []
|
||||||
|
|
||||||
# python version
|
# python version
|
||||||
define_macros.append(('PY_MAJOR_VERSION', str(sys.version_info[0])))
|
define_macros.append(('PY_MAJOR_VERSION', str(sys.version_info[0])))
|
||||||
|
@ -260,9 +264,14 @@ if have_pydatetime and use_pydatetime \
|
||||||
elif have_mxdatetime:
|
elif have_mxdatetime:
|
||||||
define_macros.append(('PSYCOPG_DEFAULT_MXDATETIME','1'))
|
define_macros.append(('PSYCOPG_DEFAULT_MXDATETIME','1'))
|
||||||
else:
|
else:
|
||||||
sys.stderr.write("error: psycopg requires a datetime module:\n")
|
def e(msg):
|
||||||
sys.stderr.write("error: mx.DateTime module not found\n")
|
sys.stderr.write("error: " + msg + "\n")
|
||||||
sys.stderr.write("error: python datetime module not found\n")
|
e("psycopg requires a datetime module:")
|
||||||
|
e(" mx.DateTime module not found")
|
||||||
|
e(" python datetime module not found")
|
||||||
|
e("Note that psycopg needs the module headers and not just the module")
|
||||||
|
e("itself. If you installed Python or mx.DateTime from a binary package")
|
||||||
|
e("you probably need to install its companion -dev or -devel package.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# generate a nice version string to avoid confusion when users report bugs
|
# generate a nice version string to avoid confusion when users report bugs
|
||||||
|
@ -292,6 +301,7 @@ sources = map(lambda x: os.path.join('psycopg', x), sources)
|
||||||
|
|
||||||
ext.append(Extension("psycopg._psycopg", sources,
|
ext.append(Extension("psycopg._psycopg", sources,
|
||||||
define_macros=define_macros,
|
define_macros=define_macros,
|
||||||
|
include_dirs=include_dirs,
|
||||||
undef_macros=[]))
|
undef_macros=[]))
|
||||||
|
|
||||||
setup(name="psycopg",
|
setup(name="psycopg",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user