diff setup.py @ 4:b5a377255eea MySQLdb

Merge changes from MySQLdb-1.2 branch (448-455)
author adustman
date Tue, 24 Oct 2006 19:52:31 +0000
parents df195ac92df6
children b70cce9bd065
line wrap: on
line diff
--- a/setup.py	Sun Apr 09 04:06:40 2006 +0000
+++ b/setup.py	Tue Oct 24 19:52:31 2006 +0000
@@ -45,6 +45,13 @@
     else:
         raise Abort, "Unknown value %s for option %s" % (value, option)
 
+if os.name == "posix":
+    flag_prefix = "-"
+else: # assume windows
+    flag_prefix = "/"
+
+def compiler_flag(f): return flag_prefix + f
+
 extra_objects = []
 static = enabled('static')
 if enabled('embedded'):
@@ -65,26 +72,26 @@
     name = name + "-embedded"
 metadata['name'] = name
 
-library_dirs = [ dequote(i[2:]) for i in libs if i.startswith("-L") ]
-libraries = [ dequote(i[2:]) for i in libs if i.startswith("-l") ]
+library_dirs = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("L")) ]
+libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
 
-removable_compile_args = '-I -L -l'.split()
+removable_compile_args = [ compiler_flag(f) for f in "ILl" ]
 extra_compile_args = [ i for i in mysql_config("cflags")
                        if i[:2] not in removable_compile_args ]
 include_dirs = [ dequote(i[2:])
                  for i in mysql_config('include')
-                 if i.startswith('-I') ]
+                 if i.startswith(compiler_flag('I')) ]
 if not include_dirs: # fix for MySQL-3.23
     include_dirs = [ dequote(i[2:])
 		     for i in mysql_config('cflags')
-		     if i.startswith('-I') ]
+		     if i.startswith(compiler_flag('I')) ]
 
 if static:
     extra_objects.append(os.path.join(
         library_dirs[0],'lib%s.a' % client))
 
-extra_compile_args.append("-Dversion_info=\"%s\"" % metadata['version_info'])
-extra_compile_args.append("-D__version__=\"%s\"" % metadata['version'])
+extra_compile_args.append(compiler_flag("Dversion_info=%s" % metadata['version_info']))
+extra_compile_args.append(compiler_flag("D__version__=%s" % metadata['version']))
 
 rel = open("MySQLdb/release.py",'w')
 rel.write("""