mingw-compatibility for _c_htmltext.c

David Binger <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Tue, 15 Mar 2005 09:54:21 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
--Apple-Mail-2--552724651
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed



--Apple-Mail-2--552724651
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	x-unix-mode=0664;
	name="mingw.diff.txt"
Content-Disposition: attachment;
	filename=mingw.diff.txt

Index: ACKS
===================================================================
--- ACKS	(revision 26348)
+++ ACKS	(revision 26349)
@@ -43,6 +43,7 @@
 Jason Sibre
 Gregory P. Smith
 Mikhail Sobolev
+Daniele Varrazzo
 Johann Visagie
 Greg Ward (Quixote originator)
 The whole gang at the Zope Corporation
Index: src/_c_htmltext.c
===================================================================
--- src/_c_htmltext.c	(revision 26348)
+++ src/_c_htmltext.c	(revision 26349)
@@ -789,7 +789,7 @@
 	htmltext_hash,		/*tp_hash*/
 	0,			/*tp_call*/
 	(unaryfunc)htmltext_str,/*tp_str*/
-	PyObject_GenericGetAttr,/*tp_getattro*/
+	0,			/*tp_getattro  set to PyObject_GenericGetAttr by module init*/
 	0,			/*tp_setattro*/
 	0,			/*tp_as_buffer*/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE \
@@ -810,9 +810,9 @@
 	0,			/*tp_descr_set*/
 	0,			/*tp_dictoffset*/
 	0,			/*tp_init*/
-	PyType_GenericAlloc,	/*tp_alloc*/
+	0,			/*tp_alloc  set to PyType_GenericAlloc by module init*/
 	htmltext_new,		/*tp_new*/
-	_PyObject_Del,		/*tp_free*/
+	0,			/*tp_free  set to _PyObject_Del by module init*/
 	0,			/*tp_is_gc*/
 };
 
@@ -919,7 +919,7 @@
 	0,			/*tp_hash*/
 	0,			/*tp_call*/
 	(unaryfunc)template_io_str,/*tp_str*/
-	PyObject_GenericGetAttr,/*tp_getattro*/
+	0,			/*tp_getattro  set to PyObject_GenericGetAttr by module init*/
 	0,			/*tp_setattro*/
 	0,			/*tp_as_buffer*/
 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/
@@ -939,9 +939,9 @@
 	0,			/*tp_descr_set*/
 	0,			/*tp_dictoffset*/
 	0,			/*tp_init*/
-	PyType_GenericAlloc,	/*tp_alloc*/
+	0,			/*tp_alloc  set to PyType_GenericAlloc by module init*/
 	template_io_new,	/*tp_new*/
-	_PyObject_Del,		/*tp_free*/
+	0,			/*tp_free  set to _PyObject_Del by module init*/
 	0,			/*tp_is_gc*/
 };
 
@@ -999,6 +999,14 @@
 	QuoteWrapper_Type.ob_type = &PyType_Type;
 	TemplateIO_Type.ob_type = &PyType_Type;
 
+	/* Fix not constant element initialization */
+    htmltext_Type.tp_getattro = PyObject_GenericGetAttr;
+    htmltext_Type.tp_alloc = PyType_GenericAlloc;
+    htmltext_Type.tp_free = _PyObject_Del;
+    TemplateIO_Type.tp_getattro = PyObject_GenericGetAttr;
+    TemplateIO_Type.tp_alloc = PyType_GenericAlloc;
+    TemplateIO_Type.tp_free = _PyObject_Del;
+
 	/* Create the module and add the functions */
 	m = Py_InitModule4("_c_htmltext", htmltext_module_methods, module_doc,
 			   NULL, PYTHON_API_VERSION);
Index: doc/win32.txt
===================================================================
--- doc/win32.txt	(revision 0)
+++ doc/win32.txt	(revision 26349)
@@ -0,0 +1,14 @@
+Compiling Quixote c extensions for Windows using the mingw compiler:
+
+The variable build_extensions in setup.py must be set to True (instead
+of "sys.platform != win32"). Then, Quixote can be installed through
+
+   python setup.py build_ext --compiler=mingw32 install
+
+The mingw compiler can be downloaded from
+http://www.bloodshed.net/dev/devcpp.html. Probably you need to list
+the bin directory (C:\Program files\Dev-Cpp\bin) in the PATH.
+
+To permit gcc to link against Python library, you also need a
+libpython2x.a file. Instructions for its creation are provided at
+http://sebsauvage.net/python/mingw.html.

--Apple-Mail-2--552724651--