From b869dc4dd9eff5c5b9b0677d6834fb5027c70559 Mon Sep 17 00:00:00 2001 From: alexzvk Date: Tue, 29 Nov 2022 16:45:26 -0500 Subject: [PATCH] fixes bug for when a not open source license is selected --- hooks/post_gen_project.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 996f5761..37cb53ca 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -331,6 +331,11 @@ def handle_licenses(): with open(os.path.join("licenses", "-temporary-placeholder.txt")) as f: selected_title = f.readline() + if selected_title == "Not open source": + os.remove("CONTRIBUTORS.txt") + shutil.rmtree("licenses") + return + with open(os.path.join("licenses", "licenses.json")) as f: titles_dict = json.load(f) # access the title to filename dictionary to find the correct file @@ -342,8 +347,6 @@ def handle_licenses(): # +2 to get rid of the --- and and an extra new line f.writelines(contents[contents.index("---\n", 1) + 2:]) - if selected_title == "Not open source": - os.remove("CONTRIBUTORS.txt") shutil.rmtree("licenses")