kkpyutil 1.49.3__py3-none-any.whl → 1.50.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kkpyutil
3
- Version: 1.49.3
3
+ Version: 1.50.0
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=pfq97OSJnXhrMpCB8rl1RYkhGH-Lo5dBLhWBHVduZQI,122288
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.50.0.dist-info/LICENSE,sha256=uISevGnCxB5QOU0ftbofN75_yUtd6E2h_MWE1zqagC8,1065
5
+ kkpyutil-1.50.0.dist-info/METADATA,sha256=-3bgtnAYNhCkf2swRJUh4lDfSWl-oM-CFz2yG1IdCWY,1136
6
+ kkpyutil-1.50.0.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
7
+ kkpyutil-1.50.0.dist-info/RECORD,,
kkpyutil.py CHANGED
@@ -2079,7 +2079,7 @@ 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, logger=glogger, sudo=False):
2082
+ def sync_dirs(src_root, dst_root, logger=glogger, sudo=False, excludes=()):
2083
2083
  """
2084
2084
  - assume src and dst folders are the same level of folder tree
2085
2085
  - the result will be dst_root mirrors src_root
@@ -2110,18 +2110,18 @@ def sync_dirs(src_root, dst_root, logger=glogger, sudo=False):
2110
2110
  return False
2111
2111
  if not sudo:
2112
2112
  # Iterate through the items inside the source directory
2113
- for item in os.listdir(src_root):
2114
- src_path = os.path.join(src_root, item)
2115
- dst_path = os.path.join(dst_root, item)
2113
+ for subpath in os.listdir(src_root):
2114
+ src_path = os.path.join(src_root, subpath)
2115
+ dst_path = os.path.join(dst_root, subpath)
2116
2116
  if os.path.isdir(src_path):
2117
2117
  # copytree with dirs_exist_ok=True will overwrite existing files
2118
2118
  # and merge directories without warning.
2119
- shutil.copytree(src_path, dst_path, dirs_exist_ok=True)
2120
- logger.info(f"Copied directory: {item}")
2119
+ shutil.copytree(src_path, dst_path, dirs_exist_ok=True, ignore=shutil.ignore_patterns(*excludes) if excludes else None)
2120
+ logger.info(f"Merged directory: {src_path} -> {dst_path}")
2121
2121
  else:
2122
2122
  # For individual files at the root of my_src_dir
2123
2123
  shutil.copy2(src_path, dst_path)
2124
- logger.info(f"Copied file: {item}")
2124
+ logger.info(f"Copied file: {src_path} -> {dst_path}")
2125
2125
  return True
2126
2126
  # on macOS, merge to system folders
2127
2127
  # Identify the original user (the one who called sudo)
@@ -1,7 +0,0 @@
1
- kkpyutil.py,sha256=fb_l_-BM7p6jqbRu3xjsIrH9GEPGLZnVsPcth2NOR54,122166
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.49.3.dist-info/LICENSE,sha256=uISevGnCxB5QOU0ftbofN75_yUtd6E2h_MWE1zqagC8,1065
5
- kkpyutil-1.49.3.dist-info/METADATA,sha256=kP4vxShQcdW4Am6qeCTMt_ZfVEJkSG5tRP2zHLrM1z4,1136
6
- kkpyutil-1.49.3.dist-info/WHEEL,sha256=kLuE8m1WYU0Ig0_YEGrXyTtiJvKPpLpDEiChiNyei5Y,88
7
- kkpyutil-1.49.3.dist-info/RECORD,,