kkpyutil 1.46.3__py3-none-any.whl → 1.47.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kkpyutil-1.46.3.dist-info → kkpyutil-1.47.0.dist-info}/METADATA +1 -1
- kkpyutil-1.47.0.dist-info/RECORD +7 -0
- kkpyutil.py +24 -1
- kkpyutil-1.46.3.dist-info/RECORD +0 -7
- {kkpyutil-1.46.3.dist-info → kkpyutil-1.47.0.dist-info}/LICENSE +0 -0
- {kkpyutil-1.46.3.dist-info → kkpyutil-1.47.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
kkpyutil.py,sha256=pCKGYZYsZqeEL24S72XlbMMgUxd4CC2oU8D4OHfUIOU,118774
|
|
2
|
+
kkpyutil_helper/windows/kkttssave.ps1,sha256=xa3-WzqNh2rGYlOx_I4ewOuCE94gkTO5cEwYH0M67_0,446
|
|
3
|
+
kkpyutil_helper/windows/kkttsspeak.ps1,sha256=7WUUHMmjTQroUWA2Mvdt4JtSt475nZUHQx-qP-7rS6o,305
|
|
4
|
+
kkpyutil-1.47.0.dist-info/LICENSE,sha256=uISevGnCxB5QOU0ftbofN75_yUtd6E2h_MWE1zqagC8,1065
|
|
5
|
+
kkpyutil-1.47.0.dist-info/METADATA,sha256=P0VzS19-22ZtTx20Om97sT9y7OW7H873F3R-Qfm83VQ,1136
|
|
6
|
+
kkpyutil-1.47.0.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
|
|
7
|
+
kkpyutil-1.47.0.dist-info/RECORD,,
|
kkpyutil.py
CHANGED
|
@@ -2079,6 +2079,27 @@ def move_file(src, dst, isdstdir=False):
|
|
|
2079
2079
|
return dst if not isdstdir else osp.join(dst, osp.basename(src))
|
|
2080
2080
|
|
|
2081
2081
|
|
|
2082
|
+
def sync_dirs(src_root, dst_root):
|
|
2083
|
+
# Ensure the source directory exists
|
|
2084
|
+
if not os.path.exists(src_root):
|
|
2085
|
+
glogger.error(f"Error: Source directory {src_root} does not exist.")
|
|
2086
|
+
return False
|
|
2087
|
+
# Iterate through the items inside the source directory
|
|
2088
|
+
for item in os.listdir(src_root):
|
|
2089
|
+
src_path = os.path.join(src_root, item)
|
|
2090
|
+
dst_path = os.path.join(dst_root, item)
|
|
2091
|
+
if os.path.isdir(src_path):
|
|
2092
|
+
# copytree with dirs_exist_ok=True will overwrite existing files
|
|
2093
|
+
# and merge directories without warning.
|
|
2094
|
+
shutil.copytree(src_path, dst_path, dirs_exist_ok=True)
|
|
2095
|
+
glogger.info(f"Copied directory: {item}")
|
|
2096
|
+
else:
|
|
2097
|
+
# For individual files at the root of my_src_dir
|
|
2098
|
+
shutil.copy2(src_path, dst_path)
|
|
2099
|
+
glogger.info(f"Copied file: {item}")
|
|
2100
|
+
return True
|
|
2101
|
+
|
|
2102
|
+
|
|
2082
2103
|
def compare_dirs(dir1, dir2, ignoreddirpatterns=(), ignoredfilepatterns=(), showdiff=True):
|
|
2083
2104
|
"""
|
|
2084
2105
|
- filecmp.dircmp() supports explicit name ignores only
|
|
@@ -2974,8 +2995,10 @@ def lazy_download(local_file, url, file_open_mode='wb', logger=None):
|
|
|
2974
2995
|
return local_file
|
|
2975
2996
|
os.makedirs(osp.dirname(local_file), exist_ok=True)
|
|
2976
2997
|
logger = logger or glogger
|
|
2998
|
+
# Add User-Agent header to avoid 403 errors from websites that block bots
|
|
2999
|
+
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
|
|
2977
3000
|
with open(local_file, file_open_mode) as fp:
|
|
2978
|
-
with urllib.request.urlopen(
|
|
3001
|
+
with urllib.request.urlopen(req) as response:
|
|
2979
3002
|
logger.info(f'Downloading: {url} => {local_file}')
|
|
2980
3003
|
fp.write(response.read())
|
|
2981
3004
|
return local_file
|
kkpyutil-1.46.3.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
kkpyutil.py,sha256=h2KKvUcZTM74pjkL2KvvyMV_CXcDge_ja7q9sw_h-wE,117739
|
|
2
|
-
kkpyutil_helper/windows/kkttssave.ps1,sha256=xa3-WzqNh2rGYlOx_I4ewOuCE94gkTO5cEwYH0M67_0,446
|
|
3
|
-
kkpyutil_helper/windows/kkttsspeak.ps1,sha256=7WUUHMmjTQroUWA2Mvdt4JtSt475nZUHQx-qP-7rS6o,305
|
|
4
|
-
kkpyutil-1.46.3.dist-info/LICENSE,sha256=uISevGnCxB5QOU0ftbofN75_yUtd6E2h_MWE1zqagC8,1065
|
|
5
|
-
kkpyutil-1.46.3.dist-info/METADATA,sha256=TXUYS0Ku1IivEFnou6JYbPhV-zCdFc6tatzDLqiwlfE,1136
|
|
6
|
-
kkpyutil-1.46.3.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
|
|
7
|
-
kkpyutil-1.46.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|