kkpyutil 1.47.0__py3-none-any.whl → 1.47.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kkpyutil
3
- Version: 1.47.0
3
+ Version: 1.47.1
4
4
  Summary: Building blocks for sysadmin and DevOps
5
5
  Home-page: https://github.com/kakyoism/kkpyutil/
6
6
  License: MIT
@@ -0,0 +1,7 @@
1
+ kkpyutil.py,sha256=49PcKby8JHlsbkZ63LMqA5R7lzKQd5hRUfBJnjsK8OM,118921
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.1.dist-info/LICENSE,sha256=uISevGnCxB5QOU0ftbofN75_yUtd6E2h_MWE1zqagC8,1065
5
+ kkpyutil-1.47.1.dist-info/METADATA,sha256=8Xb7Imhz5_S0yvYfCY7hr4M8-XzMDpCjdQQvt-4wO1E,1136
6
+ kkpyutil-1.47.1.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
7
+ kkpyutil-1.47.1.dist-info/RECORD,,
kkpyutil.py CHANGED
@@ -2079,10 +2079,14 @@ 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):
2082
+ def sync_dirs(src_root, dst_root, logger=glogger):
2083
+ """
2084
+ - assume src and dst folders are the same level of folder tree
2085
+ - the result will be dst_root mirrors src_root
2086
+ """
2083
2087
  # Ensure the source directory exists
2084
2088
  if not os.path.exists(src_root):
2085
- glogger.error(f"Error: Source directory {src_root} does not exist.")
2089
+ logger.error(f"Error: Source directory {src_root} does not exist.")
2086
2090
  return False
2087
2091
  # Iterate through the items inside the source directory
2088
2092
  for item in os.listdir(src_root):
@@ -2092,11 +2096,11 @@ def sync_dirs(src_root, dst_root):
2092
2096
  # copytree with dirs_exist_ok=True will overwrite existing files
2093
2097
  # and merge directories without warning.
2094
2098
  shutil.copytree(src_path, dst_path, dirs_exist_ok=True)
2095
- glogger.info(f"Copied directory: {item}")
2099
+ logger.info(f"Copied directory: {item}")
2096
2100
  else:
2097
2101
  # For individual files at the root of my_src_dir
2098
2102
  shutil.copy2(src_path, dst_path)
2099
- glogger.info(f"Copied file: {item}")
2103
+ logger.info(f"Copied file: {item}")
2100
2104
  return True
2101
2105
 
2102
2106
 
@@ -1,7 +0,0 @@
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,,