def _main(popts): register_commands() if popts["show_version"]: print bento.__version__ return 0 if popts["show_full_version"]: print bento.__version__ + "git" + bento.__git_revision__ return 0 if popts["show_usage"]: cmd = get_command('help')() cmd.run(Context(cmd, [], None, None)) return 0 cmd_name = popts["cmd_name"] cmd_opts = popts["cmd_opts"] if not cmd_name: print "Type '%s help' for usage." % SCRIPT_NAME return 1 else: if not cmd_name in get_command_names(): raise UsageException("%s: Error: unknown command %s" % (SCRIPT_NAME, cmd_name)) else: check_command_dependencies(cmd_name) run_cmd(cmd_name, cmd_opts)
def run(self, ctx): pprint('BLUE', "Distcheck...") bentomaker_script = os.path.abspath(sys.argv[0]) if sys.platform == "win32": bentomaker_script = [sys.executable, bentomaker_script] else: bentomaker_script = [bentomaker_script] pprint('PINK', "\t-> Running sdist...") sdist = get_command("sdist")() sdist.run(ctx) tarname = sdist.tarname tardir = sdist.topdir saved = os.getcwd() if os.path.exists(DISTCHECK_DIR): shutil.rmtree(DISTCHECK_DIR) os.makedirs(DISTCHECK_DIR) target = os.path.join(DISTCHECK_DIR, os.path.basename(tarname)) rename(tarname, target) tarname = os.path.basename(target) os.chdir(DISTCHECK_DIR) try: pprint('PINK', "\t-> Extracting sdist...") tarball = tarfile.TarFile.gzopen(tarname) tarball.extractall() os.chdir(tardir) pprint('PINK', "\t-> Configuring from sdist...") check_call(bentomaker_script + ["configure", "--prefix=%s" % os.path.abspath("tmp")]) pprint('PINK', "\t-> Building from sdist...") check_call(bentomaker_script + ["build", "-i"]) pprint('PINK', "\t-> Building egg from sdist...") check_call(bentomaker_script + ["build_egg"]) if sys.platform == "win32": pprint('PINK', "\t-> Building wininst from sdist...") check_call(bentomaker_script + ["build_wininst"]) if "test" in get_command_names(): pprint('PINK', "\t-> Testing from sdist...") try: check_call(bentomaker_script + ["test"]) except CalledProcessError, e: raise CommandExecutionFailure( "test command failed") else: