zrb 0.23.0__py3-none-any.whl → 0.23.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.
@@ -26,6 +26,9 @@ async def copy_tree(
26
26
  excludes = []
27
27
  if skip_parsing is None:
28
28
  skip_parsing = []
29
+ if os.path.isfile(src):
30
+ await _copy_file(src, dst, replacements, excludes, skip_parsing)
31
+ return
29
32
  names = os.listdir(src)
30
33
  new_dst = parse_replacement(dst, replacements)
31
34
  if not os.path.exists(new_dst):
@@ -38,13 +41,26 @@ async def copy_tree(
38
41
  if os.path.isdir(src_name):
39
42
  await copy_tree(src_name, dst_name, replacements, excludes, skip_parsing)
40
43
  continue
41
- new_dst_name = parse_replacement(dst_name, replacements)
42
- shutil.copy2(src_name, new_dst_name)
43
- try:
44
- if any(fnmatch.fnmatch(new_dst_name, pattern) for pattern in skip_parsing):
45
- continue
46
- file_content = await read_text_file_async(new_dst_name)
47
- new_file_content = parse_replacement(file_content, replacements)
48
- await write_text_file_async(new_dst_name, new_file_content)
49
- except Exception:
50
- logger.error(f"Cannot parse file: {new_dst_name}")
44
+ await _copy_file(src_name, dst_name, replacements, excludes, skip_parsing)
45
+
46
+
47
+ async def _copy_file(
48
+ src: str,
49
+ dst: str,
50
+ replacements: Optional[Mapping[str, str]] = None,
51
+ excludes: Optional[Iterable[str]] = None,
52
+ skip_parsing: Optional[Iterable[str]] = None,
53
+ ):
54
+ if any(fnmatch.fnmatch(src, pattern) for pattern in excludes):
55
+ return
56
+ new_dst_name = parse_replacement(dst, replacements)
57
+ if any(fnmatch.fnmatch(new_dst_name, pattern) for pattern in skip_parsing):
58
+ return
59
+ if new_dst_name != src:
60
+ shutil.copy2(src, new_dst_name)
61
+ try:
62
+ file_content = await read_text_file_async(new_dst_name)
63
+ new_file_content = parse_replacement(file_content, replacements)
64
+ await write_text_file_async(new_dst_name, new_file_content)
65
+ except Exception:
66
+ logger.error(f"Cannot parse file: {new_dst_name}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 0.23.0
3
+ Version: 0.23.1
4
4
  Summary: A Framework to Enhance Your Workflow
5
5
  Home-page: https://github.com/state-alchemists/zrb
6
6
  License: AGPL-3.0-or-later
@@ -1322,7 +1322,7 @@ zrb/helper/docstring.py,sha256=kU3nZFYtCrrxNsLxmx2UofHav09VB5y0VeY_Blux6FQ,4970
1322
1322
  zrb/helper/env_map/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1323
1323
  zrb/helper/env_map/fetch.py,sha256=wzOO58LmhQsgFVsVrUhdGbQmu6igOE1x6SR2SbRnuTA,2335
1324
1324
  zrb/helper/file/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1325
- zrb/helper/file/copy_tree.py,sha256=Tuk4qej7ToZQqEmeiSADiFjWq7xyh-Nfzk1z2fjHZK0,1854
1325
+ zrb/helper/file/copy_tree.py,sha256=tOzM3VJXRTBprgZ-YNfTURlkxm5udFer9Yggtq3CXNU,2312
1326
1326
  zrb/helper/file/match.py,sha256=73uypJq5EnFAhA7kaNodW9vBLZ0MQVwZDh8CD3x52kw,721
1327
1327
  zrb/helper/file/text.py,sha256=7JqNbk8hC7Y4UopEmhiGYkxDAauepvI1tEkbfpzcI84,963
1328
1328
  zrb/helper/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1405,8 +1405,8 @@ zrb/task_input/multiline_input.py,sha256=kP2VQ4c42-d6P4RB3AA2eGTrFRLwvFlZxc7vGwj
1405
1405
  zrb/task_input/password_input.py,sha256=3xxWHKJCDGbyl_5MmyyB2t_yRjwFKpIIbS10aq73ktk,4370
1406
1406
  zrb/task_input/str_input.py,sha256=0BJP3SQ8y0TRYPrwEy5pYv4N7jq8KlmRSVwByIFqIvI,4360
1407
1407
  zrb/task_input/task_input.py,sha256=WTj_qIQyRs-04-VotjNTcVyIuf6b2afInVoCQHoRmr0,2327
1408
- zrb-0.23.0.dist-info/LICENSE,sha256=WfnGCl8G60EYOPAEkuc8C9m9pdXWDe08NsKj3TBbxsM,728
1409
- zrb-0.23.0.dist-info/METADATA,sha256=MCpxRvefJxpsQj0etnLNCX8NDT_TyBeZ4oWtDIEr2ZU,17076
1410
- zrb-0.23.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
1411
- zrb-0.23.0.dist-info/entry_points.txt,sha256=xTgXc1kBKYhJHEujdaSPHUcJT3-hbyP1mLgwkv-5sSk,40
1412
- zrb-0.23.0.dist-info/RECORD,,
1408
+ zrb-0.23.1.dist-info/LICENSE,sha256=WfnGCl8G60EYOPAEkuc8C9m9pdXWDe08NsKj3TBbxsM,728
1409
+ zrb-0.23.1.dist-info/METADATA,sha256=JrxkQFGJnggG-omBTS1mdwgTYa_1COlzVrNYZF5zh34,17076
1410
+ zrb-0.23.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
1411
+ zrb-0.23.1.dist-info/entry_points.txt,sha256=xTgXc1kBKYhJHEujdaSPHUcJT3-hbyP1mLgwkv-5sSk,40
1412
+ zrb-0.23.1.dist-info/RECORD,,
File without changes
File without changes