Skip to content

Commit 332ff79

Browse files
don't worry about cleanup
1 parent 35df336 commit 332ff79

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 = {
@@ -63,18 +52,6 @@ def run_prebuild_script():
6352
else:
6453
print("prebuild.sh not found.")
6554

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

0 commit comments

Comments
 (0)