Skip to content

Commit ddff0af

Browse files
don't worry about cleanup
1 parent 9e247ce commit ddff0af

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

app/get_knowledge_base.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@
77

88
kb_file_path = './data/knowledge_base.json'
99

10-
def clean_tmp(dir_path):
11-
""" Clears out all contents of the specified directory except for prebuild.sh """
12-
for item in os.listdir(dir_path):
13-
item_path = os.path.join(dir_path, item)
14-
if item != "prebuild.sh": # Keep prebuild.sh
15-
if os.path.isdir(item_path):
16-
shutil.rmtree(item_path)
17-
else:
18-
os.remove(item_path)
19-
2010
def clone_repository(repo_url, local_dir):
2111
""" Clone or pull the repository based on its existence. """
2212
if not os.path.exists(local_dir):
@@ -30,7 +20,6 @@ def clone_repository(repo_url, local_dir):
3020
def setup_repositories():
3121
tmp_dir = ".tmp"
3222
os.makedirs(tmp_dir, exist_ok=True)
33-
clean_tmp(tmp_dir) # Clean the temporary directory before setting up
3423

3524
# Define repositories and their URLs
3625
repos = {
@@ -62,18 +51,6 @@ def run_prebuild_script():
6251
else:
6352
print("prebuild.sh not found.")
6453

65-
def cleanup():
66-
""" Clean up unneeded files, preserving only 'docs' and 'blog' directories """
67-
os.chdir("./defang-docs")
68-
for item in os.listdir('.'):
69-
if item not in ['docs', 'blog']: # Check if the item is not one of the directories to keep
70-
item_path = os.path.join('.', item) # Construct the full path
71-
if os.path.isdir(item_path):
72-
shutil.rmtree(item_path) # Remove the directory and all its contents
73-
else:
74-
os.remove(item_path) # Remove the file
75-
print("Cleanup completed successfully.")
76-
7754
def parse_markdown():
7855
""" Parse markdown files in the current directory into JSON """
7956
reset_knowledge_base() # Reset the JSON database file
@@ -195,10 +172,8 @@ def recursive_parse_directory(root_dir):
195172
if __name__ == "__main__":
196173
setup_repositories()
197174
run_prebuild_script()
198-
cleanup()
199175
os.chdir('../../')
200176
print(os.listdir('.'))
201177
parse_markdown() # Start parsing logic after all setups
202178
print(os.listdir('.'))
203-
clean_tmp('./.tmp')
204179
print("All processes completed successfully.")

0 commit comments

Comments
 (0)