def _run(cmd, options): from epydoc.markup import wordwrap if '|' in cmd: name = cmd.split('|')[1].strip().split(' ', 1)[0] else: name = cmd.strip().split(' ', 1)[0] if options['verbosity'] == 1: print >>sys.stderr, 'Running %s...' % name elif options['verbosity'] > 1: cmd_str = wordwrap(`cmd`, 10+len(name)).lstrip() print >>sys.stderr, 'Running %s' % cmd_str.rstrip() exitcode = os.system(cmd) if exitcode != 0: raise OSError('%s failed: exitcode=%s' % (name, exitcode))
def _usage_error(estr, exit_code=1): """ Issue an error message, and exit. """ #progname = os.path.basename(sys.argv[0]) progname = 'epydoc' if '\n' in estr: estr = '\n%s\nRun "%s -h" for usage.\n' % (estr.strip(), progname) else: estr = '%s; run "%s -h" for usage.' % (estr.strip(), progname) from epydoc.markup import wordwrap estr = '\n'+wordwrap(estr) print >>sys.stderr, estr sys.exit(exit_code)