Back to index

python3.2  3.2.2
Functions | Variables
checkextensions Namespace Reference

Functions

def checkextensions
def select
def treatword
def expandvars

Variables

list cc_flags = ['-I', '-D', '-U']
list cc_exts = ['.c', '.C', '.cc', '.c++']

Function Documentation

def checkextensions.checkextensions (   unknown,
  extensions 
)

Definition at line 8 of file checkextensions.py.

00008 
00009 def checkextensions(unknown, extensions):
00010     files = []
00011     modules = []
00012     edict = {}
00013     for e in extensions:
00014         setup = os.path.join(e, 'Setup')
00015         liba = os.path.join(e, 'lib.a')
00016         if not os.path.isfile(liba):
00017             liba = None
00018         edict[e] = parsesetup.getsetupinfo(setup), liba
00019     for mod in unknown:
00020         for e in extensions:
00021             (mods, vars), liba = edict[e]
00022             if mod not in mods:
00023                 continue
00024             modules.append(mod)
00025             if liba:
00026                 # If we find a lib.a, use it, ignore the
00027                 # .o files, and use *all* libraries for
00028                 # *all* modules in the Setup file
00029                 if liba in files:
00030                     break
00031                 files.append(liba)
00032                 for m in list(mods.keys()):
00033                     files = files + select(e, mods, vars,
00034                                            m, 1)
00035                 break
00036             files = files + select(e, mods, vars, mod, 0)
00037             break
00038     return files, modules

Here is the call graph for this function:

Here is the caller graph for this function:

def checkextensions.expandvars (   str,
  vars 
)

Definition at line 72 of file checkextensions.py.

00072 
00073 def expandvars(str, vars):
00074     i = 0
00075     while i < len(str):
00076         i = k = str.find('$', i)
00077         if i < 0:
00078             break
00079         i = i+1
00080         var = str[i:i+1]
00081         i = i+1
00082         if var == '(':
00083             j = str.find(')', i)
00084             if j < 0:
00085                 break
00086             var = str[i:j]
00087             i = j+1
00088         if var in vars:
00089             str = str[:k] + vars[var] + str[i:]
00090             i = k
00091     return str

Here is the caller graph for this function:

def checkextensions.select (   e,
  mods,
  vars,
  mod,
  skipofiles 
)

Definition at line 39 of file checkextensions.py.

00039 
00040 def select(e, mods, vars, mod, skipofiles):
00041     files = []
00042     for w in mods[mod]:
00043         w = treatword(w)
00044         if not w:
00045             continue
00046         w = expandvars(w, vars)
00047         for w in w.split():
00048             if skipofiles and w[-2:] == '.o':
00049                 continue
00050             # Assume $var expands to absolute pathname
00051             if w[0] not in ('-', '$') and w[-2:] in ('.o', '.a'):
00052                 w = os.path.join(e, w)
00053             if w[:2] in ('-L', '-R') and w[2:3] != '$':
00054                 w = w[:2] + os.path.join(e, w[2:])
00055             files.append(w)
00056     return files

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 60 of file checkextensions.py.

00060 
00061 def treatword(w):
00062     if w[:2] in cc_flags:
00063         return None
00064     if w[:1] == '-':
00065         return w # Assume loader flag
00066     head, tail = os.path.split(w)
00067     base, ext = os.path.splitext(tail)
00068     if ext in cc_exts:
00069         tail = base + '.o'
00070         w = os.path.join(head, tail)
00071     return w

Here is the caller graph for this function:


Variable Documentation

list checkextensions.cc_exts = ['.c', '.C', '.cc', '.c++']

Definition at line 58 of file checkextensions.py.

list checkextensions.cc_flags = ['-I', '-D', '-U']

Definition at line 57 of file checkextensions.py.