#576 - Obsolete PBO removal support added to build.py

This commit is contained in:
ViperMaul 2015-04-14 10:52:30 -07:00
parent 511ca860e0
commit db890f3b48

View File

@ -19,6 +19,11 @@ def check_for_changes(addonspath, module):
return True
return mod_time(os.path.join(addonspath, module)) > mod_time(os.path.join(addonspath, "ace_{}.pbo".format(module)))
def check_for_obsolete_pbos(addonspath, file):
module = file[4:-4]
if not os.path.exists(os.path.join(addonspath, module)):
return True
return False
def main():
print("""
@ -36,6 +41,16 @@ def main():
made = 0
failed = 0
skipped = 0
removed = 0
for file in os.listdir(addonspath):
if os.path.isfile(file):
if check_for_obsolete_pbos(addonspath, file):
removed += 1
print(" Removing obsolete file => " + file)
os.remove(file)
print("")
for p in os.listdir(addonspath):
path = os.path.join(addonspath, p)
if not os.path.isdir(path):
@ -65,7 +80,7 @@ def main():
print(" Successfully made {}.".format(p))
print("\n# Done.")
print(" Made {}, skipped {}, failed to make {}.".format(made, skipped, failed))
print(" Made {}, skipped {}, removed {}, failed to make {}.".format(made, skipped, removed, failed))
if __name__ == "__main__":