示例#1
0
    def run(self, state):
        png_files = self._check_pngs(self._changed_files(state))

        if png_files:
            detection = self._detector.display_name()

            if detection == "git":
                (file_missing, autoprop_missing, png_missing) = checksvnconfigfile.check(self._host, self._fs)
                config_file_path = checksvnconfigfile.config_file_path(self._host, self._fs)

                if file_missing:
                    log("There is no SVN config file. The svn:mime-type of pngs won't set.")
                    if not self._tool.user.confirm("Are you sure you want to continue?", default="n"):
                        self._exit(1)
                elif autoprop_missing and png_missing:
                    log(checksvnconfigfile.errorstr_autoprop(config_file_path) + checksvnconfigfile.errorstr_png(config_file_path))
                    if not self._tool.user.confirm("Do you want to continue?", default="n"):
                        self._exit(1)
                elif autoprop_missing:
                    log(checksvnconfigfile.errorstr_autoprop(config_file_path))
                    if not self._tool.user.confirm("Do you want to continue?", default="n"):
                        self._exit(1)
                elif png_missing:
                    log(checksvnconfigfile.errorstr_png(config_file_path))
                    if not self._tool.user.confirm("Do you want to continue?", default="n"):
                        self._exit(1)

            elif detection == "svn":
                for filename in png_files:
                    if self._detector.exists(filename) and self._detector.propget('svn:mime-type', filename) != 'image/png':
                        print "Adding image/png mime-type to %s" % filename
                        self._detector.propset('svn:mime-type', 'image/png', filename)
示例#2
0
    def check(self, inline=None):
        errorstr = ""
        config_file_path = ""
        detection = self._detector.display_name()

        if self._fs.exists(self._file_path) and self._file_path.endswith("-expected.png"):
            with self._fs.open_binary_file_for_reading(self._file_path) as filehandle:
                if not read_checksum_from_png.read_checksum(filehandle):
                    self._handle_style_error(0, 'image/png', 5, "Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.")

        if detection == "git":
            (file_missing, autoprop_missing, png_missing) = checksvnconfigfile.check(self._host, self._fs)
            config_file_path = checksvnconfigfile.config_file_path(self._host, self._fs)

            if file_missing:
                self._handle_style_error(0, 'image/png', 5, "There is no SVN config file. (%s)" % config_file_path)
            elif autoprop_missing and png_missing:
                self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_autoprop(config_file_path) + checksvnconfigfile.errorstr_png(config_file_path))
            elif autoprop_missing:
                self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_autoprop(config_file_path))
            elif png_missing:
                self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_png(config_file_path))

        elif detection == "svn":
            prop_get = self._detector.propget("svn:mime-type", self._file_path)
            if prop_get != "image/png":
                errorstr = "Set the svn:mime-type property (svn propset svn:mime-type image/png %s)." % self._file_path
                self._handle_style_error(0, 'image/png', 5, errorstr)
示例#3
0
    def run(self, state):
        png_files = self._check_pngs(self._changed_files(state))

        if png_files:
            detection = self._detector.display_name()

            if detection == "git":
                (file_missing, autoprop_missing, png_missing) = checksvnconfigfile.check(self._host, self._fs)
                config_file_path = checksvnconfigfile.config_file_path(self._host, self._fs)

                if file_missing:
                    _log.info("There is no SVN config file. The svn:mime-type of pngs won't set.")
                    if not self._tool.user.confirm("Are you sure you want to continue?", default="n"):
                        self._exit(1)
                elif autoprop_missing and png_missing:
                    _log.info(checksvnconfigfile.errorstr_autoprop(config_file_path) + checksvnconfigfile.errorstr_png(config_file_path))
                    if not self._tool.user.confirm("Do you want to continue?", default="n"):
                        self._exit(1)
                elif autoprop_missing:
                    _log.info(checksvnconfigfile.errorstr_autoprop(config_file_path))
                    if not self._tool.user.confirm("Do you want to continue?", default="n"):
                        self._exit(1)
                elif png_missing:
                    _log.info(checksvnconfigfile.errorstr_png(config_file_path))
                    if not self._tool.user.confirm("Do you want to continue?", default="n"):
                        self._exit(1)

            elif detection == "svn":
                for filename in png_files:
                    if self._detector.exists(filename) and self._detector.propget('svn:mime-type', filename) != 'image/png':
                        print "Adding image/png mime-type to %s" % filename
                        self._detector.propset('svn:mime-type', 'image/png', filename)
示例#4
0
文件: png.py 项目: GhostQ/GitSB
    def check(self, inline=None):
        errorstr = ""
        config_file_path = ""
        detection = self._detector.display_name()

        if self._fs.exists(self._file_path) and self._file_path.endswith("-expected.png"):
            with self._fs.open_binary_file_for_reading(self._file_path) as filehandle:
                if not read_checksum_from_png.read_checksum(filehandle):
                    self._handle_style_error(0, 'image/png', 5, "Image lacks a checksum. Generate pngs using run-webkit-tests to ensure they have a checksum.")

        if detection == "git":
            (file_missing, autoprop_missing, png_missing) = checksvnconfigfile.check(self._host, self._fs)
            config_file_path = checksvnconfigfile.config_file_path(self._host, self._fs)

            if file_missing:
                self._handle_style_error(0, 'image/png', 5, "There is no SVN config file. (%s)" % config_file_path)
            elif autoprop_missing and png_missing:
                self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_autoprop(config_file_path) + checksvnconfigfile.errorstr_png(config_file_path))
            elif autoprop_missing:
                self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_autoprop(config_file_path))
            elif png_missing:
                self._handle_style_error(0, 'image/png', 5, checksvnconfigfile.errorstr_png(config_file_path))

        elif detection == "svn":
            prop_get = self._detector.propget("svn:mime-type", self._file_path)
            if prop_get != "image/png":
                errorstr = "Set the svn:mime-type property (svn propset svn:mime-type image/png %s)." % self._file_path
                self._handle_style_error(0, 'image/png', 5, errorstr)