[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Frustration -- I fixed it

From: Stanley A. Klein
Subject: Re: Frustration -- I fixed it
Date: Tue, 22 Oct 2002 14:14:57

My problem turned out to be the pypgsql rpm's that I downloaded from  They had been configured for an installation other than my
Red Hat 7.2 system, with "include" files and libraries expected in places
that Red Hat doesn't put them.

Although the core team members prefer psycopg, I can't use it at present.
It only comes as deb packages.  I tried to install alien, that converts
between deb and rpm packages, but I ran into dependency problems.  In any
event, I suspect I would have had a similar problem using psycopg if its
assumed installation file locations were not the same as Red Hat provides.
I also have read that pypgsql and psycopg are closely related (IIRC they
are somehow versions of a common code base with differences in

The in the pypgsql source package has three alternatives for the
locations of includes and libraries.  Two are commented out.  The Red Hat
installation requires one of the commented-out alternatives.

What I needed to do was to obtain and install the source rpm package and
prepare a patch for that commented out the applicable lines used
in the file and uncommented the lines needed for a Red Hat system.  Then I
had to modify the rpm spec file to have the patch applied during the rpm
build.  (I also needed to modify the spec file to properly call my version
of python, but after checking the original python package I'm not sure why
I had that problem.)

The resulting rpm package worked, although I had other problems that were
easy to fix.  Somehow, the package built an rpm that installed in
/usr/lib/python2.2/site-packages (even though I built the rpm with python
2.1 and there isn't anything else in the python 2.2 directory), but I
symlinked it over to /usr/lib/python2.1/site-packages, where it needed to
be.  I also had to install the rpm with the "--nodeps" option because I
knew I had the dependencies and didn't want to try to straighten out the
dependency tracking issue.

The way to diagnose the problem originally was to go directly into
python2.1 and do "from pyPgSQL import PgSQL".  If you get a traceback with
an error of "ImportError: : shared object not open" then you have this type
of problem.  

I've attached copies of the patch file and the spec file.  The patch file
is not exactly complete.  During the build, rpm asked me to supply the name
of the file to be patched.  That shouldn't have been required with a
complete patch file.

Stan Klein

*** pypgsql.orig/       Mon Oct 21 20:13:55 2002
--- pypgsql/    Mon Oct 21 20:17:13 2002
*** 78,88 ****
  # on your system

! include_dirs  = [ "/usr/local/pgsql/include" ]
  # include_dirs  = [ "/usr/local/include/pgsql" ]      # Common alternative
! # include_dirs  = [ "/usr/include/pgsql" ]            # Common alternative

! library_dirs  = [ "/usr/local/pgsql/lib" ]            # Common alternative
  # library_dirs  = [ "/usr/local/lib/pgsql" ]          # Common alternative
! # library_dirs  = [ "/usr/lib/pgsql" ]

  optional_libs = [ "pq" ]
--- 78,88 ----
  # on your system

! # include_dirs  = [ "/usr/local/pgsql/include" ]
  # include_dirs  = [ "/usr/local/include/pgsql" ]      # Common alternative
! include_dirs  = [ "/usr/include/pgsql" ]              # Common alternative

! # library_dirs  = [ "/usr/local/pgsql/lib" ]          # Common alternative
  # library_dirs  = [ "/usr/local/lib/pgsql" ]          # Common alternative
! library_dirs  = [ "/usr/lib/pgsql" ]

  optional_libs = [ "pq" ]


%define name pyPgSQL
%define version 2.1
%define release 1

Summary: pyPgSQL - A Python DB-API 2.0 compliant interface to PostgreSQL.
Name: %{name}
Version: %{version}
Release: %{release}
Source0: pypgsql-%{version}.tar.gz
Patch0: pypgsql-patch0.patch
Copyright: distributable
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}
Vendor: Billy G. Allie <address@hidden>
Requires: egenix-mx-base
Requires: python2

pyPgSQL is a package of two modules that provide a Python DB-API 2.0
compliant interface to PostgreSQL databases. The first module, libpq,
exports the PostgreSQL C API to Python. This module is written in C and
can be compiled into Python or can be dynamically loaded on demand. The
second module, PgSQL, provides the DB-API 2.0 compliant interface and
support for various PostgreSQL data types, such as INT8, NUMERIC, MONEY,
BOOL, ARRAYS, etc. This module is written in Python.

%setup -n pypgsql
%patch0  -p0

env CFLAGS="$RPM_OPT_FLAGS" /usr/bin/python2.1 build

/usr/bin/python2.1 install --root=$RPM_BUILD_ROOT



* Fri Sep 06 2002 Sean Reifschneider <address@hidden>
- Updated to version 2.1.
- Added a description.
- Added dependencies on egenix-mx-base and python2
+ October 20 2002  Stan Klein <address@hidden>
- Modified to use patch file for native Red Hat include and library locations
- Modified to reflect python2.1

reply via email to

[Prev in Thread] Current Thread [Next in Thread]