__init__.py (1039B)
1 #!/usr/bin/env python 2 # 3 # This Source Code Form is subject to the terms of the Mozilla Public 4 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 import os 8 import sys 9 10 from mozfile import load_source 11 from mozlog import structuredlog 12 13 here = os.path.split(__file__)[0] 14 15 load_source( 16 "localpaths", os.path.join(here, os.pardir, "tests", "tools", "localpaths.py") 17 ) 18 19 from wptrunner.update import WPTUpdate, setup_logging 20 from wptrunner.update.base import exit_unclean 21 22 from . import updatecommandline 23 from .update import UpdateRunner 24 25 26 def run_update(logger, **kwargs): 27 updater = WPTUpdate(logger, runner_cls=UpdateRunner, **kwargs) 28 return updater.run() 29 30 31 if __name__ == "__main__": 32 args = updatecommandline.parse_args() 33 logger = setup_logging(args, {"mach": sys.stdout}) 34 assert structuredlog.get_default_logger() is not None 35 36 rv = run_update(logger, **args) 37 if rv is exit_unclean: 38 sys.exit(1) 39 else: 40 sys.exit(0)