Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 65f4a3b

Browse files
committed
Patch from Perry Stoll: caught up with changes in CCompiler necessary (?)
for MSVCCompiler.
1 parent 32162e8 commit 65f4a3b

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

Lib/distutils/unixccompiler.py

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ class UnixCCompiler (CCompiler):
5151
# directories and any module- or package-specific include directories
5252
# are specified via {add,set}_include_dirs(), and there's no way to
5353
# distinguish them. This might be a bug.
54+
55+
_obj_ext = '.o'
56+
_exe_ext = ''
57+
_shared_lib_ext = SO
58+
_static_lib_ext = '.a'
5459

5560
def __init__ (self,
5661
verbose=0,
@@ -121,23 +126,29 @@ def link_shared_lib (self,
121126
objects,
122127
output_libname,
123128
libraries=None,
124-
library_dirs=None):
129+
library_dirs=None,
130+
build_info=None):
125131
# XXX should we sanity check the library name? (eg. no
126132
# slashes)
127-
self.link_shared_object (objects, "lib%s%s" % (output_libname, SO))
133+
self.link_shared_object (objects, "lib%s%s" % \
134+
(output_libname, self._shared_lib_ext),
135+
build_info=build_info)
128136

129137

130138
def link_shared_object (self,
131139
objects,
132140
output_filename,
133141
libraries=None,
134-
library_dirs=None):
142+
library_dirs=None,
143+
build_info=None):
135144

136145
if libraries is None:
137146
libraries = []
138147
if library_dirs is None:
139148
library_dirs = []
140-
149+
if build_info is None:
150+
build_info = {}
151+
141152
lib_opts = _gen_lib_options (self.libraries + libraries,
142153
self.library_dirs + library_dirs)
143154
ld_args = self.ldflags_shared + lib_opts + \
@@ -150,17 +161,19 @@ def link_shared_object (self,
150161
def object_filenames (self, source_filenames):
151162
outnames = []
152163
for inname in source_filenames:
153-
outnames.append (re.sub (r'\.(c|C|cc|cxx)$', '.o', inname))
164+
outnames.append ( re.sub (r'\.(c|C|cc|cxx|cpp)$',
165+
self._obj_ext, inname))
154166
return outnames
155167

156168
def shared_object_filename (self, source_filename):
157-
return re.sub (r'\.(c|C|cc|cxx)$', SO)
169+
return re.sub (r'\.(c|C|cc|cxx|cpp)$', self._shared_lib_ext)
158170

159171
def library_filename (self, libname):
160-
return "lib%s.a" % libname
172+
return "lib%s%s" % (libname, self._static_lib_ext )
161173

162174
def shared_library_filename (self, libname):
163-
return "lib%s.so" % libname
175+
return "lib%s%s" % (libname, self._shared_lib_ext )
176+
164177

165178

166179
# class UnixCCompiler

0 commit comments

Comments
 (0)