X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2Fbertos_utils.py;h=0a1076911acf06ed8f470093c3c8c977b10f59f5;hb=86ebaa4c17f3296c403b51ab8e922f4fa889a401;hp=de56cfe6c2c3d3e65105e093c6691d57be841f36;hpb=96f5b22a16883476aed0d6ba1620dd48800ae4e2;p=bertos.git diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index de56cfe6..0a107691 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -10,6 +10,9 @@ # import os +import fnmatch + +import const def isBertosDir(directory): return os.path.exists(directory + "/VERSION") @@ -21,4 +24,23 @@ def createBertosProject(directory): if not os.path.isdir(directory): os.mkdir(directory) open(directory + "/project.bertos", "w") - \ No newline at end of file + +def findDefinitions(ftype, path): + L = os.walk(path) + for element in L: + for filename in element[2]: + if fnmatch.fnmatch(filename, "*." + ftype): + yield (filename, element[0]) + +def loadCpuInfos(path): + cpuInfos = [] + for definition in findDefinitions(const.CPU_DEFINITION, path): + D = {} + D.update(const.CPU_DEF) + def include(filename, dict = D, directory=definition[1]): + execfile(directory + "/" + filename, {}, D) + D["include"] = include + include(definition[0], D) + D["CPU_NAME"] = definition[0].split(".")[0] + cpuInfos.append(D) + return cpuInfos