msvccompiler
index
s:\sp\msvccompiler.py

distutils.msvccompiler
 
Contains MSVCCompiler, an implementation of the abstract CCompiler class
for the Microsoft Visual Studio.

 
Modules
            
_winreg
_winreg
os
string
sys
 
Classes
            
distutils.ccompiler.CCompiler
MSVCCompiler
 
class MSVCCompiler(distutils.ccompiler.CCompiler)
      Concrete class that implements an interface to Microsoft Visual C++,
as defined by the CCompiler abstract class.
 
   Methods defined here:
__init__(self, verbose=0, dry_run=0, force=0)
compile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None)
create_static_lib(self, objects, output_libname, output_dir=None, debug=0, extra_preargs=None, extra_postargs=None)
find_library_file(self, dirs, lib, debug=0)
library_dir_option(self, dir)
library_option(self, lib)
link(self, target_desc, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None)
object_filenames(self, source_filenames, strip_dir=0, output_dir='')
runtime_library_dir_option(self, dir)

Data and non-method functions defined here:
__doc__ = 'Concrete class that implements an interface to M... as defined by the CCompiler abstract class.'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
__module__ = 'msvccompiler'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
_c_extensions = ['.c']
list() -> new list
list(sequence) -> new list initialized from sequence's items
_cpp_extensions = ['.cc', '.cpp', '.cxx']
list() -> new list
list(sequence) -> new list initialized from sequence's items
_mc_extensions = ['.mc']
list() -> new list
list(sequence) -> new list initialized from sequence's items
_rc_extensions = ['.rc']
list() -> new list
list(sequence) -> new list initialized from sequence's items
compiler_type = 'msvc'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
exe_extension = '.exe'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
executables = {}
dict() -> new empty dictionary.
dict(mapping) -> new dictionary initialized from a mapping object's
    (key, value) pairs.
dict(seq) -> new dictionary initialized as if via:
    d = {}
    for k, v in seq:
        d[k] = v
obj_extension = '.obj'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
res_extension = '.res'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
shared_lib_extension = '.dll'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
shared_lib_format = '%s%s'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
src_extensions = ['.c', '.cc', '.cpp', '.cxx', '.rc', '.mc']
list() -> new list
list(sequence) -> new list initialized from sequence's items
static_lib_extension = '.lib'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
static_lib_format = '%s%s'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

Methods inherited from distutils.ccompiler.CCompiler:
_check_macro_definitions(self, definitions)
Ensures that every element of 'definitions' is a valid macro
definition, ie. either (name,value) 2-tuple or a (name,) tuple.  Do
nothing if all definitions are OK, raise TypeError otherwise.
_find_macro(self, name)
_fix_compile_args(self, output_dir, macros, include_dirs)
Typecheck and fix-up some of the arguments to the 'compile()'
method, and return fixed-up values.  Specifically: if 'output_dir'
is None, replaces it with 'self.output_dir'; ensures that 'macros'
is a list, and augments it with 'self.macros'; ensures that
'include_dirs' is a list, and augments it with 'self.include_dirs'.
Guarantees that the returned values are of the correct type,
i.e. for 'output_dir' either string or None, and for 'macros' and
'include_dirs' either list or None.
_fix_lib_args(self, libraries, library_dirs, runtime_library_dirs)
Typecheck and fix up some of the arguments supplied to the
'link_*' methods.  Specifically: ensure that all arguments are
lists, and augment them with their permanent versions
(eg. 'self.libraries' augments 'libraries').  Return a tuple with
fixed versions of all arguments.
_fix_object_args(self, objects, output_dir)
Typecheck and fix up some arguments supplied to various methods.
Specifically: ensure that 'objects' is a list; if output_dir is
None, replace with self.output_dir.  Return fixed versions of
'objects' and 'output_dir'.
_need_link(self, objects, output_file)
Return true if we need to relink the files listed in 'objects'
to recreate 'output_file'.
_prep_compile(self, sources, output_dir)
Determine the list of object files corresponding to 'sources',
and figure out which ones really need to be recompiled.  Return a
list of all object files and a dictionary telling which source
files can be skipped.
add_include_dir(self, dir)
Add 'dir' to the list of directories that will be searched for
header files.  The compiler is instructed to search directories in
the order in which they are supplied by successive calls to
'add_include_dir()'.
add_library(self, libname)
Add 'libname' to the list of libraries that will be included in
all links driven by this compiler object.  Note that 'libname'
should *not* be the name of a file containing a library, but the
name of the library itself: the actual filename will be inferred by
the linker, the compiler, or the compiler class (depending on the
platform).
 
