Exemplo n.º 1
0
Arquivo: index.py Projeto: t-8ch/devpi
def parse_keyvalue_spec_index(hub, keyvalues):
    try:
        kvdict = parse_keyvalue_spec(keyvalues)
    except ValueError:
        hub.fatal("arguments must be format NAME=VALUE: %r" % (keyvalues, ))
    for key in ("acl_upload", "bases", "pypi_whitelist"):
        if key in kvdict:
            kvdict[key] = [x for x in kvdict[key].split(",") if x]
    return kvdict
Exemplo n.º 2
0
def parse_keyvalue_spec_index(hub, keyvalues):
    try:
        kvdict = parse_keyvalue_spec(keyvalues)
    except ValueError:
        hub.fatal("arguments must be format NAME=VALUE: %r" %( keyvalues,))
    if "acl_upload" in kvdict:
        kvdict["acl_upload"] = kvdict["acl_upload"].split(",")
    if "bases" in kvdict:
        kvdict["bases"] = [x for x in kvdict["bases"].split(",") if x]
    return kvdict
Exemplo n.º 3
0
def parse_keyvalue_spec_index(hub, keyvalues):
    try:
        kvdict = parse_keyvalue_spec(keyvalues)
    except ValueError:
        hub.fatal("arguments must be format NAME=VALUE: %r" % (keyvalues, ))
    if "acl_upload" in kvdict:
        kvdict["acl_upload"] = kvdict["acl_upload"].split(",")
    if "bases" in kvdict:
        kvdict["bases"] = [x for x in kvdict["bases"].split(",") if x]
    return kvdict
Exemplo n.º 4
0
def parse_keyvalue_spec_index(hub, keyvalues):
    try:
        kvdict = parse_keyvalue_spec(keyvalues)
    except ValueError:
        hub.fatal("arguments must be format NAME=VALUE: %r" %( keyvalues,))
    # XXX devpi-server 3.0.0 handles the splitting on it's own, this is for
    # compatibility with older devpi-server
    for key in ("acl_upload", "bases", "pypi_whitelist"):
        if key in kvdict:
            kvdict[key] = [x for x in kvdict[key].split(",") if x]
    return kvdict
Exemplo n.º 5
0
Arquivo: user.py Projeto: t-8ch/devpi
def main(hub, args):
    username = args.username
    if not args.list and not username:
        hub.fatal("need to specify a username")
    kvdict = parse_keyvalue_spec(args.keyvalues)
    if args.create:
        return user_create(hub, username, kvdict)
    elif args.delete:
        return user_delete(hub, username)
    elif args.modify:
        return user_modify(hub, username, kvdict)
    elif args.list:
        return user_list(hub)
    else:
        hub.fatal("need to specify -c|-d|-m|-l")
Exemplo n.º 6
0
Arquivo: user.py Projeto: t-8ch/devpi
def main(hub, args):
    username = args.username
    if not args.list and not username:
        hub.fatal("need to specify a username")
    kvdict = parse_keyvalue_spec(args.keyvalues)
    if args.create:
        return user_create(hub, username, kvdict)
    elif args.delete:
        return user_delete(hub, username)
    elif args.modify:
        return user_modify(hub, username, kvdict)
    elif args.list:
        return user_list(hub)
    else:
        hub.fatal("need to specify -c|-d|-m|-l")
Exemplo n.º 7
0
def test_parse_keyvalue_spec_unknown_key():
    pytest.raises(KeyError, lambda: parse_keyvalue_spec(["hello=3"], ["some"]))
Exemplo n.º 8
0
def test_parse_keyvalue_spec(input, expected):
    result = parse_keyvalue_spec(input, "hello world".split())
    assert result == expected