[Psycopg] Updated spec file for Redhat 9

Simon Willison cs1spw at bath.ac.uk
Wed Dec 31 01:02:08 CET 2003


We were having trouble installing psycopg on redhat 9. In the end, we 
found that updating the spec file and creating our own RPM worked just 
fine. I've attached our modified spec file - it works with Fedora as well.

The changes we made were updating the version number to 1.1.11, changing 
the required library from 'egenix-mx-base' to just 'mx' and changing the 
POSTGRESQLINC line from '$(/usr/bin/pg_config --includedir)' to 
'POSTGRESQLINC=$(/usr/bin/pg_config --includedir-server).

Best regards,

Simon Willison
Web development weblog: http://simon.incutio.com/
-------------- next part --------------
# To recompile for a different version of python:
# (ie rpm --rebuild --define 'python 2.2' psycopg-1.0.6.src.rpm)
#
%{!?python:%define python 2.2}
%define name psycopg
%define version 1.1.11
%define release py%{python}_1

Summary: a PostgreSQL database adapter for Python
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{version}.tar.gz
Copyright: GNU GPL
Group: Applications/Databases
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}
Packager: William K. Volkman <development at netshark.com>
Url: http://www.initd.org/software/initd/psycopg
BuildRequires: python-devel postgresql-devel mx
Requires: python mx postgresql-libs

%description
psycopg is a PostgreSQL database adapter for the Python programming
language (just like pygresql and popy.) It was written from scratch with
the aim of being very small and fast, and stable as a rock. The main
advantages of psycopg are that it supports the full Python DBAPI-2.0 and
being thread safe at level 2.

%package doc
Summary: Documentation for psycopg python PostgreSQL database adapter
Group: Applications/Databases

%description doc
Documenation and example files for the psycopg python PostgreSQL
database adapter.

%prep
%setup

%build
if [ -x /usr/bin/pg_config ]; then
        POSTGRESQLINC=$(/usr/bin/pg_config --includedir-server)
        POSTGRESQLLIB=$(/usr/bin/pg_config --libdir)
else
        POSTGRESQLINC=/usr/include/pgsql
        POSTGRESQLLIB=/usr/lib
fi
%configure --with-python=%{_prefix}/bin/python%{python} \
      --with-mxdatetime-includes=%{_prefix}/lib/python%{python}/site-packages/mx/DateTime/mxDateTime  \
      --with-postgres-includes=$POSTGRESQLINC \
      --with-postgres-libs=$POSTGRESQLLIB
make

%install
mkdir -p $RPM_BUILD_ROOT/usr/lib/python%{python}/site-packages
install -m 555 psycopgmodule.so $RPM_BUILD_ROOT/usr/lib/python%{python}/site-packages

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
/usr/lib/python%{python}/site-packages/*.so

%files doc
%defattr(-,root,root)
%doc AUTHORS  COPYING  CREDITS  FAQ  INSTALL  NEWS  README  RELEASE-1.0  SUCCESS  TODO doc


More information about the Psycopg mailing list