-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·128 lines (107 loc) · 3.3 KB
/
Copy pathsetup.py
File metadata and controls
executable file
·128 lines (107 loc) · 3.3 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/usr/bin/env python
##
# copyright 2009, James William Pye
# http://python.projects.postgresql.org
##
import sys
import os
from distutils.core import Extension
if sys.version_info[:2] < (3,0):
sys.stderr.write(
"ERROR: py-postgresql is for Python 3.0 and greater." + os.linesep
)
sys.stderr.write(
"HINT: setup.py was ran using Python " + \
'.'.join([str(x) for x in sys.version_info[:3]]) +
': ' + sys.executable + os.linesep
)
sys.exit(1)
NAME = 'py-postgresql'
VERSION = '0.8dev'
LONG_DESCRIPTION = """
py-postgresql is a set of Python modules providing interfaces to various parts
of PostgreSQL. Notably, it provides a driver for interacting with a database.
Sample PG-API Code
------------------
>>> import postresql.driver as pg_driver
>>> db = pg_driver.connect(user = 'mydbuser', host = 'localhost', port = 5432, database = 'mydbname')
>>> db.execute("CREATE TABLE emp (emp_first_name text, emp_last_name text, emp_salary numeric)")
>>> make_emp = db.query("INSERT INTO emp VALUES ($1, $2, $3)")
>>> make_emp("John", "Doe", "75,322")
1
>>> with db.xact:
... make_emp("Jane", "Doe", "75,322")
... make_emp("Edward", "Johnson", "82,744")
...
1
1
There is a DB-API 2.0 module as well::
postgresql.driver.dbapi20
However, PG-API is recommended as it provides greater utility.
History
-------
py-postgresql is not yet another PostgreSQL driver, it's been in development for
years. py-postgresql is the Python 3.0 port of the ``pg_proboscis`` driver and
integration of the other ``pg/python`` projects.
More Information
----------------
http://python.projects.postgresql.org
"""
CLASSIFIERS = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'License :: OSI Approved :: MIT License',
'License :: OSI Approved :: Attribution Assurance License',
'License :: OSI Approved :: Python Software Foundation License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Database',
]
extensions = [
Extension(
'postgresql.protocol.cbuffer',
[os.path.join('postgresql', 'protocol', 'buffer.c')],
libraries = (sys.platform == 'win32' and ['ws2_32'] or []),
),
]
defaults = {
'name' : NAME,
'version' : VERSION,
'description' : 'Python interfaces to PostgreSQL (driver)',
'long_description' : LONG_DESCRIPTION,
'author' : 'James William Pye',
'author_email' : 'x@jwp.name',
'maintainer' : 'James William Pye',
'maintainer_email' : 'python-general@pgfoundry.org',
'url' : 'http://python.projects.postgresql.org',
'classifiers' : CLASSIFIERS,
'packages' : [
'postgresql',
'postgresql.encodings',
'postgresql.protocol',
'postgresql.driver',
'postgresql.test',
# Modules imported from other packages.
'postgresql.resolved',
],
# Only build extension modules on win32 if PY_BUILD_EXTENSIONS is enabled.
# People who get failures are more likely to just give up on the package
# without reading the documentation. :(
'ext_modules' : (
extensions if os.environ.get('PY_BUILD_EXTENSIONS') or \
not sys.platform in ('win32',)
else ()
),
'scripts' : [
'bin/pg_dotconf',
'bin/pg_python',
'bin/pg_tin',
'bin/pg_withcluster'
]
}
if __name__ == '__main__':
from distutils.core import setup
setup(**defaults)