|
5 | 5 | import re |
6 | 6 | import os |
7 | 7 | import argparse |
8 | | -import distutils.dir_util |
| 8 | +import shutil |
9 | 9 |
|
10 | 10 | version = "1.1.0" |
11 | 11 |
|
@@ -190,17 +190,17 @@ def get_local_html(puncover_url): |
190 | 190 |
|
191 | 191 | def local_html(): |
192 | 192 | print("Processing main page") |
193 | | - pages_dir = dir_out.joinpath("path") |
194 | | - static_dir = dir_out.joinpath("static") |
| 193 | + static_dir_in = script_root.joinpath("static") |
| 194 | + pages_dir_out = dir_out.joinpath("path") |
| 195 | + static_dir_out = dir_out.joinpath("static") |
195 | 196 | if not os.path.exists(dir_out): |
196 | 197 | os.makedirs(dir_out) |
197 | | - if not os.path.exists(pages_dir): |
198 | | - os.makedirs(pages_dir) |
199 | | - if not os.path.exists(static_dir): |
200 | | - os.makedirs(static_dir) |
201 | | - # Copy html static dir (css,js,etc) to output |
202 | | - distutils.dir_util.copy_tree(str(script_root.joinpath("static")), |
203 | | - str(static_dir)) |
| 198 | + if not os.path.exists(pages_dir_out): |
| 199 | + os.makedirs(pages_dir_out) |
| 200 | + if os.path.exists(static_dir_out): |
| 201 | + shutil.rmtree(static_dir_out) |
| 202 | + # Copy html static dir (css,js,etc) to output |
| 203 | + shutil.copytree(static_dir_in, static_dir_out) |
204 | 204 | index = requests.get(url_base) |
205 | 205 | index_html_path = dir_out.joinpath("index.html") |
206 | 206 | index_file = open(index_html_path, "w+") |
|
0 commit comments