huge amounts of pure Python code broken by Python 2.5?

Robin Becker robin at reportlab.com
Wed Feb 7 05:30:33 EST 2007


skip at pobox.com wrote:
>     John> MySQLdb isn't fully supported for Python 2.5 yet, and there's no
>     John> tested Windows executable available, although there's an untested
>     John> version from a World of Warcraft guild available.
> 
> As Andy Dustman has pointed out a number of times, he doesn't do Windows.
> Someone in the MySQLdb community who does use Windows is going to have to
> fill that void.
......

well I have managed to build both extant versions (MySQL-python-1.2.1_p2 & 
MySQL-python-1.2.2b2) from source with the aid of Mr Dustman's comments in the 
site.cfg files and a very minor hack to the earlier version. I had to have the 
sources for Mysql available as well, but that probably comes with the territory. 
It seems the very latest version won't play well with earlier MySQL so I used 
MySQL-python-1.2.1_p2 as we are still using some 4.0.27 databases.

Given that I used a particular version of MySQL, 5.0.33, to build against I'm 
not certain that my builds are useful for everyone. I copy here the differences 
I had to make to the source to get stuff to build and run against stock win32 
Python-2.5

#############MySQL-python-1.2.1_p2
diff -r -c MySQL-python-1.2.1_p2\_mysql.c \tmp\MySQL-python-1.2.1_p2\_mysql.c
*** MySQL-python-1.2.1_p2\_mysql.c	Wed Apr 05 18:55:44 2006
--- \tmp\MySQL-python-1.2.1_p2\_mysql.c	Fri Jan 26 14:01:49 2007
***************
*** 2767,2772 ****
--- 2767,2775 ----
   	return e;
   }

+ #define QUOTE(X) _QUOTE(X)
+ #define _QUOTE(X) #X
+
   static char _mysql___doc__[] =
   "an adaptation of the MySQL C API (mostly)\n\
   \n\
***************
*** 2801,2811 ****

   	if (!(dict = PyModule_GetDict(module))) goto error;
   	if (PyDict_SetItemString(dict, "version_info",
! 			       PyRun_String(version_info, Py_eval_input,
   				       dict, dict)))
   		goto error;
   	if (PyDict_SetItemString(dict, "__version__",
! 			       PyString_FromString(__version__)))
   		goto error;
   	if (PyDict_SetItemString(dict, "connection",
   			       (PyObject *)&_mysql_ConnectionObject_Type))
--- 2804,2814 ----

   	if (!(dict = PyModule_GetDict(module))) goto error;
   	if (PyDict_SetItemString(dict, "version_info",
! 			       PyRun_String(QUOTE(version_info), Py_eval_input,
   				       dict, dict)))
   		goto error;
   	if (PyDict_SetItemString(dict, "__version__",
! 			       PyString_FromString(QUOTE(__version__))))
   		goto error;
   	if (PyDict_SetItemString(dict, "connection",
   			       (PyObject *)&_mysql_ConnectionObject_Type))
diff -r -c MySQL-python-1.2.1_p2\site.cfg \tmp\MySQL-python-1.2.1_p2\site.cfg
*** MySQL-python-1.2.1_p2\site.cfg	Sun Apr 02 18:16:50 2006
--- \tmp\MySQL-python-1.2.1_p2\site.cfg	Fri Jan 26 13:48:32 2007
***************
*** 16,28 ****

   [compiler]
   #mysql_root: /usr/local/mysql
! #library_dirs: %(mysql_root)s/lib
! #include_dirs: %(mysql_root)s/include
! #libraries: mysqlclient
! # zlib
! # msvcrt
! # libcmt
! # wsock32
! # advapi32
   #extra_compile_args:
! #extra_objects:
--- 16,28 ----

   [compiler]
   #mysql_root: /usr/local/mysql
! library_dirs: \tmp\mysql-5.0.33\lib_release
! include_dirs: \tmp\mysql-5.0.33\include
! libraries: mysqlclient
!  zlib
!  wsock32
!  advapi32
! #msvcrt
! #libcmt
   #extra_compile_args:
! extra_objects:  /NODEFAULTLIB:MSVCRT

#############MySQL-python-1.2.2b2
diff -r -c MySQL-python-1.2.2b2\site.cfg \tmp\MySQL-python-1.2.2b2\site.cfg
*** MySQL-python-1.2.2b2\site.cfg	Wed Apr 05 02:47:02 2006
--- \tmp\MySQL-python-1.2.2b2\site.cfg	Wed Jan 17 15:17:59 2007
***************
*** 16,28 ****

   [compiler]
   #mysql_root: /usr/local/mysql
! #library_dirs: %(mysql_root)s/lib
! #include_dirs: %(mysql_root)s/include
! #libraries: mysqlclient
! # zlib
! # msvcrt
! # libcmt
! # wsock32
! # advapi32
   #extra_compile_args:
! #extra_objects:
--- 16,28 ----

   [compiler]
   #mysql_root: /usr/local/mysql
! library_dirs: \tmp\mysql-5.0.33\lib_release
! include_dirs: \tmp\mysql-5.0.33\include
! libraries: mysqlclient
!  zlib
!  wsock32
!  advapi32
! #msvcrt
! #libcmt
   #extra_compile_args:
! extra_objects:  /NODEFAULTLIB:MSVCRT


-- 
Robin Becker




More information about the Python-list mailing list