def main(args):
    """Bootstrap function that sets up the object references we need and calls real_main()."""
    options, target_options = parse_options(args)

    # Set up our logging format.
    log_level = logging.INFO
    if options.verbose:
        log_level = logging.DEBUG
    logging.basicConfig(level=log_level,
                        format=('%(asctime)s %(filename)s:%(lineno)-3d '
                                '%(levelname)s %(message)s'),
                        datefmt='%y%m%d %H:%M:%S')

    target_port_obj = port.get(None, target_options)
    host_port_obj = get_host_port_object(options)
    if not host_port_obj or not target_port_obj:
        return 1

    url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
    scm_obj = scm.default_scm()

    # We use the default zip factory method.
    zip_factory = None

    return real_main(options, target_options, host_port_obj, target_port_obj,
                     url_fetcher, zip_factory, scm_obj)
    def __init__(self, running_port, target_port, platform, options):
        """
        Args:
            running_port: the Port the script is running on.
            target_port: the Port the script uses to find port-specific
                configuration information like the test_expectations.txt
                file location and the list of test platforms.
            platform: the test platform to rebaseline
            options: the command-line options object."""
        self._platform = platform
        self._options = options
        self._port = running_port
        self._target_port = target_port
        self._rebaseline_port = port.get(
            self._target_port.test_platform_name_to_name(platform), options)
        self._rebaselining_tests = []
        self._rebaselined_tests = []

        # Create tests and expectations helper which is used to:
        #   -. compile list of tests that need rebaselining.
        #   -. update the tests in test_expectations file after rebaseline
        #      is done.
        expectations_str = self._rebaseline_port.test_expectations()
        self._test_expectations = \
            test_expectations.TestExpectations(self._rebaseline_port,
                                               None,
                                               expectations_str,
                                               self._platform,
                                               False,
                                               False)
        self._scm = scm.default_scm()
Ejemplo n.º 3
0
    def __init__(self, running_port, target_port, platform, options):
        """
        Args:
            running_port: the Port the script is running on.
            target_port: the Port the script uses to find port-specific
                configuration information like the test_expectations.txt
                file location and the list of test platforms.
            platform: the test platform to rebaseline
            options: the command-line options object."""
        self._platform = platform
        self._options = options
        self._port = running_port
        self._target_port = target_port
        self._rebaseline_port = port.get(self._target_port.test_platform_name_to_name(platform), options)
        self._rebaselining_tests = []
        self._rebaselined_tests = []

        # Create tests and expectations helper which is used to:
        #   -. compile list of tests that need rebaselining.
        #   -. update the tests in test_expectations file after rebaseline
        #      is done.
        expectations_str = self._rebaseline_port.test_expectations()
        self._test_expectations = test_expectations.TestExpectations(
            self._rebaseline_port, None, expectations_str, self._platform, False, False
        )
        self._scm = scm.default_scm()
def main(args):
    """Bootstrap function that sets up the object references we need and calls real_main()."""
    options, target_options = parse_options(args)

    # Set up our logging format.
    log_level = logging.INFO
    if options.verbose:
        log_level = logging.DEBUG
    logging.basicConfig(level=log_level,
                        format=('%(asctime)s %(filename)s:%(lineno)-3d '
                                '%(levelname)s %(message)s'),
                        datefmt='%y%m%d %H:%M:%S')

    target_port_obj = port.get(None, target_options)
    host_port_obj = get_host_port_object(options)
    if not host_port_obj or not target_port_obj:
        return 1

    url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
    scm_obj = scm.default_scm()

    # We use the default zip factory method.
    zip_factory = None

    return real_main(options, target_options, host_port_obj, target_port_obj, url_fetcher,
                     zip_factory, scm_obj)
Ejemplo n.º 5
0
def main(args):
    """Bootstrap function that sets up the object references we need and calls real_main()."""
    options, target_options = parse_options(args)

    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    if options.verbose:
        log_level = logging.DEBUG
        log_handler = DebugLogHandler()
    else:
        log_level = logging.INFO
        log_handler = NormalLogHandler()

    logger = logging.getLogger()
    logger.setLevel(log_level)
    logger.addHandler(log_handler)

    target_port_obj = port.get(None, target_options)
    host_port_obj = get_host_port_object(options)
    if not host_port_obj or not target_port_obj:
        return 1

    url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
    scm_obj = scm.default_scm()

    # We use the default zip factory method.
    zip_factory = None

    # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
    host_port_obj._filesystem.chdir(scm_obj.checkout_root)

    ret_code = real_main(options, target_options, host_port_obj,
                         target_port_obj, url_fetcher, zip_factory, scm_obj)
    if not ret_code and log_handler.num_failures:
        ret_code = 1
    print ''
    if ret_code:
        print 'Rebaselining failed.'
    else:
        print 'Rebaselining succeeded.'
    return ret_code
def main(args):
    """Bootstrap function that sets up the object references we need and calls real_main()."""
    options, target_options = parse_options(args)

    logger = logging.getLogger()
    logger.setLevel(logging.INFO)
    if options.verbose:
        log_level = logging.DEBUG
        log_handler = DebugLogHandler()
    else:
        log_level = logging.INFO
        log_handler = NormalLogHandler()

    logger = logging.getLogger()
    logger.setLevel(log_level)
    logger.addHandler(log_handler)

    target_port_obj = port.get(None, target_options)
    host_port_obj = get_host_port_object(options)
    if not host_port_obj or not target_port_obj:
        return 1

    url_fetcher = urlfetcher.UrlFetcher(host_port_obj._filesystem)
    scm_obj = scm.default_scm()

    # We use the default zip factory method.
    zip_factory = None

    # FIXME: SCM module doesn't handle paths that aren't relative to the checkout_root consistently.
    host_port_obj._filesystem.chdir(scm_obj.checkout_root)

    ret_code = real_main(options, target_options, host_port_obj, target_port_obj, url_fetcher,
                         zip_factory, scm_obj)
    if not ret_code and log_handler.num_failures:
        ret_code = 1
    print ''
    if ret_code:
        print 'Rebaselining failed.'
    else:
        print 'Rebaselining succeeded.'
    return ret_code
Ejemplo n.º 7
0
 def scm(self):
     # Lazily initialize SCM to not error-out before command line parsing (or when running non-scm commands).
     if not self._scm:
         self._scm = default_scm()
     return self._scm
Ejemplo n.º 8
0
 def _initialize_scm(self, patch_directories=None):
     self._scm = default_scm(patch_directories)
     self._checkout = Checkout(self.scm())
Ejemplo n.º 9
0
 def _initialize_scm(self, patch_directories=None):
     self._scm = default_scm(patch_directories)
     self._checkout = Checkout(self.scm())
Ejemplo n.º 10
0
 def scm(self):
     # Lazily initialize SCM to not error-out before command line parsing (or when running non-scm commands).
     if not self._scm:
         self._scm = default_scm()
     return self._scm