Make a litle easier to customize.

This commit is contained in:
adustman
2000-10-31 19:48:05 +00:00
parent d924d7ea20
commit 5cc54cde96

View File

@ -2,19 +2,55 @@
"""Setup script for the MySQLdb module distribution.""" """Setup script for the MySQLdb module distribution."""
import os import os, sys
from distutils.core import setup from distutils.core import setup
from distutils.extension import Extension from distutils.extension import Extension
# You may need to edit this script to point to the location of your YES = 1
# MySQL installation. It should be sufficient to change the value of NO = 0
# the MYSQL_DIR variable below.
MYSQL_INCLUDE_DIR = '/usr/include/mysql'
MYSQL_LIB_DIR = '/usr/lib/mysql'
# set this to 1 if you have the thread-safe mysqlclient library
thread_safe_library = NO
# You probably don't have to do anything past this point. If you
# do, please mail me the configuration for your platform. Don't
# forget to include the value of sys.platform and os.name.
mysqlclient = thread_safe_library and "mysqlclient_r" or "mysqlclient"
if sys.platform == "linux-386": # Red Hat
include_dirs = ['/usr/include/mysql']
library_dirs = ['/usr/lib/mysql']
libraries = [mysqlclient, "z"]
runtime_library_dirs = []
extra_objects = []
elif sys.platform == "win32":
include_dirs = [r'c:\mysql\include']
library_dirs = [r'c:\mysql\lib\opt']
libraries = [mysqlclient, 'zlib', 'msvcrt', 'libcmt',
'wsock32', 'advapi32']
runtime_library_dirs = []
extra_objects = [r'c:\mysql\lib\opt\mysqlclient.lib']
elif os.name == "posix": # most Linux/UNIX platforms
include_dirs = ['/usr/include/mysql']
library_dirs = ['/usr/lib/mysql']
# MySQL-3.23 seems to need libz
libraries = [mysqlclient, "z"]
# On some platorms, this can be used to find the shared libraries
# at runtime, if they are in a non-standard location. Doesn't
# work for Linux gcc.
## runtime_library_dirs = library_dirs
runtime_library_dirs = []
# This can be used on Linux to force use of static mysqlclient lib
## extra_objects = ['/usr/lib/mysql/libmysqlclient.a']
extra_objects = []
else:
raise "UnknownPlatform", "sys.platform=%s, os.name=%s" % \
(sys.platform, os.name)
setup (# Distribution meta-data setup (# Distribution meta-data
name = "MySQLdb", name = "MySQLdb",
version = "0.3.0a2", version = "0.3.0b2",
description = "An interface to MySQL", description = "An interface to MySQL",
author = "Andy Dustman", author = "Andy Dustman",
author_email = "andy@dustman.net", author_email = "andy@dustman.net",
@ -27,20 +63,10 @@ setup (# Distribution meta-data
ext_modules = [Extension( ext_modules = [Extension(
name='_mysqlmodule', name='_mysqlmodule',
sources=['_mysqlmodule.c'], sources=['_mysqlmodule.c'],
include_dirs=[MYSQL_INCLUDE_DIR], include_dirs=include_dirs,
# maybe comment to force dynamic libraries library_dirs=library_dirs,
#library_dirs=[MYSQL_LIB_DIR], runtime_library_dirs=runtime_library_dirs,
# uncomment if linking against dynamic libraries libraries=libraries,
runtime_library_dirs=[MYSQL_LIB_DIR], extra_objects=extra_objects,
libraries=['mysqlclient',
'z', # needed for MyZQL-3.23
# Some C++ compiler setups "forget" to
# link to the c++ libs (notably on
# Solaris), so you might succeed in
# linking them in by hand:
# 'stdc++', 'gcc',
],
# uncomment to force use of the static library
# extra_objects=[`MYSQL_LIB_DIR`+'libmysqlclient.a'],
)], )],
) )