def main(argv=None):
    if argv is None:
        argv = sys.argv
    sys.stdout = util.FileIgnoreEpipe(sys.stdout)
    try:
        argv = list(argv)
        debugAll = '--debug-all' in argv
        if debugAll:
            debuggerException = Exception
            argv.remove('--debug-all')
        else:
            debuggerException = errors.InternalConaryError

        cvcMain = CvcMain()
        ccfg = cvcMain.getConfigFile(argv)
        if debugAll:
            ccfg.debugExceptions = True
            ccfg.debugRecipeExceptions = True

        # reset the excepthook (using cfg values for exception settings)
        sys.excepthook = util.genExcepthook(debug=ccfg.debugExceptions,
                                            debugCtrlC=debugAll)
        return cvcMain.main(argv, debuggerException, debugAll=debugAll,
                            cfg=ccfg)
    except debuggerException:
        raise
    except (errors.ConaryError, errors.CvcError, cfg.CfgError,
            openpgpfile.PGPError), e:
        if str(e):
            log.error(str(e))
            sys.exit(2)
        else:
            raise
    except KeyboardInterrupt, e:
        pass
    return 1
dataset/ETHPy150Open sassoftware/conary/conary/cmds/cvccmd.py/main/original