This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PoPy python module


Sherwood,

On Thu, Jun 07, 2001 at 09:19:02AM -0400, Sherwood Robinson wrote:
> Anyone experienced compiling the PoPy 
> (http://sourceforge.net/projects/popy) python module for PostgreSQL DB API 
> 2.0 compliant.
> 
> It is giving me  quite the time trying to get this to compile.
> 
> any help would be appreciated.

I just tried it and I was successful building and running PoPy-3.0-beta1:

    $ python
    Python 2.1 (#1, Apr 17 2001, 09:45:01) 
    [GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01
    Type "copyright", "credits" or "license" for more information.
    >>> import PoPy
    >>> c = PoPy.connect('user=jt dbname=sanman', 1)
    >>> cursor = c.cursor()
    >>> cursor.execute('select * from pg_user')
    >>> cursor.fetchall()
    [('jt', 1004, 1, 1, 1, 1, '********', None), ('postgres', 1005, 1, 0, 1, 1, '********', None)]

Unfortunately, this process uncovered some issues:

1. The attached patch needs to be applied in order for PoPy to build
cleanly under Cygwin (and Win32 if appropriate).  Note that the essence
of this patch is very common -- I have submitted numerous ones that are
now part of Python CVS and to other projects such as python-ldap.

I recommend that you submit this patch to PoPy for consideration to be
included in PoPy CVS.

The procedure to apply the patch is as follows:

    $ # save the attachment to /tmp
    $ cd PoPy-3.0-beta1
    $ patch -p1 </tmp/PoPy-3.0-beta1.patch

2. It appears that PoPy is attempting to include files that are not
part of the Cygwin PostgreSQL distribution.  Note that I produced this
distribution using the typical "make install".  Hence, I am currently
at a loss as to why these files are missing.  I am going to attempt to
find out whether or not these files are truly missing or that PoPy is
incorrectly including files that are really only part of the source tree.
If files are missing from the Cygwin PostgreSQL distribution, then I
re-release the distribution with the missing files included.

Nevertheless, if you download and unpack PostgreSQL 7.1.2 and create the
following symlinks, then you should be able to build PoPy yourself:

    $ ln -s ~/src/postgresql-7.1.2/src/include/utils /usr/include/postgresql/utils
    $ ln -s ~/src/postgresql-7.1.2/src/include/catalog /usr/include/postgresql/catalog
    $ ln -s ~/src/postgresql-7.1.2/src/include/postgres.h /usr/include/postgresql/postgres.h

Note that the above assumes that PostgreSQL 7.1.2 is unpacked in ~/src -- you
may need to adjust the above commands to match your environment.

Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: 732.264.8770 x235
Dot Hill Systems Corp.               Fax:   732.264.8798
82 Bethany Road, Suite 7             Email: Jason.Tishler@dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com
diff -rup PoPy-3.0-beta1.orig/PoPy.c PoPy-3.0-beta1/PoPy.c
--- PoPy-3.0-beta1.orig/PoPy.c	Mon Mar  5 10:05:21 2001
+++ PoPy-3.0-beta1/PoPy.c	Thu Jun  7 09:51:25 2001
@@ -266,11 +266,14 @@ static PyMethodDef PoPy_methods[] = {
 /*    PoPy MODULE INITIALIZATION    */
 /***************************************/
 
-void
+DL_EXPORT(void)
 initPoPy(void)
 {
 	PyObject *dict, *module;
 
+	PoPy_CursorObject_Type.ob_type = &PyType_Type;
+	PoPy_BinaryObject_Type.ob_type = &PyType_Type;
+	PoPy_ConnectionObject_Type.ob_type = &PyType_Type;
 	module = Py_InitModule3("PoPy", PoPy_methods, "");
 	dict = PyModule_GetDict(module);
 
diff -rup PoPy-3.0-beta1.orig/PoPybinary.c PoPy-3.0-beta1/PoPybinary.c
--- PoPy-3.0-beta1.orig/PoPybinary.c	Mon Mar  5 10:05:21 2001
+++ PoPy-3.0-beta1/PoPybinary.c	Thu Jun  7 09:49:28 2001
@@ -156,7 +156,7 @@ PoPy_binary_object_NEW(PyObject * self, 
 
 
 PyTypeObject PoPy_BinaryObject_Type = {
-	PyObject_HEAD_INIT(&PyType_Type) 0,
+	PyObject_HEAD_INIT(NULL) 0,
 	"binary",
 	sizeof(PoPy_BinaryObject),
 	0,
diff -rup PoPy-3.0-beta1.orig/PoPyconnection.c PoPy-3.0-beta1/PoPyconnection.c
--- PoPy-3.0-beta1.orig/PoPyconnection.c	Mon Mar  5 10:05:21 2001
+++ PoPy-3.0-beta1/PoPyconnection.c	Thu Jun  7 09:50:35 2001
@@ -322,7 +322,7 @@ PoPy_connection_object_getattr(PoPy_Conn
 
 
 PyTypeObject PoPy_ConnectionObject_Type = {
-	PyObject_HEAD_INIT(&PyType_Type) 0,
+	PyObject_HEAD_INIT(NULL) 0,
 	"ConnectionObject",
 	sizeof(PoPy_ConnectionObject),
 	0,
diff -rup PoPy-3.0-beta1.orig/PoPycursor.c PoPy-3.0-beta1/PoPycursor.c
--- PoPy-3.0-beta1.orig/PoPycursor.c	Mon Mar  5 10:05:21 2001
+++ PoPy-3.0-beta1/PoPycursor.c	Thu Jun  7 09:48:48 2001
@@ -722,7 +722,7 @@ PoPy_cursor_object_getattr(PoPy_CursorOb
 
 
 PyTypeObject PoPy_CursorObject_Type = {
-	PyObject_HEAD_INIT(&PyType_Type) 0,
+	PyObject_HEAD_INIT(NULL) 0,
 	"PoPy_CursorObject",
 	sizeof(PoPy_CursorObject),
 	0,

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]