Allow create-directories to be run multiple times
Currently the create-directories tool can only be run once as if the candidates/<election>/ directory exists it will abort. If a project is approved by the TC after the directories are created but before the election start that candidates directory needs to be created by hand. Instead change create-directories to only create the files/directories as needed so it can be run several times. Change-Id: I62bba67447e2ed91138d6e099b45411cba72be36
This commit is contained in:
parent
2c14137f46
commit
041d3a8146
@ -25,15 +25,12 @@ def main():
|
||||
exit(1)
|
||||
|
||||
base_dir = "candidates/%s" % utils.conf['release']
|
||||
if os.path.exists(base_dir):
|
||||
print("%s: directory already exists" % base_dir)
|
||||
exit(1)
|
||||
|
||||
projects = utils.get_projects()
|
||||
project_list = list(projects.keys())
|
||||
project_list.sort()
|
||||
for project in project_list + ["TC"]:
|
||||
dpath = "%s/%s" % (base_dir, utils.name2dir(project))
|
||||
os.makedirs(dpath)
|
||||
open("%s/.placeholder" % dpath, "w").close()
|
||||
print("[+] Created %s" % (dpath))
|
||||
if not os.path.exists(dpath):
|
||||
os.makedirs(dpath)
|
||||
open("%s/.placeholder" % dpath, "w").close()
|
||||
print("[+] Created %s" % (dpath))
|
||||
|
Loading…
Reference in New Issue
Block a user