@@ -13,9 +13,6 @@ def dequote(s):
13
13
s = s [1 :- 1 ]
14
14
return s
15
15
16
- def compiler_flag (f ):
17
- return "-%s" % f
18
-
19
16
def mysql_config (what ):
20
17
from os import popen
21
18
@@ -53,29 +50,24 @@ def get_config():
53
50
libs = mysql_config ("libs" )
54
51
client = "mysqlclient"
55
52
56
- library_dirs = [ dequote (i [2 :]) for i in libs if i .startswith (compiler_flag ("L" )) ]
57
- libraries = [ dequote (i [2 :]) for i in libs if i .startswith (compiler_flag ("l" )) ]
53
+ library_dirs = [dequote (i [2 :]) for i in libs if i .startswith ('-L' )]
54
+ libraries = [dequote (i [2 :]) for i in libs if i .startswith ('-l' )]
55
+ extra_link_args = [x for x in libs if not x .startswith (('-l' , '-L' ))]
58
56
59
- removable_compile_args = [ compiler_flag ( f ) for f in "ILl" ]
60
- extra_compile_args = [ i .replace ("%" , "%%" ) for i in mysql_config ("cflags" )
61
- if i [:2 ] not in removable_compile_args ]
57
+ removable_compile_args = ( '-I' , '-L' , '-l' )
58
+ extra_compile_args = [i .replace ("%" , "%%" ) for i in mysql_config ("cflags" )
59
+ if i [:2 ] not in removable_compile_args ]
62
60
63
61
# Copy the arch flags for linking as well
64
- extra_link_args = list ()
65
62
for i in range (len (extra_compile_args )):
66
63
if extra_compile_args [i ] == '-arch' :
67
64
extra_link_args += ['-arch' , extra_compile_args [i + 1 ]]
68
65
69
- include_dirs = [ dequote (i [2 :])
70
- for i in mysql_config ('include' )
71
- if i .startswith (compiler_flag ('I' )) ]
72
- if not include_dirs : # fix for MySQL-3.23
73
- include_dirs = [ dequote (i [2 :])
74
- for i in mysql_config ('cflags' )
75
- if i .startswith (compiler_flag ('I' )) ]
66
+ include_dirs = [dequote (i [2 :])
67
+ for i in mysql_config ('include' ) if i .startswith ('-I' )]
76
68
77
69
if static :
78
- extra_objects .append (os .path .join (library_dirs [0 ],'lib%s.a' % client ))
70
+ extra_objects .append (os .path .join (library_dirs [0 ], 'lib%s.a' % client ))
79
71
if client in libraries :
80
72
libraries .remove (client )
81
73
@@ -104,4 +96,3 @@ def get_config():
104
96
105
97
if __name__ == "__main__" :
106
98
sys .stderr .write ("""You shouldn't be running this directly; it is used by setup.py.""" )
107
-
0 commit comments