Skip to content

Commit c13257a

Browse files
author
Tarek Ziadé
committed
reverted the usage of compiler_obj in Python's setup.py
1 parent 30b76f3 commit c13257a

1 file changed

Lines changed: 39 additions & 39 deletions

File tree

setup.py

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def build_extensions(self):
187187
if compiler is not None:
188188
(ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS')
189189
args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags
190-
self.compiler_obj.set_executables(**args)
190+
self.compiler.set_executables(**args)
191191

192192
build_ext.build_extensions(self)
193193

@@ -302,8 +302,8 @@ def get_platform(self):
302302

303303
def detect_modules(self):
304304
# Ensure that /usr/local is always used
305-
add_dir_to_list(self.compiler_obj.library_dirs, '/usr/local/lib')
306-
add_dir_to_list(self.compiler_obj.include_dirs, '/usr/local/include')
305+
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
306+
add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
307307

308308
# Add paths specified in the environment variables LDFLAGS and
309309
# CPPFLAGS for header and library files.
@@ -312,9 +312,9 @@ def detect_modules(self):
312312
# the environment variable is not set even though the value were passed
313313
# into configure and stored in the Makefile (issue found on OS X 10.3).
314314
for env_var, arg_name, dir_list in (
315-
('LDFLAGS', '-R', self.compiler_obj.runtime_library_dirs),
316-
('LDFLAGS', '-L', self.compiler_obj.library_dirs),
317-
('CPPFLAGS', '-I', self.compiler_obj.include_dirs)):
315+
('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
316+
('LDFLAGS', '-L', self.compiler.library_dirs),
317+
('CPPFLAGS', '-I', self.compiler.include_dirs)):
318318
env_val = sysconfig.get_config_var(env_var)
319319
if env_val:
320320
# To prevent optparse from raising an exception about any
@@ -340,9 +340,9 @@ def detect_modules(self):
340340
add_dir_to_list(dir_list, directory)
341341

342342
if os.path.normpath(sys.prefix) != '/usr':
343-
add_dir_to_list(self.compiler_obj.library_dirs,
343+
add_dir_to_list(self.compiler.library_dirs,
344344
sysconfig.get_config_var("LIBDIR"))
345-
add_dir_to_list(self.compiler_obj.include_dirs,
345+
add_dir_to_list(self.compiler.include_dirs,
346346
sysconfig.get_config_var("INCLUDEDIR"))
347347

348348
try:
@@ -353,11 +353,11 @@ def detect_modules(self):
353353
# lib_dirs and inc_dirs are used to search for files;
354354
# if a file is found in one of those directories, it can
355355
# be assumed that no additional -I,-L directives are needed.
356-
lib_dirs = self.compiler_obj.library_dirs + [
356+
lib_dirs = self.compiler.library_dirs + [
357357
'/lib64', '/usr/lib64',
358358
'/lib', '/usr/lib',
359359
]
360-
inc_dirs = self.compiler_obj.include_dirs + ['/usr/include']
360+
inc_dirs = self.compiler.include_dirs + ['/usr/include']
361361
exts = []
362362
missing = []
363363

@@ -549,7 +549,7 @@ def detect_modules(self):
549549
missing.extend(['imageop'])
550550

551551
# readline
552-
do_readline = self.compiler_obj.find_library_file(lib_dirs, 'readline')
552+
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
553553
if platform == 'darwin':
554554
os_release = int(os.uname()[2].split('.')[0])
555555
if os_release < 9:
@@ -570,15 +570,15 @@ def detect_modules(self):
570570
readline_extra_link_args = ()
571571

572572
readline_libs = ['readline']
573-
if self.compiler_obj.find_library_file(lib_dirs,
573+
if self.compiler.find_library_file(lib_dirs,
574574
'ncursesw'):
575575
readline_libs.append('ncursesw')
576-
elif self.compiler_obj.find_library_file(lib_dirs,
576+
elif self.compiler.find_library_file(lib_dirs,
577577
'ncurses'):
578578
readline_libs.append('ncurses')
579-
elif self.compiler_obj.find_library_file(lib_dirs, 'curses'):
579+
elif self.compiler.find_library_file(lib_dirs, 'curses'):
580580
readline_libs.append('curses')
581-
elif self.compiler_obj.find_library_file(lib_dirs +
581+
elif self.compiler.find_library_file(lib_dirs +
582582
['/usr/lib/termcap'],
583583
'termcap'):
584584
readline_libs.append('termcap')
@@ -592,7 +592,7 @@ def detect_modules(self):
592592
if platform not in ['mac']:
593593
# crypt module.
594594

595-
if self.compiler_obj.find_library_file(lib_dirs, 'crypt'):
595+
if self.compiler.find_library_file(lib_dirs, 'crypt'):
596596
libs = ['crypt']
597597
else:
598598
libs = []
@@ -619,7 +619,7 @@ def detect_modules(self):
619619
['/usr/kerberos/include'])
620620
if krb5_h:
621621
ssl_incs += krb5_h
622-
ssl_libs = find_library_file(self.compiler_obj, 'ssl',lib_dirs,
622+
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
623623
['/usr/local/ssl/lib',
624624
'/usr/contrib/ssl/lib/'
625625
] )
@@ -849,7 +849,7 @@ class db_found(Exception): pass
849849
for dblib in (('db-%d.%d' % db_ver),
850850
('db%d%d' % db_ver),
851851
('db%d' % db_ver[0])):
852-
dblib_file = self.compiler_obj.find_library_file(
852+
dblib_file = self.compiler.find_library_file(
853853
db_dirs_to_check + lib_dirs, dblib )
854854
if dblib_file:
855855
dblib_dir = [ os.path.abspath(os.path.dirname(dblib_file)) ]
@@ -933,7 +933,7 @@ class db_found(Exception): pass
933933
os.path.join(sqlite_incdir, '..', '..', 'lib64'),
934934
os.path.join(sqlite_incdir, '..', '..', 'lib'),
935935
]
936-
sqlite_libfile = self.compiler_obj.find_library_file(
936+
sqlite_libfile = self.compiler.find_library_file(
937937
sqlite_dirs_to_check + lib_dirs, 'sqlite3')
938938
if sqlite_libfile:
939939
sqlite_libdir = [os.path.abspath(os.path.dirname(sqlite_libfile))]
@@ -1024,7 +1024,7 @@ class db_found(Exception): pass
10241024
if cand == "ndbm":
10251025
if find_file("ndbm.h", inc_dirs, []) is not None:
10261026
# Some systems have -lndbm, others don't
1027-
if self.compiler_obj.find_library_file(lib_dirs,
1027+
if self.compiler.find_library_file(lib_dirs,
10281028
'ndbm'):
10291029
ndbm_libs = ['ndbm']
10301030
else:
@@ -1038,9 +1038,9 @@ class db_found(Exception): pass
10381038
break
10391039

10401040
elif cand == "gdbm":
1041-
if self.compiler_obj.find_library_file(lib_dirs, 'gdbm'):
1041+
if self.compiler.find_library_file(lib_dirs, 'gdbm'):
10421042
gdbm_libs = ['gdbm']
1043-
if self.compiler_obj.find_library_file(lib_dirs,
1043+
if self.compiler.find_library_file(lib_dirs,
10441044
'gdbm_compat'):
10451045
gdbm_libs.append('gdbm_compat')
10461046
if find_file("gdbm/ndbm.h", inc_dirs, []) is not None:
@@ -1081,7 +1081,7 @@ class db_found(Exception): pass
10811081

10821082
# Anthony Baxter's gdbm module. GNU dbm(3) will require -lgdbm:
10831083
if ('gdbm' in dbm_order and
1084-
self.compiler_obj.find_library_file(lib_dirs, 'gdbm')):
1084+
self.compiler.find_library_file(lib_dirs, 'gdbm')):
10851085
exts.append( Extension('gdbm', ['gdbmmodule.c'],
10861086
libraries = ['gdbm'] ) )
10871087
else:
@@ -1100,7 +1100,7 @@ class db_found(Exception): pass
11001100
# Sun yellow pages. Some systems have the functions in libc.
11011101
if (platform not in ['cygwin', 'atheos', 'qnx6'] and
11021102
find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
1103-
if (self.compiler_obj.find_library_file(lib_dirs, 'nsl')):
1103+
if (self.compiler.find_library_file(lib_dirs, 'nsl')):
11041104
libs = ['nsl']
11051105
else:
11061106
libs = []
@@ -1114,24 +1114,24 @@ class db_found(Exception): pass
11141114
# Curses support, requiring the System V version of curses, often
11151115
# provided by the ncurses library.
11161116
panel_library = 'panel'
1117-
if (self.compiler_obj.find_library_file(lib_dirs, 'ncursesw')):
1117+
if (self.compiler.find_library_file(lib_dirs, 'ncursesw')):
11181118
curses_libs = ['ncursesw']
11191119
# Bug 1464056: If _curses.so links with ncursesw,
11201120
# _curses_panel.so must link with panelw.
11211121
panel_library = 'panelw'
11221122
exts.append( Extension('_curses', ['_cursesmodule.c'],
11231123
libraries = curses_libs) )
1124-
elif (self.compiler_obj.find_library_file(lib_dirs, 'ncurses')):
1124+
elif (self.compiler.find_library_file(lib_dirs, 'ncurses')):
11251125
curses_libs = ['ncurses']
11261126
exts.append( Extension('_curses', ['_cursesmodule.c'],
11271127
libraries = curses_libs) )
1128-
elif (self.compiler_obj.find_library_file(lib_dirs, 'curses')
1128+
elif (self.compiler.find_library_file(lib_dirs, 'curses')
11291129
and platform != 'darwin'):
11301130
# OSX has an old Berkeley curses, not good enough for
11311131
# the _curses module.
1132-
if (self.compiler_obj.find_library_file(lib_dirs, 'terminfo')):
1132+
if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
11331133
curses_libs = ['curses', 'terminfo']
1134-
elif (self.compiler_obj.find_library_file(lib_dirs, 'termcap')):
1134+
elif (self.compiler.find_library_file(lib_dirs, 'termcap')):
11351135
curses_libs = ['curses', 'termcap']
11361136
else:
11371137
curses_libs = ['curses']
@@ -1143,7 +1143,7 @@ class db_found(Exception): pass
11431143

11441144
# If the curses module is enabled, check for the panel module
11451145
if (module_enabled(exts, '_curses') and
1146-
self.compiler_obj.find_library_file(lib_dirs, panel_library)):
1146+
self.compiler.find_library_file(lib_dirs, panel_library)):
11471147
exts.append( Extension('_curses_panel', ['_curses_panel.c'],
11481148
libraries = [panel_library] + curses_libs) )
11491149
else:
@@ -1176,7 +1176,7 @@ class db_found(Exception): pass
11761176
version = line.split()[2]
11771177
break
11781178
if version >= version_req:
1179-
if (self.compiler_obj.find_library_file(lib_dirs, 'z')):
1179+
if (self.compiler.find_library_file(lib_dirs, 'z')):
11801180
if sys.platform == "darwin":
11811181
zlib_extra_link_args = ('-Wl,-search_paths_first',)
11821182
else:
@@ -1208,7 +1208,7 @@ class db_found(Exception): pass
12081208
extra_link_args = extra_link_args) )
12091209

12101210
# Gustavo Niemeyer's bz2 module.
1211-
if (self.compiler_obj.find_library_file(lib_dirs, 'bz2')):
1211+
if (self.compiler.find_library_file(lib_dirs, 'bz2')):
12121212
if sys.platform == "darwin":
12131213
bz2_extra_link_args = ('-Wl,-search_paths_first',)
12141214
else:
@@ -1571,9 +1571,9 @@ def detect_tkinter(self, inc_dirs, lib_dirs):
15711571
tcllib = tklib = tcl_includes = tk_includes = None
15721572
for version in ['8.6', '86', '8.5', '85', '8.4', '84', '8.3', '83',
15731573
'8.2', '82', '8.1', '81', '8.0', '80']:
1574-
tklib = self.compiler_obj.find_library_file(lib_dirs,
1574+
tklib = self.compiler.find_library_file(lib_dirs,
15751575
'tk' + version)
1576-
tcllib = self.compiler_obj.find_library_file(lib_dirs,
1576+
tcllib = self.compiler.find_library_file(lib_dirs,
15771577
'tcl' + version)
15781578
if tklib and tcllib:
15791579
# Exit the loop when we've found the Tcl/Tk libraries
@@ -1632,11 +1632,11 @@ def detect_tkinter(self, inc_dirs, lib_dirs):
16321632
return
16331633

16341634
# Check for BLT extension
1635-
if self.compiler_obj.find_library_file(lib_dirs + added_lib_dirs,
1635+
if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
16361636
'BLT8.0'):
16371637
defs.append( ('WITH_BLT', 1) )
16381638
libs.append('BLT8.0')
1639-
elif self.compiler_obj.find_library_file(lib_dirs + added_lib_dirs,
1639+
elif self.compiler.find_library_file(lib_dirs + added_lib_dirs,
16401640
'BLT'):
16411641
defs.append( ('WITH_BLT', 1) )
16421642
libs.append('BLT')
@@ -1691,7 +1691,7 @@ def configure_ctypes_darwin(self, ext):
16911691
]]
16921692

16931693
# Add .S (preprocessed assembly) to C compiler source extensions.
1694-
self.compiler_obj.src_extensions.append('.S')
1694+
self.compiler.src_extensions.append('.S')
16951695

16961696
include_dirs = [os.path.join(ffi_srcdir, 'include'),
16971697
os.path.join(ffi_srcdir, 'powerpc')]
@@ -1736,7 +1736,7 @@ def configure_ctypes(self, ext):
17361736
exec f in fficonfig
17371737

17381738
# Add .S (preprocessed assembly) to C compiler source extensions.
1739-
self.compiler_obj.src_extensions.append('.S')
1739+
self.compiler.src_extensions.append('.S')
17401740

17411741
include_dirs = [os.path.join(ffi_builddir, 'include'),
17421742
ffi_builddir,
@@ -1818,7 +1818,7 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
18181818
ffi_lib = None
18191819
if ffi_inc is not None:
18201820
for lib_name in ('ffi_convenience', 'ffi_pic', 'ffi'):
1821-
if (self.compiler_obj.find_library_file(lib_dirs, lib_name)):
1821+
if (self.compiler.find_library_file(lib_dirs, lib_name)):
18221822
ffi_lib = lib_name
18231823
break
18241824

0 commit comments

Comments
 (0)