1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
diff --git a/meta_package_manager/base.py b/meta_package_manager/base.py
index 470bf8d7..0c981dcf 100644
--- a/meta_package_manager/base.py
+++ b/meta_package_manager/base.py
@@ -36,15 +36,15 @@ from boltons.strutils import strip_ansi
from click_extra.colorize import default_theme as theme
from click_extra.testing import (
INDENT,
- Arg,
- EnvVars,
- NestedArgs,
+ TArg,
+ TEnvVars,
+ TNestedArgs,
args_cleanup,
- env_copy,
format_cli_prompt,
)
+from click_extra.envvar import env_copy
from extra_platforms import UNIX, Group, current_os
-from extra_platforms.group import _TNestedSources
+from extra_platforms import _TNestedReferences
from packageurl import PackageURL
from .version import TokenizedString, parse_version
@@ -299,7 +299,7 @@ class PackageManager(metaclass=MetaPackageManager):
platforms.
"""
- extra_env: EnvVars | None = None
+ extra_env: TEnvVars | None = None
"""Additional environment variables to add to the current context.
Automatically applied on each
@@ -633,7 +633,7 @@ class PackageManager(metaclass=MetaPackageManager):
)
return bool(self.supported and self.cli_path and self.executable and self.fresh)
- def run(self, *args: Arg | NestedArgs, extra_env: EnvVars | None = None) -> str:
+ def run(self, *args: TArg | TNestedArgs, extra_env: TEnvVars | None = None) -> str:
"""Run a shell command, return the output and accumulate error messages.
``args`` is allowed to be a nested structure of iterables, in which case it will
@@ -699,14 +699,14 @@ class PackageManager(metaclass=MetaPackageManager):
def build_cli(
self,
- *args: Arg | NestedArgs,
+ *args: TArg | TNestedArgs,
auto_pre_cmds: bool = True,
auto_pre_args: bool = True,
auto_post_args: bool = True,
- override_pre_cmds: NestedArgs | None = None,
+ override_pre_cmds: TNestedArgs | None = None,
override_cli_path: Path | None = None,
- override_pre_args: NestedArgs | None = None,
- override_post_args: NestedArgs | None = None,
+ override_pre_args: TNestedArgs | None = None,
+ override_post_args: TNestedArgs | None = None,
sudo: bool = False,
) -> tuple[str, ...]:
"""Build the package manager CLI by combining the custom ``*args`` with the
@@ -754,7 +754,7 @@ class PackageManager(metaclass=MetaPackageManager):
``override_pre_cmds`` parameter is not allowed to be set and the
``auto_pre_cmds`` parameter is forced to ``False``.
"""
- params: list[Arg | NestedArgs] = []
+ params: list[TArg | TNestedArgs] = []
# Sudo replaces any pre-command, be it overridden or automatic.
if sudo:
@@ -794,16 +794,16 @@ class PackageManager(metaclass=MetaPackageManager):
def run_cli(
self,
- *args: Arg | NestedArgs,
+ *args: TArg | TNestedArgs,
auto_extra_env: bool = True,
auto_pre_cmds: bool = True,
auto_pre_args: bool = True,
auto_post_args: bool = True,
- override_extra_env: EnvVars | None = None,
- override_pre_cmds: NestedArgs | None = None,
+ override_extra_env: TEnvVars | None = None,
+ override_pre_cmds: TNestedArgs | None = None,
override_cli_path: Path | None = None,
- override_pre_args: NestedArgs | None = None,
- override_post_args: NestedArgs | None = None,
+ override_pre_args: TNestedArgs | None = None,
+ override_post_args: TNestedArgs | None = None,
force_exec: bool = False,
sudo: bool = False,
) -> str:
diff --git a/meta_package_manager/managers/npm.py b/meta_package_manager/managers/npm.py
index cb9a76bc..c5b4f70f 100644
--- a/meta_package_manager/managers/npm.py
+++ b/meta_package_manager/managers/npm.py
@@ -21,7 +21,7 @@ from typing import Any, Iterator
from extra_platforms import ALL_PLATFORMS
-from meta_package_manager.base import Arg, NestedArgs, Package, PackageManager
+from meta_package_manager.base import TArg, TNestedArgs, Package, PackageManager
from meta_package_manager.capabilities import (
search_capabilities,
version_not_implemented,
@@ -59,7 +59,7 @@ class NPM(PackageManager):
6.13.7
"""
- def run_cli(self, *args: Arg | NestedArgs, **kwargs: Any) -> str:
+ def run_cli(self, *args: TArg | TNestedArgs, **kwargs: Any) -> str:
"""Like the common run_cli helper, but silence NPM's JSON output on error.
NPM is prone to breakage if local node version is not in sync:
|