The linker will be instructed to link against libraries in the
order they were supplied to 'add_library()' and/or
'set_libraries()'.  It is perfectly valid to duplicate library
names; the linker will be instructed to link against libraries as
many times as they are mentioned.
add_library_dir(self, dir)
Add 'dir' to the list of directories that will be searched for
libraries specified to 'add_library()' and 'set_libraries()'.  The
linker will be instructed to search for libraries in the order they
are supplied to 'add_library_dir()' and/or 'set_library_dirs()'.
add_link_object(self, object)
Add 'object' to the list of object files (or analogues, such as
explicitly named library files or the output of "resource
compilers") to be included in every link driven by this compiler
object.
add_runtime_library_dir(self, dir)
Add 'dir' to the list of directories that will be searched for
shared libraries at runtime.
announce(self, msg, level=1)
debug_print(self, msg)
define_macro(self, name, value=None)
Define a preprocessor macro for all compilations driven by this
compiler object.  The optional parameter 'value' should be a
string; if it is not supplied, then the macro will be defined
without an explicit value and the exact outcome depends on the
compiler used (XXX true? does ANSI say anything about this?)
executable_filename(self, basename, strip_dir=0, output_dir='')
execute(self, func, args, msg=None, level=1)
library_filename(self, libname, lib_type='static', strip_dir=0, output_dir='')
link_executable(self, objects, output_progname, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None)
link_shared_lib(self, objects, output_libname, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None)
link_shared_object(self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None)
mkpath(self, name, mode=511)
move_file(self, src, dst)
preprocess(self, source, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None)
Preprocess a single C/C++ source file, named in 'source'.
Output will be written to file named 'output_file', or stdout if
'output_file' not supplied.  'macros' is a list of macro
definitions as for 'compile()', which will augment the macros set
with 'define_macro()' and 'undefine_macro()'.  'include_dirs' is a
list of directory names that will be added to the default list.
 
Raises PreprocessError on failure.
set_executable(self, key, value)
set_executables(self, **args)
Define the executables (and options for them) that will be run
to perform the various stages of compilation.  The exact set of
executables that may be specified here depends on the compiler
class (via the 'executables' class attribute), but most will have:
  compiler      the C/C++ compiler
  linker_so     linker used to create shared objects and libraries
  linker_exe    linker used to create binary executables
  archiver      static library creator
 
On platforms with a command-line (Unix, DOS/Windows), each of these
is a string that will be split into executable name and (optional)
list of arguments.  (Splitting the string is done similarly to how
Unix shells operate: words are delimited by spaces, but quotes and
backslashes can override this.  See
'distutils.util.split_quoted()'.)
set_include_dirs(self, dirs)
Set the list of directories that will be searched to 'dirs' (a
list of strings).  Overrides any preceding calls to
'add_include_dir()'; subsequence calls to 'add_include_dir()' add
to the list passed to 'set_include_dirs()'.  This does not affect
any list of standard include directories that the compiler may
search by default.
set_libraries(self, libnames)
Set the list of libraries to be included in all links driven by
this compiler object to 'libnames' (a list of strings).  This does
not affect any standard system libraries that the linker may
include by default.
set_library_dirs(self, dirs)
Set the list of library search directories to 'dirs' (a list of
strings).  This does not affect any standard library search path
that the linker may search by default.
set_link_objects(self, objects)
Set the list of object files (or analogues) to be included in
every link to 'objects'.  This does not affect any standard object
files that the linker may include by default (such as system
libraries).
set_runtime_library_dirs(self, dirs)
Set the list of directories to search for shared libraries at
runtime to 'dirs' (a list of strings).  This does not affect any
standard search path that the runtime linker may search by
default.
shared_object_filename(self, basename, strip_dir=0, output_dir='')
spawn(self, cmd)
undefine_macro(self, name)
Undefine a preprocessor macro for all compilations driven by
this compiler object.  If the same macro is defined by
'define_macro()' and undefined by 'undefine_macro()' the last call
takes precedence (including multiple redefinitions or
undefinitions).  If the macro is redefined/undefined on a
per-compilation basis (ie. in the call to 'compile()'), then that
takes precedence.
warn(self, msg)

Data and non-method functions inherited from distutils.ccompiler.CCompiler:
EXECUTABLE = 'executable'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
SHARED_LIBRARY = 'shared_library'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
SHARED_OBJECT = 'shared_object'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
Functions
            
RegEnumKey = EnumKey(...)
string = EnumKey(key, index) - Enumerates subkeys of an open registry key.
 
key is an already open key, or any one of the predefined HKEY_* constants.
index is an integer that identifies the index of the key to retrieve.
 
The function retrieves the name of one subkey each time it is called.
It is typically called repeatedly until an EnvironmentError exception is
raised, indicating no more values are available.
RegEnumValue = EnumValue(...)
tuple = EnumValue(key, index) - Enumerates values of an open registry key.
key is an already open key, or any one of the predefined HKEY_* constants.
index is an integer that identifies the index of the value to retrieve.
 
The function retrieves the name of one subkey each time it is called.
It is typically called repeatedly, until an EnvironmentError exception
is raised, indicating no more values.
 
The result is a tuple of 3 items:
value_name is a string that identifies the value.
value_data is an object that holds the value data, and whose type depends
 on the underlying registry type.
data_type is an integer that identifies the type of the value data.
RegOpenKeyEx = OpenKeyEx(...)
See OpenKey()
find_exe(exe, version_number)
Try to find an MSVC executable program 'exe' (from version
'version_number' of MSVC) in several places: first, one of the MSVC
program search paths from the registry; next, the directories in the
PATH environment variable.  If any of those work, return an absolute
path that is known to exist.  If none of them work, just return the
original program name, 'exe'.
get_devstudio_versions()
Get list of devstudio versions from the Windows registry.  Return a
list of strings containing version numbers; the list will be
empty if we were unable to access the registry (eg. couldn't import
a registry-access module) or the appropriate registry keys weren't
found.
get_msvc_paths(path, version='6.0', platform='x86')
Get a list of devstudio directories (include, lib or path).  Return
a list of strings; will be empty list if unable to access the
registry or appropriate registry keys not found.
set_path_env_var(name, version_number)
Set environment variable 'name' to an MSVC path type value obtained
from 'get_msvc_paths()'.  This is equivalent to a SET command prior
to execution of spawned commands.
 
Data
             HKEY_CLASSES_ROOT = -2147483648
HKEY_CURRENT_USER = -2147483647
HKEY_LOCAL_MACHINE = -2147483646
HKEY_USERS = -2147483645
StringTypes = (<type 'str'>, <type 'unicode'>)
__file__ = r'S:\sp\msvccompiler.pyc'
__name__ = 'msvccompiler'
__revision__ = '$Id: msvccompiler.py,v 1.43.6.2 2002/02/22 13:55:28 mwh Exp $'
_can_read_reg = 1