Skip to content

Commit 31da996

Browse files
committed
install: allow space-separated packages too
This enables users to copy and paste a package list which they'd normally provide to their package manager, directly into the -I argument. Signed-off-by: Stephen Brennan <[email protected]>
1 parent b4c4541 commit 31da996

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

yo/api.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ def __str__(self) -> str:
194194

195195

196196
def flex_list(arg: t.Union[str, t.List[str]]) -> t.List[str]:
197+
splitter = re.compile(r"[,\s]+")
197198
if isinstance(arg, str):
198-
return arg.split(",")
199+
return splitter.split(arg)
199200
else:
200201
return arg
201202

yo/main.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ def add_args(self, parser: argparse.ArgumentParser) -> None:
18161816
default=[],
18171817
action="append",
18181818
help="Install packages after instance creation (may be specified "
1819-
"multiple times)",
1819+
"multiple times, or with space/comma separated values)",
18201820
)
18211821

18221822
def standardize_wait(self, tasks: bool) -> None:
@@ -1835,8 +1835,9 @@ def maybe_install_packages(
18351835
) -> None:
18361836
packages = []
18371837
packages.extend(profile.install)
1838+
splitter = re.compile(r"[,\s]+")
18381839
for pkgspec in self.args.install:
1839-
packages.extend(pkgspec.split(","))
1840+
packages.extend(splitter.split(pkgspec))
18401841
if packages:
18411842
args = " ".join(packages)
18421843
tasks.append(

0 commit comments

Comments
 (0)