aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/python/setup.py
blob: 114d86345c9c1a74a5ec2ac634dc4d7f49c264c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/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>
# win32 support 2001/01 Gerhard Haering <gerhard@bigfoot.de>

# 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
from distutils.extension import Extension
import sys

if sys.platform == "win32":
	# If you want to build from source; you must have built a win32 native libpq	# before and copied libpq.dll into the PyGreSQL root directory.
	win_pg_build_root = 'd:/dev/pg/postgresql-7.0.2/'
	include_dirs=[ win_pg_build_root + 'src/include', win_pg_build_root + '/src/include/libpq', win_pg_build_root + 'src', win_pg_build_root + 'src/interfaces/libpq' ]
	library_dirs=[ win_pg_build_root + 'src/interfaces/libpq/Release' ]
	optional_libs=[ 'libpqdll', 'wsock32', 'advapi32' ]
	data_files = [ 'libpq.dll' ]
else:
	include_dirs=['../../include','../libpq','/usr/include/pgsql']
	library_dirs=['../libpq','/usr/lib/pgsql']
	optional_libs=['pq']
	data_files = []

setup (name = "PyGreSQL",
	version = "3.3",
	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(
		name='_pg',
		sources = ['pgmodule.c'],
		include_dirs = include_dirs,
		library_dirs = library_dirs,
		libraries = optional_libs
	)],
	data_files = data_files
)