Fixed setup script to handle PostgreSQL devel version strings

This commit is contained in:
Federico Di Gregorio 2009-03-21 12:54:44 +01:00
parent 825a60eec5
commit 850423d8fc

View File

@ -206,7 +206,14 @@ class psycopg_build_ext(build_ext):
pgversion = self.get_pg_config("version").split()[1]
except:
pgversion = "7.4.0"
pgmajor, pgminor, pgpatch = pgversion.split('.')
try:
pgmajor, pgminor, pgpatch = pgversion.split('.')
except:
# Mm.. development version?
pgmajor, pgminor = pgversion.replace("devel", "").split('.')
pgminor = 0
define_macros.append(("PG_VERSION_HEX", "0x%02X%02X%02X" %
(int(pgmajor), int(pgminor), int(pgpatch))))
except Warning, w: