Subject: pkg/23830: databases/py-PgSQL uses a pkgsrc-incompatible library and include paths detection system
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <dotz@irc.pl>
List: netbsd-bugs
Date: 12/21/2003 19:09:35
>Number:         23830
>Category:       pkg
>Synopsis:       databases/py-PgSQL uses a pkgsrc-incompatible library and include paths detection system
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 21 19:10:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Michal Pasternak
>Release:        N/A
>Organization:
Good people with bad reputation
>Environment:
FreeBSD mainframe.w.lub.pl 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Mon Oct 27 17:51:09 GMT 2003     root@freebsd-stable.sentex.ca:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
py-PgSQL's setup.py gets paths to PostgreSQL includes basing on sys.platform so it is quite not compatible with pkgsrc. See the file for details.

As pkgsrc should handle libs, paths and such, I therefore suggest we drop autodetection of path from py-PgSQL's setup.py and make it dependent on Pkgsrc.
>How-To-Repeat:
Try to install py-PgSQL on any non-NetBSD system using pkgsrc (FreeBSD, Linux, anything else)
>Fix:
apply the following files as patches/patch-ab; make mdi and recompile:


$NetBSD$

--- setup.py~   Mon Jul 14 23:02:02 2003
+++ setup.py    Sun Dec 21 19:05:12 2003
@@ -97,66 +97,10 @@
        "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[:8] == "openunix":
-       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"]
-
+    LOCALBASE = os.environ.get('LOCALBASE', '/usr/pkg')
+    include_dirs = ['%s/include/pgsql' % LOCALBASE]
+    library_dirs = ['%s/lib' % LOCALBASE]
+    
     # patch distutils if it can't cope with the "classifiers" keyword
     if sys.version < '2.2.3':
        from distutils.dist import DistributionMetadata

>Release-Note:
>Audit-Trail:
>Unformatted: