zrb 0.14.0__py3-none-any.whl → 0.14.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.
zrb/helper/cli.py CHANGED
@@ -46,12 +46,12 @@ def create_cli() -> click.Group:
46
46
  # Load zrb_init.py
47
47
  project_dir = os.getenv("ZRB_PROJECT_DIR", os.getcwd())
48
48
  project_script = os.path.join(project_dir, "zrb_init.py")
49
- load_module(script_path=project_script)
49
+ load_module(script_path=project_script, sys_path_index=0)
50
50
  # load from ZRB_INIT_SCRIPTS environment
51
- for init_script in init_scripts:
51
+ for index, init_script in enumerate(init_scripts):
52
52
  logger.info(colored(f"Load module from {init_script}", attrs=["dark"]))
53
53
  try:
54
- load_module(script_path=init_script)
54
+ load_module(script_path=init_script, sys_path_index=index + 1)
55
55
  except Exception:
56
56
  logger.error(
57
57
  colored(
@@ -13,11 +13,11 @@ pattern = re.compile("[^a-zA-Z0-9]")
13
13
 
14
14
  @lru_cache
15
15
  @typechecked
16
- def load_module(script_path: str):
16
+ def load_module(script_path: str, sys_path_index: int = 0):
17
17
  if not os.path.isfile(script_path):
18
18
  return
19
19
  script_dir_path = os.path.dirname(script_path)
20
- _append_dir_to_sys_path(script_dir_path)
20
+ _append_dir_to_sys_path(script_dir_path, sys_path_index)
21
21
  _append_dir_to_python_path(script_dir_path)
22
22
  _exec_script_as_module(script_path)
23
23
 
@@ -33,8 +33,10 @@ def _exec_script_as_module(script_path: str):
33
33
  logger.info(colored(f"Module executed: {script_path}", attrs=["dark"]))
34
34
 
35
35
 
36
- def _append_dir_to_sys_path(dir_path: str):
37
- sys.path.append(dir_path)
36
+ def _append_dir_to_sys_path(dir_path: str, index: int):
37
+ if dir_path in sys.path:
38
+ return
39
+ sys.path.insert(index, dir_path)
38
40
  logger.info(colored(f"Set sys.path to {sys.path}", attrs=["dark"]))
39
41
 
40
42
 
@@ -48,4 +50,6 @@ def _get_new_python_path(dir_path: str) -> str:
48
50
  current_python_path = os.getenv("PYTHONPATH")
49
51
  if current_python_path is None or current_python_path == "":
50
52
  return dir_path
53
+ if dir_path in current_python_path.split(":"):
54
+ return current_python_path
51
55
  return ":".join([current_python_path, dir_path])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 0.14.0
3
+ Version: 0.14.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
@@ -1302,7 +1302,7 @@ zrb/helper/accessories/icon.py,sha256=G35OlUlVh0su-ch61cZzP6U9VQvTjjeH64vmGxKiMV
1302
1302
  zrb/helper/accessories/name.py,sha256=An2nsmLHKRuL5HjqXUpj9Wy9ozjhh0GyHM6PlTruKK8,1477
1303
1303
  zrb/helper/advertisement.py,sha256=AvjjkKjKpNnepu1IZ-qnYLr__fHIu5g1Tj3zJnjuCMY,787
1304
1304
  zrb/helper/callable.py,sha256=2s2ra1iekRP5QZc2IVqAi6sQHnWb8Hnqy8FwDgfDaFQ,231
1305
- zrb/helper/cli.py,sha256=AEIrt8urzpZaWWLiubffw2JU0rfGOogCrU65En8kMKA,2050
1305
+ zrb/helper/cli.py,sha256=4qDGdx8qT1WlgSV1_YtKvE_9LH0A0YLwTjykam-K-T8,2112
1306
1306
  zrb/helper/codemod/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1307
1307
  zrb/helper/codemod/add_argument_to_function.py,sha256=KrXOYXrhaFuKCZt4cwN_epjX4qd-L0d0ZNKlhLDF-t0,1252
1308
1308
  zrb/helper/codemod/add_argument_to_function_call.py,sha256=MclDAFBeG4idUfVWtxOFDZmqHdM1HAJNA-tTP56jahs,998
@@ -1327,7 +1327,7 @@ zrb/helper/file/text.py,sha256=ylyDwacsMv9cce0N7SsAMhAgwGOuaPKXl5vxUsBIGXc,809
1327
1327
  zrb/helper/git/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1328
1328
  zrb/helper/git/detect_changes.py,sha256=CwL_GIfINAouNj95hXVJ-JqFtWu7Ha8lhPJj-qkJLXc,1150
1329
1329
  zrb/helper/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1330
- zrb/helper/loader/load_module.py,sha256=BpZc0MHmqoGazjhhsdV4N578qcv6ZF1ZWlME7_FUakI,1728
1330
+ zrb/helper/loader/load_module.py,sha256=qyzG2oHSEfzL0LgB3wBfH4k4xi22I4mdcGWsWl5g4uM,1918
1331
1331
  zrb/helper/log.py,sha256=_5wYGO-hKeJhebD7rj_7tkmY0xmONbwKnMB-a3iOI_o,517
1332
1332
  zrb/helper/map/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1333
1333
  zrb/helper/map/conversion.py,sha256=4oz_JJNygnR_pq4KZKrHpG0PNd7v2axbrgAzGvC-A30,444
@@ -1398,8 +1398,8 @@ zrb/task_input/int_input.py,sha256=NVXAToqgdmWVwDqnr3XGuvq_QMNvUiIdD-pW5L4uebk,4
1398
1398
  zrb/task_input/password_input.py,sha256=5sS3XP7WtGow7r7Fid8J9SX0iNCidO6Bg7q40UpZDM0,4029
1399
1399
  zrb/task_input/str_input.py,sha256=D2WBeB-CdmAuOSzT7jTXvie7X3EK_m_Oq8_SVwmNpWA,4042
1400
1400
  zrb/task_input/task_input.py,sha256=L-U5dX-I2U5ci7GU226Q8pXcQe5SpGuOl5viFwlfiM0,2022
1401
- zrb-0.14.0.dist-info/LICENSE,sha256=WfnGCl8G60EYOPAEkuc8C9m9pdXWDe08NsKj3TBbxsM,728
1402
- zrb-0.14.0.dist-info/METADATA,sha256=P4oQWcQeuQmjY0wh0mKqBP0WhjVja9W-MFgGL2XqQ8Q,16460
1403
- zrb-0.14.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
1404
- zrb-0.14.0.dist-info/entry_points.txt,sha256=xTgXc1kBKYhJHEujdaSPHUcJT3-hbyP1mLgwkv-5sSk,40
1405
- zrb-0.14.0.dist-info/RECORD,,
1401
+ zrb-0.14.1.dist-info/LICENSE,sha256=WfnGCl8G60EYOPAEkuc8C9m9pdXWDe08NsKj3TBbxsM,728
1402
+ zrb-0.14.1.dist-info/METADATA,sha256=zj-IJGtw1CkPysw7x4aQ3lw5wtaXmskOHD13Vg61MPQ,16460
1403
+ zrb-0.14.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
1404
+ zrb-0.14.1.dist-info/entry_points.txt,sha256=xTgXc1kBKYhJHEujdaSPHUcJT3-hbyP1mLgwkv-5sSk,40
1405
+ zrb-0.14.1.dist-info/RECORD,,
File without changes
File without changes