mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 17:06:33 +03:00
Appliet Jasons patch to fix win32 build glitches.
This commit is contained in:
parent
f57920b0dd
commit
ee44315ff2
|
@ -1,3 +1,7 @@
|
|||
2007-04-12 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* Applied patch from Jason Erickson to fix win32 build glitches.
|
||||
|
||||
2007-04-11 Federico Di Gregorio <fog@initd.org>
|
||||
|
||||
* Release 2.0.6b2.
|
||||
|
|
|
@ -21,6 +21,11 @@ use_decimal=0
|
|||
# uncommenting the following line and setting its value to the right path.
|
||||
#mx_include_dir=
|
||||
|
||||
# For Windows only
|
||||
# Set to 1 if the PostgreSQL library was built with OpenSSL
|
||||
# Required to link in OpenSSL libraries and dependencies
|
||||
have_ssl=0
|
||||
|
||||
# "pg_config" is the preferred method to locate PostgreSQL headers and
|
||||
# libraries needed to build psycopg2. If pg_config is not in the path or
|
||||
# is installed under a different name uncomment the following option and
|
||||
|
|
59
setup.py
59
setup.py
|
@ -90,10 +90,12 @@ class psycopg_build_ext(build_ext):
|
|||
"The name of the pg_config binary and/or full path to find it"),
|
||||
('use-decimal', None,
|
||||
"Use Decimal type even on Python 2.3 if the module is provided."),
|
||||
('have-ssl', None,
|
||||
"Compile with OpenSSL built PostgreSQL libraries (Windows only)."),
|
||||
])
|
||||
|
||||
boolean_options = build_ext.boolean_options[:]
|
||||
boolean_options.extend(('use-pydatetime', 'use-decimal'))
|
||||
boolean_options.extend(('use-pydatetime', 'use-decimal', 'have-ssl'))
|
||||
|
||||
DEFAULT_PG_CONFIG = "pg_config"
|
||||
|
||||
|
@ -179,6 +181,11 @@ class psycopg_build_ext(build_ext):
|
|||
if os.path.isfile(os.path.join(path, "ms", "libpq.lib")):
|
||||
self.library_dirs.append(os.path.join(path, "ms"))
|
||||
break
|
||||
if have_ssl:
|
||||
self.libraries.append("libeay32")
|
||||
self.libraries.append("ssleay32")
|
||||
self.libraries.append("user32")
|
||||
self.libraries.append("gdi32")
|
||||
|
||||
def finalize_darwin(self):
|
||||
"""Finalize build system configuration on darwin platform."""
|
||||
|
@ -256,29 +263,34 @@ class psycopg_build_ext(build_ext):
|
|||
pg_config_path = None
|
||||
|
||||
reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
|
||||
pg_inst_list_key = _winreg.OpenKey(reg,
|
||||
'SOFTWARE\\PostgreSQL\\Installations'
|
||||
)
|
||||
try:
|
||||
# Determine the name of the first subkey, if any:
|
||||
try:
|
||||
first_sub_key_name = _winreg.EnumKey(pg_inst_list_key, 0)
|
||||
except EnvironmentError:
|
||||
first_sub_key_name = None
|
||||
pg_inst_list_key = _winreg.OpenKey(reg,
|
||||
'SOFTWARE\\PostgreSQL\\Installations'
|
||||
)
|
||||
except EnvironmentError:
|
||||
pg_inst_list_key = None
|
||||
|
||||
if first_sub_key_name is not None:
|
||||
pg_first_inst_key = _winreg.OpenKey(reg,
|
||||
'SOFTWARE\\PostgreSQL\\Installations\\'
|
||||
+ first_sub_key_name
|
||||
)
|
||||
if pg_inst_list_key is not None:
|
||||
try:
|
||||
# Determine the name of the first subkey, if any:
|
||||
try:
|
||||
pg_inst_base_dir = _winreg.QueryValueEx(
|
||||
pg_first_inst_key, 'Base Directory'
|
||||
)[0]
|
||||
finally:
|
||||
_winreg.CloseKey(pg_first_inst_key)
|
||||
finally:
|
||||
_winreg.CloseKey(pg_inst_list_key)
|
||||
first_sub_key_name = _winreg.EnumKey(pg_inst_list_key, 0)
|
||||
except EnvironmentError:
|
||||
first_sub_key_name = None
|
||||
|
||||
if first_sub_key_name is not None:
|
||||
pg_first_inst_key = _winreg.OpenKey(reg,
|
||||
'SOFTWARE\\PostgreSQL\\Installations\\'
|
||||
+ first_sub_key_name
|
||||
)
|
||||
try:
|
||||
pg_inst_base_dir = _winreg.QueryValueEx(
|
||||
pg_first_inst_key, 'Base Directory'
|
||||
)[0]
|
||||
finally:
|
||||
_winreg.CloseKey(pg_first_inst_key)
|
||||
finally:
|
||||
_winreg.CloseKey(pg_inst_list_key)
|
||||
|
||||
if pg_inst_base_dir and os.path.exists(pg_inst_base_dir):
|
||||
pg_config_path = os.path.join(pg_inst_base_dir, 'bin',
|
||||
|
@ -384,6 +396,11 @@ if not PLATFORM_IS_WINDOWS:
|
|||
else:
|
||||
define_macros.append(('PSYCOPG_VERSION', '\\"'+PSYCOPG_VERSION_EX+'\\"'))
|
||||
|
||||
if parser.has_option('build_ext', 'have_ssl'):
|
||||
have_ssl = int(parser.get('build_ext', 'have_ssl'))
|
||||
else:
|
||||
have_ssl = 0
|
||||
|
||||
# build the extension
|
||||
|
||||
sources = map(lambda x: os.path.join('psycopg', x), sources)
|
||||
|
|
Loading…
Reference in New Issue
Block a user