From ff8370dc4d0d57f24b7b68bbe582d2dbbf76eda6 Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Fri, 28 Dec 2012 21:59:21 +0000 Subject: Add a run_build function to main This avoids duplication and circular deps --- (limited to 'commands') diff --git a/commands/build b/commands/build index 9d8b51b..aa313b4 100755 --- a/commands/build +++ b/commands/build @@ -5,8 +5,7 @@ import sys import common -from devbot import build -from devbot import system +from devbot import main parser = argparse.ArgumentParser() parser.add_argument("module", nargs="?", help="name of the module to build") @@ -19,11 +18,5 @@ if args.module: if not build.build_one(args.module): sys.exit(1) else: - if not system.check(lazy=True): - sys.exit(1) - - if not build.pull(lazy=True): - sys.exit(1) - - if not build.build(full=args.full): + if not main.run_build(full=args.full): sys.exit(1) diff --git a/commands/check b/commands/check index 66e1ed5..5c29599 100755 --- a/commands/check +++ b/commands/check @@ -10,8 +10,7 @@ import common from devbot import run from devbot import check from devbot import command -from devbot import system -from devbot import build +from devbot import main def _get_profile(): profile_path = os.path.expanduser("~/.sugar/uitests") @@ -95,8 +94,15 @@ def _check_ui(): return result -def _check_modules(): - return check.check() +def _run_checks(): + if not _check_devbot(): + return False + + if not _check_modules(): + return False + + if not check.check(): + sys.exit(1) parser = argparse.ArgumentParser() @@ -113,20 +119,8 @@ if args.module: if not check.check_one(args.module): sys.exit(1) else: - if not system.check(lazy=True): - sys.exit(1) - - if not build.pull(lazy=True): - sys.exit(1) - - if not build.build(): - sys.exit(1) - - if not _check_devbot(): - sys.exit(1) - - if not _check_modules(): + if not main.run_build(full=False): sys.exit(1) - if not _check_ui(): + if not _run_checks(): sys.exit(1) diff --git a/commands/run b/commands/run index e3f311a..ef8e9af 100755 --- a/commands/run +++ b/commands/run @@ -5,18 +5,11 @@ import sys import common from devbot import run -from devbot import build -from devbot import system +from devbot import main common.setup(log_name="run") -if not system.check(lazy=True): - sys.exit(1) - -if not build.pull(lazy=True): - sys.exit(1) - -if not build.build(): +if not main.run_build(): sys.exit(1) run.run("sugar-runner") -- cgit v0.9.1