Example #1
0
        sys.stderr.write(str(msg) + "\nUse -h for help.\n")
        sys.exit(1)
    except:
        raise

    resources_filename = RESOURCESFILENAME
    if (not switches) and (not args):
        help.helpme(False)
        sys.exit(1)

    if ("-h" in switches) or ("--help" in switches):
        help.helpme(False)
        sys.exit(0)

    if ("-v" in switches) or ("--version" in switches):
        help.version(False)
        sys.exit(0)

    if "-o" in switches:
        rdfdir = optsdict["-o"]
    else:
        rdfdir = RDFDIR

    if "-L" in switches:
        link_list = []
        for (opt, optval) in opts:
            if opt == "-L":
                link_list.append(optval)
    else:
        link_list = []
Example #2
0
    # Setup the configuration and get the mode in which we are supposed to
    # run.
    try:
        mode, args, config = setup(argdict)
    except ex.setup_error, errmsg:
        sys.stderr.write('%s\n' % errmsg)
        sys.exit(2)
    except:
        raise

    # Check for the simpler modes that does not involve the upgrade module.
    if mode == 'help':
        help.helpme()
        sys.exit(0)
    elif mode == 'version':
        help.version()
        sys.exit(0)
    elif mode == 'copyright':
        help.copyright()
        sys.exit(0)
    elif mode == 'remove_lock':
        remove_lock(config)
        sys.exit(0)
    elif mode == 'import_key':
        if set_lock(config):
            try:
                import_key(args, config['gnupgdir'])
                remove_lock(config)
                sys.exit(0)
            except ex.import_key_error, errmsg:
                sys.stderr.write('%s\n' % errmsg)