From de622265b3f2b70babda28c4c2e492e829d4e384 Mon Sep 17 00:00:00 2001 From: vChavezB <47216966+vChavezB@users.noreply.github.com> Date: Sun, 11 Dec 2022 11:10:12 +0100 Subject: [PATCH 1/5] replaced dsutil with shutil --- puncover_html.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/puncover_html.py b/puncover_html.py index 247799e..b077896 100644 --- a/puncover_html.py +++ b/puncover_html.py @@ -5,7 +5,7 @@ import re import os import argparse -import distutils.dir_util +import shutil  version = "1.1.0" @@ -190,17 +190,16 @@ def get_local_html(puncover_url): def local_html(): print("Processing main page") - pages_dir = dir_out.joinpath("path") - static_dir = dir_out.joinpath("static") + pages_dir_out = dir_out.joinpath("path") + static_dir_out = dir_out.joinpath("static") if not os.path.exists(dir_out): os.makedirs(dir_out) - if not os.path.exists(pages_dir): - os.makedirs(pages_dir) - if not os.path.exists(static_dir): - os.makedirs(static_dir) - # Copy html static dir (css,js,etc) to output - distutils.dir_util.copy_tree(str(script_root.joinpath("static")), - str(static_dir)) + if not os.path.exists(pages_dir_out): + os.makedirs(pages_dir_out) + if not os.path.exists(static_dir_out): + os.makedirs(static_dir_out) + # Copy html static dir (css,js,etc) to output + shutil.copytree(script_root.joinpath("static")), static_dir_out) index = requests.get(url_base) index_html_path = dir_out.joinpath("index.html") index_file = open(index_html_path, "w+") From 23f85ce38fb3dc9390338a6b3d2a4728769d4a31 Mon Sep 17 00:00:00 2001 From: vChavezB <47216966+vChavezB@users.noreply.github.com> Date: Sun, 11 Dec 2022 11:16:16 +0100 Subject: [PATCH 2/5] unicode character bug --- puncover_html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/puncover_html.py b/puncover_html.py index b077896..66f9c0b 100644 --- a/puncover_html.py +++ b/puncover_html.py @@ -5,7 +5,7 @@ import re import os import argparse -import shutil  +import shutil version = "1.1.0" From 2148926dd94be2fecbb5ea5698fc265d4fcfc382 Mon Sep 17 00:00:00 2001 From: vChavezB <47216966+vChavezB@users.noreply.github.com> Date: Sun, 11 Dec 2022 11:19:08 +0100 Subject: [PATCH 3/5] fixed unmatched parenthesis --- puncover_html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/puncover_html.py b/puncover_html.py index 66f9c0b..038b31c 100644 --- a/puncover_html.py +++ b/puncover_html.py @@ -199,7 +199,7 @@ def local_html(): if not os.path.exists(static_dir_out): os.makedirs(static_dir_out) # Copy html static dir (css,js,etc) to output - shutil.copytree(script_root.joinpath("static")), static_dir_out) + shutil.copytree(script_root.joinpath("static"), static_dir_out) index = requests.get(url_base) index_html_path = dir_out.joinpath("index.html") index_file = open(index_html_path, "w+") From 4f157a001e3cd0c76050b82b802e0a6cd73a2fab Mon Sep 17 00:00:00 2001 From: vChavezB <47216966+vChavezB@users.noreply.github.com> Date: Sun, 11 Dec 2022 11:24:50 +0100 Subject: [PATCH 4/5] fix overwrite shutil --- puncover_html.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/puncover_html.py b/puncover_html.py index 038b31c..9a71fa2 100644 --- a/puncover_html.py +++ b/puncover_html.py @@ -190,16 +190,17 @@ def get_local_html(puncover_url): def local_html(): print("Processing main page") + static_dir_in = script_root.joinpath("static") pages_dir_out = dir_out.joinpath("path") static_dir_out = dir_out.joinpath("static") if not os.path.exists(dir_out): os.makedirs(dir_out) if not os.path.exists(pages_dir_out): os.makedirs(pages_dir_out) - if not os.path.exists(static_dir_out): - os.makedirs(static_dir_out) + if os.path.exists(static_dir_out): + shutil.rmtree(static_dir_out) # Copy html static dir (css,js,etc) to output - shutil.copytree(script_root.joinpath("static"), static_dir_out) + shutil.copytree(static_dir_out, static_dir_in) index = requests.get(url_base) index_html_path = dir_out.joinpath("index.html") index_file = open(index_html_path, "w+") From 36c88c3a1df3536c782c8039bbd0f11ed6b3d4af Mon Sep 17 00:00:00 2001 From: vChavezB <47216966+vChavezB@users.noreply.github.com> Date: Sun, 11 Dec 2022 11:28:04 +0100 Subject: [PATCH 5/5] fix arguments for shutil --- puncover_html.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/puncover_html.py b/puncover_html.py index 9a71fa2..7cfcf4f 100644 --- a/puncover_html.py +++ b/puncover_html.py @@ -200,7 +200,7 @@ def local_html(): if os.path.exists(static_dir_out): shutil.rmtree(static_dir_out) # Copy html static dir (css,js,etc) to output - shutil.copytree(static_dir_out, static_dir_in) + shutil.copytree(static_dir_in, static_dir_out) index = requests.get(url_base) index_html_path = dir_out.joinpath("index.html") index_file = open(index_html_path, "w+")