X-Git-Url: http://git.scottworley.com/pinch/blobdiff_plain/d815b199fa1d94ba00cd415a1310e80abc57e3b9..e8bd4979a02d7bb9e8fb7d978fd0e986d7ee60d1:/pinch.py?ds=sidebyside diff --git a/pinch.py b/pinch.py index 125fa63..1959f45 100644 --- a/pinch.py +++ b/pinch.py @@ -618,6 +618,16 @@ def read_config_section( return SP(**remaining_fields), pin +def read_pinned_config_section( + section: str, conf: configparser.SectionProxy) -> Tuple[SearchPath, Pin]: + sp, pin = read_config_section(conf) + if pin is None: + raise Exception( + 'Cannot update unpinned channel "%s" (Run "pin" before "update")' % + section) + return sp, pin + + def read_config(filename: str) -> configparser.ConfigParser: config = configparser.ConfigParser() config.read_file(open(filename), filename) @@ -656,11 +666,7 @@ def updateCommand(args: argparse.Namespace) -> None: exprs: Dict[str, str] = {} config = read_config_files(args.channels_file) for section in config: - sp, pin = read_config_section(config[section]) - if pin is None: - raise Exception( - 'Cannot update unpinned channel "%s" (Run "pin" before "update")' % - section) + sp, pin = read_pinned_config_section(section, config[section]) if isinstance(sp, AliasSearchPath): continue tarball = sp.fetch(v, pin)