def _run(exiter): # Place the registration of the unhandled exception hook as early as possible in the code. sys.excepthook = exiter.unhandled_exception_hook # We want to present warnings to the user, set this up early to ensure all warnings are seen. # The "default" action displays a warning for a particular file and line number exactly once. # See https://docs.python.org/2/library/warnings.html#the-warnings-filter for the complete action # list. warnings.simplefilter("default") # The GoalRunner will setup final logging below in `.setup()`, but span the gap until then. logging.basicConfig(level=logging.INFO) # This routes the warnings we enabled above through our loggers instead of straight to stderr raw. logging.captureWarnings(True) root_dir = get_buildroot() if not os.path.exists(root_dir): exiter.exit_and_fail( 'PANTS_BUILD_ROOT does not point to a valid path: {}'.format( root_dir)) options_bootstrapper = OptionsBootstrapper() plugin_resolver = PluginResolver(options_bootstrapper) working_set = plugin_resolver.resolve() goal_runner = GoalRunner(root_dir) goal_runner.setup(options_bootstrapper, working_set) exiter.apply_options(goal_runner.options) result = goal_runner.run() exiter.do_exit(result)
def _run(exiter): # Place the registration of the unhandled exception hook as early as possible in the code. sys.excepthook = exiter.unhandled_exception_hook # We want to present warnings to the user, set this up early to ensure all warnings are seen. # The "default" action displays a warning for a particular file and line number exactly once. # See https://docs.python.org/2/library/warnings.html#the-warnings-filter for the complete action # list. warnings.simplefilter("default") # The GoalRunner will setup final logging below in `.setup()`, but span the gap until then. logging.basicConfig() # This routes the warnings we enabled above through our loggers instead of straight to stderr raw. logging.captureWarnings(True) version = pants_version() if len(sys.argv) == 2 and sys.argv[1] == _VERSION_OPTION: exiter.do_exit(msg=version, out=sys.stdout) root_dir = get_buildroot() if not os.path.exists(root_dir): exiter.exit_and_fail('PANTS_BUILD_ROOT does not point to a valid path: %s' % root_dir) goal_runner = GoalRunner(root_dir) goal_runner.setup() result = goal_runner.run() exiter.do_exit(result)
def _run(exiter): # Place the registration of the unhandled exception hook as early as possible in the code. sys.excepthook = exiter.unhandled_exception_hook logging.basicConfig() version = pants_version() if len(sys.argv) == 2 and sys.argv[1] == _VERSION_OPTION: exiter.do_exit(msg=version, out=sys.stdout) root_dir = get_buildroot() if not os.path.exists(root_dir): exiter.exit_and_fail('PANTS_BUILD_ROOT does not point to a valid path: %s' % root_dir) goal_runner = GoalRunner(root_dir) goal_runner.setup() result = goal_runner.run() exiter.do_exit(result)
def _run(): # Place the registration of the unhandled exception hook as early as possible in the code. sys.excepthook = _unhandled_exception_hook logging.basicConfig() version = pants_version() if len(sys.argv) == 2 and sys.argv[1] == _VERSION_OPTION: _do_exit(msg=version, out=sys.stdout) root_dir = get_buildroot() if not os.path.exists(root_dir): _exit_and_fail('PANTS_BUILD_ROOT does not point to a valid path: %s' % root_dir) goal_runner = GoalRunner(root_dir) goal_runner.setup() result = goal_runner.run() _do_exit(result)