Back to index

enigmail  1.4.3
Classes | Functions
expandlibs Namespace Reference

Classes

class  LibDescriptor
class  ExpandArgs

Functions

def relativize
def isObject

Function Documentation

def expandlibs.isObject (   path)
Returns whether the given path points to an object file, that is,
ends with OBJ_SUFFIX or .i_o

Definition at line 89 of file expandlibs.py.

00089 
00090 def isObject(path):
00091     '''Returns whether the given path points to an object file, that is,
00092     ends with OBJ_SUFFIX or .i_o'''
00093     return os.path.splitext(path)[1] in [conf.OBJ_SUFFIX, '.i_o']

Here is the caller graph for this function:

def expandlibs.relativize (   path)
Returns a path relative to the current working directory, if it is
shorter than the given path

Definition at line 66 of file expandlibs.py.

00066 
00067 def relativize(path):
00068     '''Returns a path relative to the current working directory, if it is
00069     shorter than the given path'''
00070     def splitpath(path):
00071         dir, file = os.path.split(path)
00072         if os.path.splitdrive(dir)[1] == os.sep:
00073             return [file]
00074         return splitpath(dir) + [file]
00075 
00076     if not os.path.exists(path):
00077         return path
00078     curdir = splitpath(os.path.abspath(os.curdir))
00079     abspath = splitpath(os.path.abspath(path))
00080     while curdir and abspath and curdir[0] == abspath[0]:
00081         del curdir[0]
00082         del abspath[0]
00083     if not curdir and not abspath:
00084         return '.'
00085     relpath = os.path.join(*[os.pardir for i in curdir] + abspath)
00086     if len(path) > len(relpath):
00087         return relpath
00088     return path

Here is the caller graph for this function: