Add list to dict in do_install
This commit is contained in:
parent
426f602a99
commit
7f04bd92d1
1 changed files with 3 additions and 4 deletions
|
@ -7,7 +7,7 @@ Shamelessly copied from https://github.com/dmerejkowsky/dotfiles.
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import subprocess
|
import subprocess
|
||||||
from typing import List, Optional
|
from typing import Dict, List, Optional, Tuple
|
||||||
from urllib.request import urlretrieve
|
from urllib.request import urlretrieve
|
||||||
|
|
||||||
import cli_ui as ui # type: ignore
|
import cli_ui as ui # type: ignore
|
||||||
|
@ -108,14 +108,13 @@ class Installer:
|
||||||
def do_install(self, *packages, **os_specific_packages) -> None:
|
def do_install(self, *packages, **os_specific_packages) -> None:
|
||||||
"""Install packages with OS-specific package manager.
|
"""Install packages with OS-specific package manager.
|
||||||
|
|
||||||
Packages can either be in a list for non OS-specific packages, or in a
|
Packages can either be in a tuple for non OS-specific packages, or in a
|
||||||
dict for OS-specific packages.
|
dict for OS-specific packages.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not packages: # we got the dict, make a list out of it
|
if not packages: # we got the dict, make a list out of it
|
||||||
try:
|
try:
|
||||||
packages = os_specific_packages[self.operating_system].split()\
|
packages = os_specific_packages[self.operating_system] + os_specific_packages["both"]
|
||||||
+ os_specific_packages["both"].split()
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
ui.fatal("Operating System not understood.")
|
ui.fatal("Operating System not understood.")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Reference in a new issue