Cygwin Patch

Jason Tishler Jason.Tishler at dothill.com
Wed Dec 27 15:37:50 CET 2000


On Sun, 10 Dec 2000 23:27:49 +0100, David Leonard wrote:
> 	* python-ldap-1.10 will be tidied up, with just the memory-leak
> 	  patches applied, and a proper documentation build. (ie no v3
> 	  changes will be applied as it breaks v2 builds.) A final release
> 	  will be made.

Hopefully, the attached patch (against python-ldap-1.10alpha3) can
still be considered for inclusion in the 1.10 final release.  It enables
python-ldap to build OOTB as a shared extension for Cygwin Python.

Cygwin is an open-source POSIX emulation layer that enables many
GNU and UNIX tools to port to Windows without any source code changes.
If interested, please see http://www.cygwin.com for more information.

Note that the patch has no functional changes -- it only enables the
code to compile cleanly with Cygwin gcc.  Specifically, the changes
are as follows:

    1. replaced #ifdef WIN32 with #if defined(WIN32) || defined(__CYGWIN__) 
       as described in http://www.python.org/doc/FAQ.html#3.24 
    2. added DL_EXPORT to init_ldap() 

I'm quite willing to redo the patch against python-ldap CVS if that
will facilitate its acceptance.

My original plan was to wait until the Cygwin Python DLL and Shared
Extension Patch:

    http://sourceforge.net/patch/?func=detailpatch&patch_id=102409&group_id=5470

was accepted and committed into Python CVS before contacting the list.
However, due to the impending 1.10 final release, I realized that it
would be prudent to submit the patch sooner rather than later.

The procedure to apply the patch (to python-ldap-1.10alpha3) is as follows:

    $ cd python-ldap-1.10alpha3
    $ # save the attachment to the current directory
    $ patch -p1 <Cygwin-python-ldap-1.10alpha3.patch

Thanks,
Jason

-- 
Jason Tishler
Director, Software Engineering       Phone: +1 (732) 264-8770 x235
Dot Hill Systems Corp.               Fax:   +1 (732) 264-8798
82 Bethany Road, Suite 7             Email: Jason.Tishler at dothill.com
Hazlet, NJ 07730 USA                 WWW:   http://www.dothill.com
-------------- next part --------------
diff -upr python-ldap-1.10alpha3.orig/Modules/LDAPObject.c python-ldap-1.10alpha3/Modules/LDAPObject.c
--- python-ldap-1.10alpha3.orig/Modules/LDAPObject.c	Mon Aug 14 18:37:37 2000
+++ python-ldap-1.10alpha3/Modules/LDAPObject.c	Mon Oct 30 09:22:44 2000
@@ -1789,7 +1789,7 @@ setattr( LDAPObject* self, char* name, P
 /* type entry */
 
 PyTypeObject LDAP_Type = {
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
 	/* see http://www.python.org/doc/FAQ.html#3.24 */
 	PyObject_HEAD_INIT(NULL)
 #else /* ! WIN32 */
diff -upr python-ldap-1.10alpha3.orig/Modules/ldapmodule.c python-ldap-1.10alpha3/Modules/ldapmodule.c
--- python-ldap-1.10alpha3.orig/Modules/ldapmodule.c	Thu Jul 27 12:08:58 2000
+++ python-ldap-1.10alpha3/Modules/ldapmodule.c	Mon Oct 30 09:35:15 2000
@@ -22,12 +22,12 @@ static PyMethodDef methods[]  = {
 
 /* module initialisation */
 
-void
+DL_EXPORT(void)
 init_ldap()
 {
 	PyObject *m, *d;
 
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
 	/* See http://www.python.org/doc/FAQ.html#3.24 */
 	LDAP_Type.ob_type = &PyType_Type;
 #endif
diff -upr python-ldap-1.10alpha3.orig/Modules/linkedlist.c python-ldap-1.10alpha3/Modules/linkedlist.c
--- python-ldap-1.10alpha3.orig/Modules/linkedlist.c	Sun Aug 13 11:03:25 2000
+++ python-ldap-1.10alpha3/Modules/linkedlist.c	Mon Oct 30 09:23:23 2000
@@ -111,7 +111,7 @@ static PySequenceMethods default_methods
 };
 
 static PyTypeObject default_type = {
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
 	/* see http://www.python.org/doc/FAQ.html#3.24 */
 	PyObject_HEAD_INIT(NULL)
 #else /* ! WIN32 */
diff -upr python-ldap-1.10alpha3.orig/Modules/template.c python-ldap-1.10alpha3/Modules/template.c
--- python-ldap-1.10alpha3.orig/Modules/template.c	Sun Aug 13 10:57:52 2000
+++ python-ldap-1.10alpha3/Modules/template.c	Mon Oct 30 09:31:49 2000
@@ -548,7 +548,7 @@ TemplateItem_setattr(self, attr, value)
 }
 
 static PyTypeObject TemplateItem_Type = {
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
 	PyObject_HEAD_INIT(NULL)
 #else /* ! WIN32 */
 	PyObject_HEAD_INIT(&PyType_Type)
@@ -725,7 +725,7 @@ fprintf(stderr, "TemplateDefault_repr RE
 }
 
 static PyTypeObject TemplateDefault_Type = {
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
 	PyObject_HEAD_INIT(NULL)
 #else /* ! WIN32 */
 	PyObject_HEAD_INIT(&PyType_Type)
@@ -908,7 +908,7 @@ Template_setattr(self, attr, value)
 }
 
 static PyTypeObject Template_Type = {
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
 	PyObject_HEAD_INIT(NULL)
 #else /* ! WIN32 */
 	PyObject_HEAD_INIT(&PyType_Type)


More information about the python-ldap mailing list