util/misc.py
changeset 1953 5736d25bb393
parent 1930 e6de7df5f401
child 2456 7373e3048167
equal deleted inserted replaced
1952:0c20fc810d61 1953:5736d25bb393
    44         for name in files:
    44         for name in files:
    45             if os.access(root, os.W_OK) is not True or os.access(os.path.join(root, name), os.W_OK) is not True:
    45             if os.access(root, os.W_OK) is not True or os.access(os.path.join(root, name), os.W_OK) is not True:
    46                 return False
    46                 return False
    47     return True
    47     return True
    48 
    48 
       
    49 
    49 def GetClassImporter(param):
    50 def GetClassImporter(param):
    50     """
    51     """
    51     is used to resolve library class names in features.py
    52     is used to resolve library class names in features.py
    52     if param is a string, returns a callable that return the class pointed by param
    53     if param is a string, returns a callable that return the class pointed by param
    53     if a class is given, then returns a callable that returns the given class.
    54     if a class is given, then returns a callable that returns the given class.
    58             # on-demand import, only when using class
    59             # on-demand import, only when using class
    59             mod = __import__(param.rsplit('.', 1)[0])
    60             mod = __import__(param.rsplit('.', 1)[0])
    60             return reduce(getattr, param.split('.')[1:], mod)
    61             return reduce(getattr, param.split('.')[1:], mod)
    61         return factory
    62         return factory
    62     else:
    63     else:
    63         return lambda : param
    64         return lambda: param
    64 
    65 
    65 
    66 
    66 def InstallLocalRessources(CWD):
    67 def InstallLocalRessources(CWD):
    67     # Beremiz bitmaps
    68     # Beremiz bitmaps
    68     AddBitmapFolder(os.path.join(CWD, "images"))
    69     AddBitmapFolder(os.path.join(CWD, "images"))