From 791a728c01cdaca1438b07a91fea4324ae163e23 Mon Sep 17 00:00:00 2001 From: Federico Di Gregorio Date: Tue, 10 Jan 2006 16:23:03 +0000 Subject: [PATCH] Applied patch #87 to make setup.py to not depend but just use pg_config. --- ChangeLog | 5 +++++ setup.py | 29 +++++++++++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16d9473b..de836c0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-01-11 Federico Di Gregorio + + * setup.py: does not report an error in pg_config unless the pg_config + was explicitly set (allows for building with old options.) + 2006-01-06 Daniele Varrazzo * setup.py: libpq.dll not used anymore. win32 setup uses pg_config too. diff --git a/setup.py b/setup.py index b3699092..bb0959f8 100644 --- a/setup.py +++ b/setup.py @@ -84,18 +84,20 @@ class psycopg_build_ext(build_ext): boolean_options = build_ext.boolean_options[:] boolean_options.extend(('use-pydatetime', 'use-decimal')) + DEFAULT_PG_CONFIG = "pg_config" + def initialize_options(self): build_ext.initialize_options(self) self.use_pydatetime = 1 self.use_pg_dll = 1 self.pgdir = None - self.pg_config = "pg_config" + self.pg_config = self.DEFAULT_PG_CONFIG def get_pg_config(self, kind): - p = popen2.popen3(self.pg_config + " --" + kind, mode="t") + p = popen2.popen3(self.pg_config + " --" + kind) r = p[0].readline().strip() if not r: - raise Warning(p[2].readline().strip()) + raise Warning(p[2].readline()) return r def get_compiler(self): @@ -135,10 +137,17 @@ class psycopg_build_ext(build_ext): self.include_dirs.append(".") self.libraries.append("pq") - self.library_dirs.append(self.get_pg_config("libdir")) - self.include_dirs.append(self.get_pg_config("includedir")) - self.include_dirs.append(self.get_pg_config("includedir-server")) - + try: + self.library_dirs.append(self.get_pg_config("libdir")) + self.include_dirs.append(self.get_pg_config("includedir")) + self.include_dirs.append(self.get_pg_config("includedir-server")) + except Warning, w: + if self.pg_config == self.DEFAULT_PG_CONFIG: + sys.stderr.write("Warning: %s" % str(w)) + else: + sys.stderr.write("Error: %s" % str(w)) + sys.exit(1) + if hasattr(self, "finalize_" + sys.platform): getattr(self, "finalize_" + sys.platform)() @@ -249,9 +258,9 @@ setup(name="psycopg2", maintainer_email="fog@initd.org", author="Federico Di Gregorio", author_email="fog@initd.org", - url="http://initd.org/software/initd/psycopg2", - download_url = "http://initd.org/software/initd/psycopg2", - license="GPL or ZPL", + url="http://initd.org/tracker/psycopg", + download_url = "http://initd.org/pub/software/psycopg2", + license="GPL with exceptions or ZPL", platforms = ["any"], description=__doc__.split("\n")[0], long_description="\n".join(__doc__.split("\n")[2:]),