Thread: PyGreSQL and Distutils

PyGreSQL and Distutils

From
Bernard Frankpitt
Date:
Hi All,

The setup.py file in PyGreSQL does not work with newer distutils (at
least not for the distutils in Python 2.0).  The new versions of
distutils require you to use an instance of a new Python class called
Extension to configure the compiled extensions.  I have attached a
modification of the setup.py script which works on my system (a Linux
system with Python 2.0, PyGreSQL 3.1, and PostgreSQL 7.1 December CVS).
Although I have hard-wired the location of my pgsql include and lib
directories, it is pretty obvious what has to be changed.

Bernie#!/usr/bin/env python


# Setup script for the PyGreSQL version 3
# created 2000/04 Mark Alexander <mwa@gate.net>
# tweaked 2000/05 Jeremy Hylton <jeremy@cnri.reston.va.us>

# requires distutils; standard in Python 1.6, otherwise download from
# http://www.python.org/sigs/distutils-sig/download.html

# You may have to change the first 3 variables (include_dirs,
# library_dirs, optional_libs) to match your postgres distribution.

# Now, you can:
#   python setup.py build   # to build the module
#   python setup.py install # to install it

# See http://www.python.org/sigs/distutils-sig/doc/ for more information
# on using distutils to install Python programs.

from distutils.core import setup, Extension

setup (name = "PyGreSQL",
       version = "3.1",
       description = "Python PostgreSQL Interfaces",
       author = "D'Arcy J. M. Cain",
       author_email = "darcy@druid.net",
       url = "http://www.druid.net/pygresql/",
       licence = "Python",

       py_modules = ['pg', 'pgdb'],
       ext_modules = [ Extension('_pg', ['pgmodule.c'],
                                 include_dirs=['/usr/local/pgsql/include'],
                                 library_dirs=['/usr/local/pgsql/lib'],
                                 libraries=['pq'])]
       )