From: Gerhard H?r. <gha...@us...> - 2002-12-01 16:18:15
|
Update of /cvsroot/pypgsql/pypgsql In directory sc8-pr-cvs1:/tmp/cvs-serv7132 Modified Files: setup.py Removed Files: setup.config Log Message: 01DEC2002 gh Simplified build process and got rid of setup.config. setup.config prevented the bdist_rpm command of dist- utils to work and generally wasn't such a good idea as it looked first. Pretty much the same effect is now reached by the USE_CUSTOM variable with which users can override the platform detection. Index: setup.py =================================================================== RCS file: /cvsroot/pypgsql/pypgsql/setup.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** setup.py 27 Oct 2002 03:47:27 -0000 1.19 --- setup.py 1 Dec 2002 16:14:11 -0000 1.20 *************** *** 1,4 **** --- 1,5 ---- #!/usr/bin/env python #ident "@(#) $Id$" + # vi:set sw=4 ts=8 showmode ai: #-----------------------------------------------------------------------+ # Name: setup.py | *************** *** 44,53 **** # Date Ini Description | # --------- --- ------------------------------------------------------- | # 06OCT2002 bga Added support for UnixWare7 and OpenUNIX 8. | # 16SEP2002 gh Total rework to make setup.py work out of the box for | ! # most popular platforms, while still allowing flexibi- | ! # lity through setup.config. | # 29AUG2001 gh Reflected changed PostgreSQL win32 build process (Post- | ! # greSQL now built with mingw32) | # 28AUG2001 bga Add include_dirs and lib_dirs for building on cygwin. | # This change should allow pyPgSQL to build 'out of the | --- 45,60 ---- # Date Ini Description | # --------- --- ------------------------------------------------------- | + # 01DEC2002 gh Simplified build process and got rid of setup.config. | + # setup.config prevented the bdist_rpm command of dist- | + # utils to work and generally wasn't such a good idea as | + # it looked first. Pretty much the same effect is now | + # reached by the USE_CUSTOM variable with which users | + # can override the platform detection. | # 06OCT2002 bga Added support for UnixWare7 and OpenUNIX 8. | # 16SEP2002 gh Total rework to make setup.py work out of the box for | ! # most popular platforms, while still allowing flexibi- | ! # lity through setup.config. | # 29AUG2001 gh Reflected changed PostgreSQL win32 build process (Post- | ! # greSQL now built with mingw32) | # 28AUG2001 bga Add include_dirs and lib_dirs for building on cygwin. | # This change should allow pyPgSQL to build 'out of the | *************** *** 68,174 **** from distutils.extension import Extension ! __version__ = "2.3b1" # Define the runtime library path for this module. It starts out as None. ! class UnknownPlatformError(Exception): ! pass ! ! def getLinuxDistribution(): ! f = open("/etc/issue") ! issue = f.read() ! f.close() ! if issue.find("Debian GNU") >= 0: ! return "Debian" ! elif issue.find("Red Hat Linux") >= 0: ! return "Redhat" ! elif issue.find("SuSE Linux") >= 0: ! return "SuSE" ! elif issue.find("Mandrake") >= 0: ! return "Mandrake" ! else: ! return "unknown" ! ! class Config: ! def __init__(self): ! # Default settings, may be overriden for specific platforms ! self.pypgsql_rt_dirs = None ! self.optional_libs = ["pq"] ! self.modname = "pyPgSQL.libpq.libpqmodule" ! ! self.sources = ["libpqmodule.c", "pgboolean.c", ! "pgint2object.c", "pgint8object.c", ! "pgversion.c", "pglargeobject.c", ! "pgnotify.c", "pgconnection.c", ! "pgresult.c", "pymemstrdup.c", ! "port/strtoll.c", "port/strtoull.c", ! "port/strtok.c"] ! imported_locals = {} ! execfile("setup.config", {}, imported_locals) ! self.use_custom = len(imported_locals) > 0 ! if self.use_custom: ! for k, v in imported_locals.items(): ! self.__dict__[k] = v ! def main(): ! cfg = Config() ! if cfg.use_custom: ! pass elif sys.platform == "linux2": ! distribution = getLinuxDistribution() ! if distribution == "Redhat": ! cfg.include_dirs = ["/usr/include"] ! cfg.library_dirs = ["/usr/lib"] ! elif distribution == "Debian": ! cfg.include_dirs = ["/usr/include/postgresql"] ! cfg.library_dirs = ["/usr/lib"] ! elif distribution in ("SuSE", "Mandrake"): ! cfg.include_dirs = ["/usr/include/pgsql"] ! cfg.library_dirs = ["/usr/lib"] ! else: ! raise UnknownPlatformError, "Unknown Linux distribution." # XXX: This is an ugly hack to make bdist_rpm find the include files. ! cfg.include_dirs.append("../" * 5) elif sys.platform[:8] == "unixware": LOCALBASE = os.environ.get('LOCALBASE', '/usr/local/pgsql') ! cfg.include_dirs = ['%s/include' % LOCALBASE] ! cfg.library_dirs = ['%s/lib' % LOCALBASE] ! cfg.pypgsql_rt_dirs = cfg.library_dirs elif sys.platform == "freebsd4": LOCALBASE = os.environ.get('LOCALBASE', '/usr/local') ! cfg.include_dirs = ['%s/include' % LOCALBASE] ! cfg.library_dirs = ['%s/lib' % LOCALBASE] elif sys.platform == "openbsd3": LOCALBASE = os.environ.get('LOCALBASE', '/usr/local') ! cfg.include_dirs = ['%s/include/postgresql' % LOCALBASE] ! cfg.library_dirs = ['%s/lib' % LOCALBASE] elif sys.platform == "netbsd1": LOCALBASE = os.environ.get('LOCALBASE', '/usr/pkg') ! cfg.include_dirs = ['%s/include/pgsql' % LOCALBASE] ! cfg.library_dirs = ['%s/lib' % LOCALBASE] elif sys.platform == "cygwin": ! cfg.include_dirs = ["/usr/include/postgresql"] ! cfg.library_dirs = ["/usr/lib"] elif sys.platform == "darwin": # Mac OS X ! cfg.include_dirs = ["/usr/local/pgsql/include"] ! cfg.library_dirs = ["/usr/local/pgsql/lib"] ! cfg.optional_libs += ["ssl", "crypto"] elif sys.platform == "win32": # This works with the PostgreSQL source tree, so it's a bit ugly ... win_pg_build_root = os.getenv("PG_SRC", "../postgresql") ! cfg.include_dirs = [os.path.join(win_pg_build_root, p) for p in ! ["src/include", ! "src/include/libpq", ! "src", ! "src/interfaces/libpq"]] ! cfg.library_dirs = [win_pg_build_root + "/src/interfaces/libpq/"] ! cfg.optional_libs += ["wsock32", "advapi32"] ! cfg.modname="pyPgSQL.libpq.libpq" else: ! raise UnknownPlatformError, "Unknown platform." setup ( --- 75,153 ---- from distutils.extension import Extension ! __version__ = "2.3" # Define the runtime library path for this module. It starts out as None. ! def main(): ! # Set this to 1 if you need to use your own settings ! USE_CUSTOM = 0 ! # Default settings, may be overriden for specific platforms ! pypgsql_rt_dirs = None ! optional_libs = ["pq"] ! modname = "pyPgSQL.libpq.libpqmodule" ! sources = ["libpqmodule.c", "pgboolean.c", ! "pgint2object.c", "pgint8object.c", ! "pgversion.c", "pglargeobject.c", ! "pgnotify.c", "pgconnection.c", ! "pgresult.c", "pymemstrdup.c", ! "port/strtoll.c", "port/strtoull.c", ! "port/strtok.c"] ! if USE_CUSTOM: ! include_dirs = YOUR_LIST_HERE ! library_dirs = YOUR_LIST_HERE elif sys.platform == "linux2": ! include_dirs = ["/usr/include", "/usr/include/postgresql", ! "/usr/include/pgsql"] ! library_dirs = ["/usr/lib"] ! # XXX: This is an ugly hack to make bdist_rpm find the include files. ! include_dirs.append("../" * 5) elif sys.platform[:8] == "unixware": LOCALBASE = os.environ.get('LOCALBASE', '/usr/local/pgsql') ! include_dirs = ['%s/include' % LOCALBASE] ! library_dirs = ['%s/lib' % LOCALBASE] ! pypgsql_rt_dirs = library_dirs elif sys.platform == "freebsd4": LOCALBASE = os.environ.get('LOCALBASE', '/usr/local') ! include_dirs = ['%s/include' % LOCALBASE] ! library_dirs = ['%s/lib' % LOCALBASE] elif sys.platform == "openbsd3": LOCALBASE = os.environ.get('LOCALBASE', '/usr/local') ! include_dirs = ['%s/include/postgresql' % LOCALBASE] ! library_dirs = ['%s/lib' % LOCALBASE] elif sys.platform == "netbsd1": LOCALBASE = os.environ.get('LOCALBASE', '/usr/pkg') ! include_dirs = ['%s/include/pgsql' % LOCALBASE] ! library_dirs = ['%s/lib' % LOCALBASE] elif sys.platform == "cygwin": ! include_dirs = ["/usr/include/postgresql"] ! library_dirs = ["/usr/lib"] elif sys.platform == "darwin": # Mac OS X ! include_dirs = ["/usr/local/pgsql/include"] ! library_dirs = ["/usr/local/pgsql/lib"] ! optional_libs += ["ssl", "crypto"] elif sys.platform == "win32": # This works with the PostgreSQL source tree, so it's a bit ugly ... + # Lines commented out are for using MSVC instead of mingw win_pg_build_root = os.getenv("PG_SRC", "../postgresql") ! include_dirs = [os.path.join(win_pg_build_root, p) for p in ! ["src/include", ! "src/include/libpq", ! "src", ! "src/interfaces/libpq"]] ! library_dirs = [win_pg_build_root + "/src/interfaces/libpq"] ! #library_dirs = [win_pg_build_root + "/src/interfaces/libpq/Release"] ! optional_libs += ["wsock32", "advapi32"] ! #optional_libs = ["libpq", "wsock32", "advapi32"] ! modname="pyPgSQL.libpq.libpq" else: ! # Assume a Unixish system ! include_dirs = ["/usr/local/include"] ! library_dirs = ["/usr/local/lib"] setup ( *************** *** 177,207 **** description = \ "pyPgSQL - A Python DB-API 2.0 compliant interface to PostgreSQL.", ! author = "Billy G. Allie", ! author_email = "bal...@so...", url = "http://pypgsql.sourceforge.net/", licence = "Python", packages = ["pyPgSQL", "pyPgSQL.libpq"], ext_modules = [Extension( ! name=cfg.modname, ! sources = cfg.sources, ! include_dirs = cfg.include_dirs, ! library_dirs = cfg.library_dirs, ! runtime_library_dirs = cfg.pypgsql_rt_dirs, ! libraries = cfg.optional_libs )] ) if __name__ == "__main__": ! try: ! main() ! except UnknownPlatformError, reason: ! print "Cannot build pyPgSQL:", reason ! print ! print "setup.py can't guess the correct settings for your platform." ! print ! print "Please manually edit setup.conf appropriately for your platform." ! print "If you have any problems, please ask on the pypgsql-users mailing list." ! print ! print "Once you've managed to build pyPgSQL on your platform, please submit a" ! print "patch to setup.py so that we can support your platform by default in" ! print "the future. The pyPgSQL developers are happy to assist you in doing so." --- 156,174 ---- description = \ "pyPgSQL - A Python DB-API 2.0 compliant interface to PostgreSQL.", ! maintainer = "pyPgSQL developers", ! maintainer_email = "pyp...@li...", url = "http://pypgsql.sourceforge.net/", licence = "Python", packages = ["pyPgSQL", "pyPgSQL.libpq"], ext_modules = [Extension( ! name=modname, ! sources = sources, ! include_dirs = include_dirs, ! library_dirs = library_dirs, ! runtime_library_dirs = pypgsql_rt_dirs, ! libraries = optional_libs )] ) if __name__ == "__main__": ! main() --- setup.config DELETED --- |