Back to index

python3.2  3.2.2
Classes | Functions | Variables
distutils.msvccompiler Namespace Reference

Classes

class  MacroExpander
class  MSVCCompiler

Functions

def read_keys
def read_values
def convert_mbcs
def get_build_version
def get_build_architecture
def normalize_and_reduce_paths

Variables

 _can_read_reg = False
 hkey_mod = winreg
 RegOpenKeyEx = winreg.OpenKeyEx
 RegEnumKey = winreg.EnumKey
 RegEnumValue = winreg.EnumValue
 RegError = winreg.error
tuple HKEYS
 OldMSVCCompiler = MSVCCompiler

Detailed Description

distutils.msvccompiler

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

Function Documentation

Definition at line 93 of file msvccompiler.py.

00093 
00094 def convert_mbcs(s):
00095     dec = getattr(s, "decode", None)
00096     if dec is not None:
00097         try:
00098             s = dec("mbcs")
00099         except UnicodeError:
00100             pass
00101     return s

Here is the call graph for this function:

Here is the caller graph for this function:

Return the processor architecture.

Possible results are "Intel", "Itanium", or "AMD64".

Definition at line 169 of file msvccompiler.py.

00169 
00170 def get_build_architecture():
00171     """Return the processor architecture.
00172 
00173     Possible results are "Intel", "Itanium", or "AMD64".
00174     """
00175 
00176     prefix = " bit ("
00177     i = sys.version.find(prefix)
00178     if i == -1:
00179         return "Intel"
00180     j = sys.version.find(")", i)
00181     return sys.version[i+len(prefix):j]

Return the version of MSVC that was used to build Python.

For Python 2.3 and up, the version number is included in
sys.version.  For earlier versions, assume the compiler is MSVC 6.

Definition at line 147 of file msvccompiler.py.

00147 
00148 def get_build_version():
00149     """Return the version of MSVC that was used to build Python.
00150 
00151     For Python 2.3 and up, the version number is included in
00152     sys.version.  For earlier versions, assume the compiler is MSVC 6.
00153     """
00154     prefix = "MSC v."
00155     i = sys.version.find(prefix)
00156     if i == -1:
00157         return 6
00158     i = i + len(prefix)
00159     s, rest = sys.version[i:].split(" ", 1)
00160     majorVersion = int(s[:-2]) - 6
00161     minorVersion = int(s[2:3]) / 10.0
00162     # I don't think paths are affected by minor version in version 6
00163     if majorVersion == 6:
00164         minorVersion = 0
00165     if majorVersion >= 6:
00166         return majorVersion + minorVersion
00167     # else we don't know what version of the compiler this is
00168     return None

Here is the call graph for this function:

Here is the caller graph for this function:

Return a list of normalized paths with duplicates removed.

The current order of paths is maintained.

Definition at line 182 of file msvccompiler.py.

00182 
00183 def normalize_and_reduce_paths(paths):
00184     """Return a list of normalized paths with duplicates removed.
00185 
00186     The current order of paths is maintained.
00187     """
00188     # Paths are normalized so things like:  /a and /a/ aren't both preserved.
00189     reduced_paths = []
00190     for p in paths:
00191         np = os.path.normpath(p)
00192         # XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set.
00193         if np not in reduced_paths:
00194             reduced_paths.append(np)
00195     return reduced_paths
00196 

def distutils.msvccompiler.read_keys (   base,
  key 
)
Return list of registry keys.

Definition at line 55 of file msvccompiler.py.

00055 
00056 def read_keys(base, key):
00057     """Return list of registry keys."""
00058     try:
00059         handle = RegOpenKeyEx(base, key)
00060     except RegError:
00061         return None
00062     L = []
00063     i = 0
00064     while True:
00065         try:
00066             k = RegEnumKey(handle, i)
00067         except RegError:
00068             break
00069         L.append(k)
00070         i += 1
00071     return L

def distutils.msvccompiler.read_values (   base,
  key 
)
Return dict of registry keys and values.

All names are converted to lowercase.

Definition at line 72 of file msvccompiler.py.

00072 
00073 def read_values(base, key):
00074     """Return dict of registry keys and values.
00075 
00076     All names are converted to lowercase.
00077     """
00078     try:
00079         handle = RegOpenKeyEx(base, key)
00080     except RegError:
00081         return None
00082     d = {}
00083     i = 0
00084     while True:
00085         try:
00086             name, value, type = RegEnumValue(handle, i)
00087         except RegError:
00088             break
00089         name = name.lower()
00090         d[convert_mbcs(name)] = convert_mbcs(value)
00091         i += 1
00092     return d

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 19 of file msvccompiler.py.

Definition at line 24 of file msvccompiler.py.

Initial value:
00001 (hkey_mod.HKEY_USERS,
00002              hkey_mod.HKEY_CURRENT_USER,
00003              hkey_mod.HKEY_LOCAL_MACHINE,
00004              hkey_mod.HKEY_CLASSES_ROOT)

Definition at line 50 of file msvccompiler.py.

Definition at line 637 of file msvccompiler.py.

Definition at line 27 of file msvccompiler.py.

Definition at line 28 of file msvccompiler.py.

Definition at line 29 of file msvccompiler.py.

Definition at line 26 of file msvccompiler.py.