Author: cito
Date: Tue Jan 29 13:34:05 2013
New Revision: 517
Log:
Set a better default for the user option "escaping-funcs".
Modified:
trunk/module/setup.py
Modified: trunk/module/setup.py
==============================================================================
--- trunk/module/setup.py Wed Jan 9 07:34:17 2013 (r516)
+++ trunk/module/setup.py Tue Jan 29 13:34:05 2013 (r517)
@@ -68,6 +68,17 @@
return d
+def pg_version():
+ """Return the PostgreSQL version as a tuple of integers."""
+ parts = []
+ for part in pg_config('version').split()[-1].split('.'):
+ if part.isdigit():
+ part = int(part)
+ parts.append(part)
+ return tuple(parts or [8])
+
+
+pg_version = pg_version()
py_modules = ['pg', 'pgdb']
libraries = ['pq']
# Make sure that the Python header files are searched before
@@ -95,7 +106,7 @@
"enable string escaping functions")]
boolean_options = build_ext.boolean_options + [
- 'direct-access', 'large-objects', 'default-vars']
+ 'direct-access', 'large-objects', 'default-vars', 'escaping-funcs']
def get_compiler(self):
"""Return the C compiler used for building the extension."""
@@ -103,10 +114,10 @@
def initialize_options(self):
build_ext.initialize_options(self)
- self.direct_access = 1
- self.large_objects = 1
- self.default_vars = 1
- self.escaping_funcs = 1
+ self.direct_access = True
+ self.large_objects = True
+ self.default_vars = True
+ self.escaping_funcs = pg_version[0] >= 9
def finalize_options(self):
"""Set final values for all build_pg options."""
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql