def binary_goal(args): """Create a binary using pants.""" targets = lib.targets(lib.rel_cwd(), args) pants_args = "binary {0}".format(targets) lib.pants(pants_args)
def run_goal(goal, args): """Run a target using pants.""" targets = lib.targets(lib.rel_cwd(), [goal]) run_args = " ".join(args) pants_args = "run {0} {1}".format(targets, run_args) lib.pants(pants_args)
def test_goal(args, options): """Use test.pytest goal with pants.""" if options.all: targets = "%s::" % lib.rel_cwd().replace('src', 'tests') else: targets = lib.targets(lib.rel_cwd(), args) pants_args = "test.pytest {0} {1} {2}".format( "--coverage=%d" % int(options.coverage), "--test-pytest-options='%s'" % lib.pytest_options(options), targets, ) lib.pants(pants_args)
def clean_goal(): """Clean pants.""" lib.pants("clean-all")
def repl_goal(args): """Enter an ipython REPL.""" targets = lib.targets(lib.rel_cwd(), args) pants_args = "repl --repl-py-ipython {0}".format(targets) lib.pants(pants_args)
def fmt_goal(args): """Fix common format issues using pants fmt goal.""" targets = lib.targets(lib.rel_cwd(), args) pants_args = "fmt {0}".format(targets) lib.pants(pants_args)