[Python-checkins] CVS: distutils/distutils/command config.py,1.2,1.3
Greg Ward
python-dev@python.org
2000年6月26日 18:21:24 -0700
Update of /cvsroot/python/distutils/distutils/command
In directory slayer.i.sourceforge.net:/tmp/cvs-serv1414
Modified Files:
config.py
Log Message:
Added 'include_dirs' parameters all over the place.
Added 'check_lib()', which provides a subset of the functionality of
'check_func()' with a simpler interface and implementation.
Index: config.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/config.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** config.py 2000年06月21日 03:00:50 1.2
--- config.py 2000年06月27日 01:21:22 1.3
***************
*** 113,124 ****
return filename
! def _preprocess (self, body, headers, lang):
src = self._gen_temp_sourcefile(body, headers, lang)
out = "_configtest.i"
self.temp_files.extend([src, out])
! self.compiler.preprocess(src, out)
return (src, out)
! def _compile (self, body, headers, lang):
src = self._gen_temp_sourcefile(body, headers, lang)
if self.dump_source:
--- 113,124 ----
return filename
! def _preprocess (self, body, headers, include_dirs, lang):
src = self._gen_temp_sourcefile(body, headers, lang)
out = "_configtest.i"
self.temp_files.extend([src, out])
! self.compiler.preprocess(src, out, include_dirs=include_dirs)
return (src, out)
! def _compile (self, body, headers, include_dirs, lang):
src = self._gen_temp_sourcefile(body, headers, lang)
if self.dump_source:
***************
*** 126,134 ****
(obj,) = self.compiler.object_filenames([src])
self.temp_files.extend([src, obj])
! self.compiler.compile([src])
return (src, obj)
! def _link (self, body, headers, libraries, library_dirs, lang):
! (src, obj) = self._compile(body, headers, lang)
prog = os.path.splitext(os.path.basename(src))[0]
self.temp_files.append(prog) # XXX should be prog + exe_ext
--- 126,136 ----
(obj,) = self.compiler.object_filenames([src])
self.temp_files.extend([src, obj])
! self.compiler.compile([src], include_dirs=include_dirs)
return (src, obj)
! def _link (self, body,
! headers, include_dirs,
! libraries, library_dirs, lang):
! (src, obj) = self._compile(body, headers, include_dirs, lang)
prog = os.path.splitext(os.path.basename(src))[0]
self.temp_files.append(prog) # XXX should be prog + exe_ext
***************
*** 160,164 ****
# XXX need access to the header search path and maybe default macros.
! def try_cpp (self, body=None, headers=None, lang="c"):
"""Construct a source file from 'body' (a string containing lines
of C/C++ code) and 'headers' (a list of header files to include)
--- 162,166 ----
# XXX need access to the header search path and maybe default macros.
! def try_cpp (self, body=None, headers=None, include_dirs=None, lang="c"):
"""Construct a source file from 'body' (a string containing lines
of C/C++ code) and 'headers' (a list of header files to include)
***************
*** 178,182 ****
return ok
! def search_cpp (self, pattern, body=None, headers=None, lang="c"):
"""Construct a source file (just like 'try_cpp()'), run it through
the preprocessor, and return true if any line of the output matches
--- 180,185 ----
return ok
! def search_cpp (self, pattern, body=None,
! headers=None, include_dirs=None, lang="c"):
"""Construct a source file (just like 'try_cpp()'), run it through
the preprocessor, and return true if any line of the output matches
***************
*** 207,211 ****
return match
! def try_compile (self, body, headers=None, lang="c"):
"""Try to compile a source file built from 'body' and 'headers'.
Return true on success, false otherwise.
--- 210,214 ----
return match
! def try_compile (self, body, headers=None, include_dirs=None, lang="c"):
"""Try to compile a source file built from 'body' and 'headers'.
Return true on success, false otherwise.
***************
*** 223,228 ****
return ok
! def try_link (self,
! body, headers=None,
libraries=None, library_dirs=None,
lang="c"):
--- 226,231 ----
return ok
! def try_link (self, body,
! headers=None, include_dirs=None,
libraries=None, library_dirs=None,
lang="c"):
***************
*** 234,238 ****
self._check_compiler()
try:
! self._link(body, headers, libraries, library_dirs, lang)
ok = 1
except (CompileError, LinkError):
--- 237,242 ----
self._check_compiler()
try:
! self._link(body, headers, include_dirs,
! libraries, library_dirs, lang)
ok = 1
except (CompileError, LinkError):
***************
*** 243,248 ****
return ok
! def try_run (self,
! body, headers=None,
libraries=None, library_dirs=None,
lang="c"):
--- 247,252 ----
return ok
! def try_run (self, body,
! headers=None, include_dirs=None,
libraries=None, library_dirs=None,
lang="c"):
***************
*** 254,258 ****
self._check_compiler()
try:
! self._link(body, headers, libraries, library_dirs, lang)
self.spawn([exe])
ok = 1
--- 258,263 ----
self._check_compiler()
try:
! self._link(body, headers, include_dirs,
! libraries, library_dirs, lang)
self.spawn([exe])
ok = 1
***************
*** 269,273 ****
# when implementing a real-world config command!)
! def check_func (self, func, headers=None,
libraries=None, library_dirs=None,
decl=0, call=0):
--- 274,279 ----
# when implementing a real-world config command!)
! def check_func (self, func,
! headers=None, include_dirs=None,
libraries=None, library_dirs=None,
decl=0, call=0):
***************
*** 299,312 ****
body = string.join(body, "\n") + "\n"
! return self.try_link(body, headers, libraries, library_dirs)
# check_func ()
! def check_header (self, header, lang="c"):
"""Determine if the system header file named by 'header_file'
exists and can be found by the preprocessor; return true if so,
false otherwise.
"""
! return self.try_cpp(headers=[header])
--- 305,332 ----
body = string.join(body, "\n") + "\n"
! return self.try_link(body, headers, include_dirs,
! libraries, library_dirs)
# check_func ()
! def check_lib (self, library, library_dirs=None,
! headers=None, include_dirs=None):
! """Determine if 'library' is available to be linked against,
! without actually checking that any particular symbols are provided
! by it. 'headers' will be used in constructing the source file to
! be compiled, but the only effect of this is to check if all the
! header files listed are available.
! """
! self._check_compiler()
! return self.try_link("int main (void) { }",
! headers, include_dirs, [library], library_dirs)
!
! def check_header (self, header, include_dirs=None,
! library_dirs=None, lang="c"):
"""Determine if the system header file named by 'header_file'
exists and can be found by the preprocessor; return true if so,
false otherwise.
"""
! return self.try_cpp(headers=[header], include_dirs=include_dirs)