Skip to content

Commit bff52e7

Browse files
Refactor def copy_assets
1 parent 51db9db commit bff52e7

File tree

1 file changed

+12
-18
lines changed

1 file changed

+12
-18
lines changed

web/scripts/builder.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -450,26 +450,20 @@ def create_item(item):
450450

451451
def copy_assets(self):
452452

453-
# Copy favicon.ico
454-
shutil.copyfile(os.path.join(INPUT_RESOURCES_PATH, 'favicon.ico'), os.path.join(OUTPUT_HTML_PATH, 'favicon.ico'))
455-
456-
self.logger.info("Copied favicon.ico")
457-
458-
# Copy _redirects
459-
460-
shutil.copyfile(os.path.join(INPUT_RESOURCES_PATH, '_redirects'), os.path.join(OUTPUT_HTML_PATH, '_redirects'))
461-
462-
self.logger.info("Copied _redirects")
463-
464-
# Clear output assets folder
465-
output_assets_folder = os.path.join(OUTPUT_HTML_PATH, 'assets')
466-
if os.path.exists(output_assets_folder):
467-
shutil.rmtree(output_assets_folder)
453+
copy_files = [
454+
'favicon.ico', '_redirects',
455+
]
456+
copy_folders = [
457+
'assets'
458+
]
468459

469-
# Copy all assets
470-
shutil.copytree(os.path.join(INPUT_RESOURCES_PATH, 'assets'), output_assets_folder)
460+
for file in copy_files:
461+
shutil.copyfile(os.path.join(INPUT_RESOURCES_PATH, file), os.path.join(OUTPUT_HTML_PATH, file))
462+
self.logger.info(f"Copied file {file}")
471463

472-
self.logger.info("Copied assets folder")
464+
for folder in copy_folders:
465+
shutil.copytree(os.path.join(INPUT_RESOURCES_PATH, folder), os.path.join(OUTPUT_HTML_PATH, folder))
466+
self.logger.info(f"Copied folder {folder}")
473467

474468
def generate_wiki(self):
475469
self.load_schemas()

0 commit comments

Comments
 (0)