third_party/blink/tools/blinkpy/w3c/wpt_metadata_builder.py
def _build_metadata_and_write(self):
        """Build the metadata files and write them to disk."""
        if self.fs.exists(self.metadata_output_dir):
            _log.debug("Output dir exists, deleting: %s",
                       self.metadata_output_dir)
            self.fs.rmtree(self.metadata_output_dir)

        # Start by populating any metadata that is checked into the source tree.
        # We will later determine, for each test, whether some other status
        # should overwrite this.
        if self.checked_in_metadata_dir and self.fs.exists(
                self.checked_in_metadata_dir):
            _log.info("Copying checked-in WPT metadata before translated "
                      "files.")
            self._copy_checked_in_metadata()
        else:
            _log.warning("Not using checked-in WPT metadata, path is empty or "
                         "does not exist: %s" % self.checked_in_metadata_dir)

        tests_for_metadata = self.get_tests_needing_metadata()
        _log.info("Found %d tests requiring metadata", len(tests_for_metadata))
        for test_name, test_status_bitmap in tests_for_metadata.items():
            filename, file_contents = self.get_metadata_filename_and_contents(
                test_name, test_status_bitmap)
            if not filename or not file_contents:
                continue
            self._write_translated_metadata_to_file(filename, file_contents)

        # Finally, output a stamp file with the same name as the output
        # directory. The stamp file is empty, it's only used for its mtime.
        # This makes the GN build system happy (see crbug.com/995112).
        with self.fs.open_text_file_for_writing(self.metadata_output_dir +
                                                ".stamp"):
            pass
Build the metadata files and write them to disk.
Build the metadata files and write them to disk.
Build the metadata files and write them to disk .
def _build_metadata_and_write(self):
        if self.fs.exists(self.metadata_output_dir):
            _log.debug("Output dir exists, deleting: %s",
                       self.metadata_output_dir)
            self.fs.rmtree(self.metadata_output_dir)
        if self.checked_in_metadata_dir and self.fs.exists(
                self.checked_in_metadata_dir):
            _log.info("Copying checked-in WPT metadata before translated "
                      "files.")
            self._copy_checked_in_metadata()
        else:
            _log.warning("Not using checked-in WPT metadata, path is empty or "
                         "does not exist: %s" % self.checked_in_metadata_dir)
        tests_for_metadata = self.get_tests_needing_metadata()
        _log.info("Found %d tests requiring metadata", len(tests_for_metadata))
        for test_name, test_status_bitmap in tests_for_metadata.items():
            filename, file_contents = self.get_metadata_filename_and_contents(
                test_name, test_status_bitmap)
            if not filename or not file_contents:
                continue
            self._write_translated_metadata_to_file(filename, file_contents)
        with self.fs.open_text_file_for_writing(self.metadata_output_dir +
                                                ".stamp"):
            pass
def _build_metadata_and_write ( self ) : if self . fs . exists ( self . metadata_output_dir ) : _log . debug ( "Output dir exists, deleting: %s" , self . metadata_output_dir ) self . fs . rmtree ( self . metadata_output_dir ) if self . checked_in_metadata_dir and self . fs . exists ( self . checked_in_metadata_dir ) : _log . info ( "Copying checked-in WPT metadata before translated " "files." ) self . _copy_checked_in_metadata ( ) else : _log . warning ( "Not using checked-in WPT metadata, path is empty or " "does not exist: %s" % self . checked_in_metadata_dir ) tests_for_metadata = self . get_tests_needing_metadata ( ) _log . info ( "Found %d tests requiring metadata" , len ( tests_for_metadata ) ) for test_name , test_status_bitmap in tests_for_metadata . items ( ) : filename , file_contents = self . get_metadata_filename_and_contents ( test_name , test_status_bitmap ) if not filename or not file_contents : continue self . _write_translated_metadata_to_file ( filename , file_contents ) with self . fs . open_text_file_for_writing ( self . metadata_output_dir + ".stamp" ) : pass
Build the metadata files and write them to disk.
Build the metadata files and write them to disk .
"""Build the metadata files and write them to disk.""" # Start by populating any metadata that is checked into the source tree. # We will later determine, for each test, whether some other status # should overwrite this. # Finally, output a stamp file with the same name as the output # directory. The stamp file is empty, it's only used for its mtime. # This makes the GN build system happy (see crbug.com/995112).
self