Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit37d67eb

Browse files
committed
Add WIN32 support.
1 parentd584bf4 commit37d67eb

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

‎src/interfaces/python/pgmodule.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ const char *__movename[5] =
9191
#defineDEFAULT_VARS1/* enables default variables use */
9292
#endif/* NO_DEF_VAR */
9393

94+
#ifdefMS_WIN32
95+
#defineNO_SNPRINTF 1
96+
#endif
97+
9498
/* --------------------------------------------------------------------- */
9599

96100
/* MODULE GLOBAL VARIABLES */
@@ -937,7 +941,12 @@ pgsource_print(pgsourceobject * self, FILE *fp, int flags)
937941

938942
/* query type definition */
939943
staticforwardPyTypeObjectPgSourceType= {
944+
#ifndefMS_WIN32
940945
PyObject_HEAD_INIT(&PyType_Type)
946+
#else
947+
PyObject_HEAD_INIT(NULL)
948+
#endif
949+
941950
0,/* ob_size */
942951
"pgsourceobject",/* tp_name */
943952
sizeof(pgsourceobject),/* tp_basicsize */
@@ -3075,8 +3084,7 @@ static struct PyMethodDef pg_methods[] = {
30753084
staticcharpg__doc__[]="Python interface to PostgreSQL DB";
30763085

30773086
/* Initialization function for the module */
3078-
voidinit_pg(void);/* Python doesn't prototype this */
3079-
void
3087+
DL_EXPORT(void)
30803088
init_pg(void)
30813089
{
30823090
PyObject*mod,*dict,*v;

‎src/interfaces/python/setup.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
#!/usr/bin/env python
22

3-
include_dirs=['/usr/include/pgsql']
4-
library_dirs=['usr/lib/pgsql']
5-
optional_libs=['pq']
6-
73
# Setup script for the PyGreSQL version 3
84
# created 2000/04 Mark Alexander <mwa@gate.net>
95
# tweaked 2000/05 Jeremy Hylton <jeremy@cnri.reston.va.us>
6+
# win32 support 2001/01 Gerhard Haering <gerhard@bigfoot.de>
107

118
# requires distutils; standard in Python 1.6, otherwise download from
129
# http://www.python.org/sigs/distutils-sig/download.html
@@ -22,6 +19,20 @@
2219
# on using distutils to install Python programs.
2320

2421
fromdistutils.coreimportsetup
22+
importsys
23+
24+
ifsys.platform=="win32":
25+
# 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.
26+
win_pg_build_root='d:/dev/pg/postgresql-7.0.2/'
27+
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' ]
28+
library_dirs=[win_pg_build_root+'src/interfaces/libpq/Release' ]
29+
optional_libs=['libpqdll','wsock32','advapi32' ]
30+
data_files= ['libpq.dll' ]
31+
else:
32+
include_dirs=['/usr/include/pgsql']
33+
library_dirs=['usr/lib/pgsql']
34+
optional_libs=['pq']
35+
data_files= []
2536

2637
setup (name="PyGreSQL",
2738
version="3.1",
@@ -32,12 +43,13 @@
3243
licence="Python",
3344

3445
py_modules= ['pg','pgdb'],
35-
ext_modules= [ ('_pgmodule', {
46+
ext_modules= [Extension(
47+
name='_pg',
3648
'sources': ['pgmodule.c'],
3749
'include_dirs':include_dirs,
3850
'library_dirs':library_dirs,
3951
'libraries':optional_libs
40-
}
4152
)]
53+
data_files=data_files
4254
)
4355

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp