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

Skip to content

Commit 4104db3

Browse files
author
Andrew MacIntyre
committed
- comment improvement
- implement viable library search routine for EMX
1 parent 428a38c commit 4104db3

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

Lib/distutils/emxccompiler.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ def link (self,
177177

178178
# -- Miscellaneous methods -----------------------------------------
179179

180-
# overwrite the one from CCompiler to support rc and res-files
180+
# override the object_filenames method from CCompiler to
181+
# support rc and res-files
181182
def object_filenames (self,
182183
source_filenames,
183184
strip_dir=0,
@@ -204,6 +205,29 @@ def object_filenames (self,
204205

205206
# object_filenames ()
206207

208+
# override the find_library_file method from UnixCCompiler
209+
# to deal with file naming/searching differences
210+
def find_library_file(self, dirs, lib, debug=0):
211+
shortlib = '%s.lib' % lib
212+
longlib = 'lib%s.lib' % lib # this form very rare
213+
214+
# get EMX's default library directory search path
215+
try:
216+
emx_dirs = os.environ['LIBRARY_PATH'].split(';')
217+
except KeyError:
218+
emx_dirs = []
219+
220+
for dir in dirs + emx_dirs:
221+
shortlibp = os.path.join(dir, shortlib)
222+
longlibp = os.path.join(dir, longlib)
223+
if os.path.exists(shortlibp):
224+
return shortlibp
225+
elif os.path.exists(longlibp):
226+
return longlibp
227+
228+
# Oops, didn't find it in *any* of 'dirs'
229+
return None
230+
207231
# class EMXCCompiler
208232

209233

0 commit comments

Comments
 (0)