def VerifyCollisions () -> None: print("Verifying STBL collisions.") staticKeys = list() # type: typing.List[int] for keysFileName in os.listdir(Paths.STBLCollisionsPath): # type: str keysFilePath = os.path.join(Paths.STBLCollisionsPath, keysFileName) # type: str with open(keysFilePath) as keysFile: for staticKey in keysFile.readlines(): staticKeys.append(int(staticKey)) modEntries = list() # type: typing.List[typing.Tuple[str, int]] for modNamespace in Mods.GetAllModNames(): # type: str try: stblModule = importlib.import_module("Mod_" + modNamespace.replace(".", "_") + ".STBL") except: continue modEntries.extend(stblModule.GetEntries()) for entryIdentifier, entryKey in modEntries: # type: str, int if entryKey in staticKeys: print("Colliding STBL key for entry '" + entryIdentifier + "'. Entry key: " + str(entryKey) + " (" + ConvertIntegerToHexadecimal(entryKey, minimumLength = 8) + ")", file = sys.stderr) for entryIndex, entry in enumerate(modEntries): # type: int, typing.Tuple[str, int] for checkingEntryIndex, checkingEntry in enumerate(modEntries): # type: int, typing.Tuple[str, int] if entryIndex == checkingEntryIndex: continue if entry[1] == checkingEntry[1]: print("Colliding STBL key between entry '" + entry[0] + "'. and '" + checkingEntry[0] + "' Entry key: " + str(entry[1]) + " (" + ConvertIntegerToHexadecimal(entry[1], minimumLength = 8) + ")", file = sys.stderr)
def Run() -> bool: for modNamespace in Mods.GetAllModNames(): # type: str Mods.BuildModRebuild(modNamespace) print("All mods built. " + datetime.datetime.now().strftime("%I:%M %p")) return True
def VerifyStripping() -> None: print("Verifying stripping.") print("Verifying environment file stripping.") environmentIncludedPaths = GetIncludedPaths( Paths.StrippingEnvironmentFilePath, Paths.RootPath) # type: typing.List[str] _VerifyStripped(Paths.RootPath, environmentIncludedPaths) for modName in Mods.GetAllModNames(): # type: str print("Verifying mod '" + modName + "' file stripping.") modPath = Mods.GetModPath(modName) # type: str modIncludedPaths = GetIncludedPaths(Paths.StrippingModsFilePath, modPath) _VerifyStripped(modPath, modIncludedPaths) for siteName in Sites.GetAllSiteNames(): # type: str print("Verifying site '" + siteName + "' file stripping.") sitePath = Sites.GetSitePath(siteName) # type: str siteIncludedPaths = GetIncludedPaths(Paths.StrippingSitesFilePath, sitePath) _VerifyStripped(sitePath, siteIncludedPaths)