From 5ea99b0b769f04c48774099bcf23cce85d807d18 Mon Sep 17 00:00:00 2001 From: adustman Date: Fri, 1 Dec 2000 01:46:43 +0000 Subject: [PATCH] Minor updates. --- mysql/MANIFEST.in | 7 ++--- mysql/MySQL-python.spec | 18 +++++------- mysql/README | 62 ++++++++++++++++++++++++++++++----------- mysql/_mysqlmodule.c | 2 +- mysql/setup.py | 28 ++++++++++++++++--- 5 files changed, 80 insertions(+), 37 deletions(-) diff --git a/mysql/MANIFEST.in b/mysql/MANIFEST.in index 91c0063..ea5fdf0 100644 --- a/mysql/MANIFEST.in +++ b/mysql/MANIFEST.in @@ -1,8 +1,7 @@ prune CVS -recursive-include doc *.html *.sgml -recursive-include examples db* README test.sql -include build.py +recursive-include doc * +recursive-include examples * include README.MySQLmodule -include compile.py +include license.py include MANIFEST.in include MANIFEST diff --git a/mysql/MySQL-python.spec b/mysql/MySQL-python.spec index c04c61c..ce80b67 100644 --- a/mysql/MySQL-python.spec +++ b/mysql/MySQL-python.spec @@ -1,5 +1,5 @@ -%define ver 0.2.2 -%define rel 3 +%define ver 0.3.0b1 +%define rel 1 Summary: Python interface to MySQL-3.22 and 3.23 Name: MySQL-python Version: %ver @@ -47,17 +47,13 @@ derived from the Python license. %setup -n MySQLdb-%ver %build -python build.py +python setup.py build %install -mkdir -p $RPM_BUILD_ROOT/usr/lib/python1.5/site-packages -make install prefix=$RPM_BUILD_ROOT/usr -cp MySQLdb.py{,c,o} $RPM_BUILD_ROOT/usr/lib/python1.5/site-packages +python setup.py install --root $RPM_BUILD_ROOT %clean +rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root) -%doc license.py examples/* doc/* CompatMysqldb.py -/usr/lib/python1.5/site-packages/MySQLdb.py -/usr/lib/python1.5/site-packages/MySQLdb.pyc -/usr/lib/python1.5/site-packages/MySQLdb.pyo -/usr/lib/python1.5/site-packages/_mysqlmodule.so +%doc license.py examples/* doc/*.html doc/*.sgml README +/usr/lib/python*/site-packages/* diff --git a/mysql/README b/mysql/README index 261939b..4596f22 100644 --- a/mysql/README +++ b/mysql/README @@ -1,25 +1,53 @@ -Python-2.0: +Prerequisites: -Edit setup.py and make sure the paths are right for your system. This -uses Distutils, so it should work on all platforms. +Python 1.5.2 or higher +-- http://www.pythonlabs.com/products/python2.0/download_python2.0.html +-- http://www.python.org/1.6/ +-- http://www.python.org/1.5/ +-- Versions lower than 1.5.2 WON'T WORK. +-- If you have Red Hat Linux or a similar packaging system, make sure + you have the Python development headers and libraries (python-devel). + +Distutils 1.0 or higher +-- comes with Python 1.6 and 2.0 +-- http://www.python.org/sigs/distutils-sig/download.html + +MySQL 3.22.19 or higher +-- http://www.mysql.com/downloads/ +-- Versions lower than 3.22 definitely WON'T WORK. +-- Versions lower than 3.22.19 might not work. +-- The current (recommended) 3.22 release is 3.22.32. +-- MySQL-3.23 is beta at present but supported. +-- If you have Red Hat Linux or a similar packaging system, make sure + you have the MySQL development headers and libraries (MySQL-devel). + +First thing to do is edit setup.py. There are some variables towards the +beginning that tell it where your MySQL include files and libraries are. +The values are right for MySQL's standard Red Hat Linux (6.2) RPMs. If +you have another platform, you'll have to figure out the right values +yourself. + +Note that recent binary distributions include two sets of client +libraries: mysqlclient and mysqlclient_r. The latter are the +"thread-safe" libraries, so use those if you can, and if threading is +important to you. + +If you have the dynamic client libraries (on Linux, .so vs. .a), those +will be used by default. If they are not on your standard loader path, +you will have to set or adjust the LD_LIBRARY_PATH environment variable +(on Linux) or whatever your platform requires. Otherwise, you can adjust +setup.py to link against the static library. + +Finally, putting it together: $ python setup.py build # python setup.py install -Python-1.6: +If you prefer RPMs, you can use the bdist_rpm command with setup.py. -The previous method should work, else use the classic method. +Thanks go to Brian Fordham for cooking up an early version of setup.py. -Python-1.5.2: +License: GPL or the original license based on Python 1.5.2's license. -Get Distutils from www.pythonlabs.com and install it. Then do as above. -Else, use the classic method. - -Classic method: - -Check Setup.in and make sure it has the right paths for your system. - -To build: python build.py -To install: follow additional instructions after build. - -Got windows? Try compile.py instead. +Andy Dustman +2000-11-30 diff --git a/mysql/_mysqlmodule.c b/mysql/_mysqlmodule.c index bd8e506..9abd221 100644 --- a/mysql/_mysqlmodule.c +++ b/mysql/_mysqlmodule.c @@ -597,7 +597,7 @@ _mysql_string_literal( if (!str) return PyErr_NoMemory(); out = PyString_AS_STRING(str); #if MYSQL_VERSION_ID < 32321 - len = mysql_escape_string(out+1, s, size); + len = mysql_escape_string(out+1, in, size); #else if (self) len = mysql_real_escape_string(&(self->connection), out+1, in, size); diff --git a/mysql/setup.py b/mysql/setup.py index c57c777..300fbc1 100644 --- a/mysql/setup.py +++ b/mysql/setup.py @@ -18,7 +18,7 @@ thread_safe_library = NO mysqlclient = thread_safe_library and "mysqlclient_r" or "mysqlclient" -if sys.platform == "linux-386": # Red Hat +if sys.platform == "linux-i386": # Red Hat include_dirs = ['/usr/include/mysql'] library_dirs = ['/usr/lib/mysql'] libraries = [mysqlclient, "z"] @@ -48,10 +48,30 @@ else: raise "UnknownPlatform", "sys.platform=%s, os.name=%s" % \ (sys.platform, os.name) +long_description = \ +"""Python interface to MySQL-3.22 and 3.23 + +MySQLdb is an interface to the popular MySQL database server for Python. +The design goals are: + +- Compliance with Python database API version 2.0 +- Thread-safety +- Thread-friendliness (threads will not block each other) +- Compatibility with MySQL 3.22 and 3.23 + +This module should be mostly compatible with an older interface +written by Joe Skinner and others. However, the older version is +a) not thread-friendly, b) written for MySQL 3.21, c) apparently +not actively maintained. No code from that version is used in +MySQLdb. MySQLdb is distributed free of charge under a license +derived from the Python license. +""" + setup (# Distribution meta-data - name = "MySQLdb", - version = "0.3.0b2", + name = "MySQL-python", + version = "0.3.0", description = "An interface to MySQL", + long_description=long_description, author = "Andy Dustman", author_email = "andy@dustman.net", url = "http://dustman.net/andy/python/MySQLdb", @@ -61,7 +81,7 @@ setup (# Distribution meta-data py_modules = ["MySQLdb", "CompatMysqldb"], ext_modules = [Extension( - name='_mysqlmodule', + name='_mysql', sources=['_mysqlmodule.c'], include_dirs=include_dirs, library_dirs=library_dirs,