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."""
import os
import os, sys
from distutils.core import setup
from distutils.extension import Extension
# You may need to edit this script to point to the location of your
# MySQL installation. It should be sufficient to change the value of
# the MYSQL_DIR variable below.
MYSQL_INCLUDE_DIR = '/usr/include/mysql'
MYSQL_LIB_DIR = '/usr/lib/mysql'
YES = 1
NO = 0
# 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
name = "MySQLdb",
version = "0.3.0a2",
version = "0.3.0b2",
description = "An interface to MySQL",
author = "Andy Dustman",
author_email = "andy@dustman.net",
@ -27,20 +63,10 @@ setup (# Distribution meta-data
ext_modules = [Extension(
name='_mysqlmodule',
sources=['_mysqlmodule.c'],
include_dirs=[MYSQL_INCLUDE_DIR],
# maybe comment to force dynamic libraries
#library_dirs=[MYSQL_LIB_DIR],
# uncomment if linking against dynamic libraries
runtime_library_dirs=[MYSQL_LIB_DIR],
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'],
include_dirs=include_dirs,
library_dirs=library_dirs,
runtime_library_dirs=runtime_library_dirs,
libraries=libraries,
extra_objects=extra_objects,
)],
)