Rev 2127 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 2127 | Rev 2137 | ||
|---|---|---|---|
| Line 70... | Line 70... | ||
| 70 | print "\tModule: "+parts[0][:-3]+"\t"+parts[1].strip(" ") |
70 | print "\tModule: "+parts[0][:-3]+"\t"+parts[1].strip(" ") |
| 71 | else: |
71 | else: |
| 72 | foundModules.append(parts[0][:-3]+"$"+node+"$"+parts[1].strip(" ")) |
72 | foundModules.append(parts[0][:-3]+"$"+node+"$"+parts[1].strip(" ")) |
| 73 | 73 | ||
| 74 | return foundModules |
74 | return foundModules |
| - | 75 | ||
| - | 76 | def parseHwIdFromFile(fileName): |
|
| - | 77 | index = 0 |
|
| - | 78 | config_inc = open(fileName, 'r') |
|
| - | 79 | config_inc_lines = config_inc.readlines() |
|
| - | 80 | config_inc.close() |
|
| - | 81 | parts = fileName.split("/") |
|
| - | 82 | node = parts[1] |
|
| - | 83 | for line in config_inc_lines: |
|
| - | 84 | line = line.strip("\n").strip(" ") |
|
| - | 85 | ||
| - | 86 | if line.find("NODE_HW_ID=") == 0: |
|
| - | 87 | parts = line.split("=") |
|
| - | 88 | return parts[1] |
|
| - | 89 | return "" |
|
| 75 | 90 | ||
| 76 | def getAllModuleIdsFromFile(): |
91 | def getAllModuleIdsFromFile(): |
| 77 | foundModules = [] |
92 | foundModules = [] |
| 78 | for applicationName in os.listdir("../"): |
93 | for applicationName in os.listdir("../"): |
| 79 | if applicationName[0] != '.' and os.path.exists("../" + applicationName + "/config.inc"): |
94 | if applicationName[0] != '.' and os.path.exists("../" + applicationName + "/config.inc"): |
| Line 91... | Line 106... | ||
| 91 | 106 | ||
| 92 | def getAllNodesFromFile(): |
107 | def getAllNodesFromFile(): |
| 93 | files = sorted(os.listdir("../"), key=str.lower) |
108 | files = sorted(os.listdir("../"), key=str.lower) |
| 94 | for applicationName in files: |
109 | for applicationName in files: |
| 95 | if applicationName[0] != '.' and os.path.exists("../" + applicationName + "/config.inc"): |
110 | if applicationName[0] != '.' and os.path.exists("../" + applicationName + "/config.inc"): |
| - | 111 | if applicationName[0] != '.' and os.path.exists("../" + applicationName + "/bios.inc"): |
|
| - | 112 | hwid = parseHwIdFromFile("../" + applicationName + "/bios.inc") |
|
| 96 | print "Found node: "+applicationName |
113 | print "Found node: "+applicationName+ "\n With hwId: "+hwid |
| 97 | parseAllModuleIdFromFile("../" + applicationName + "/config.inc", 0) |
114 | parseAllModuleIdFromFile("../" + applicationName + "/config.inc", 0) |
| 98 | 115 | ||
| 99 | def getFreeModuleId(takenIds): |
116 | def getFreeModuleId(takenIds): |
| 100 | if len(takenIds) == 0: |
117 | if len(takenIds) == 0: |
| 101 | return 1 |
118 | return 1 |