コード例 #1
0
    def check_prefix_file(self):
        """Check the info/has_prefix file for proper formatting."""
        for member in self.archive.getmembers():
            if member.path == 'info/has_prefix':
                prefix_file = self.archive.extractfile(member.path).read()

                if not all_ascii(prefix_file, self.win_pkg):
                    return Error(self.path, 'C1128', 'Found non-ascii characters in info/has_prefix')

                for line in prefix_file.decode('utf-8').splitlines():
                    line = line.strip()
                    try:
                        placeholder, mode, filename = line.split()
                    except ValueError:
                        placeholder, mode, filename = '/<dummy>/<placeholder>', 'text', line

                    if filename not in self.paths:
                        return Error(self.path, 'C1129', u'Found filename "{}" in info/has_prefix not included in archive' .format(filename))

                    if mode not in ['binary', 'text']:
                        return Error(self.path, 'C1130', u'Found invalid mode "{}" in info/has_prefix' .format(mode))

                    if mode == 'binary':
                        if self.name == 'python':
                            return Error(self.path, 'C1131', 'Binary placeholder found in info/has_prefix not allowed when building Python')
                        elif self.win_pkg:
                            return Error(self.path, 'C1132', 'Binary placeholder found in info/has_prefix not allowed in Windows package')
                        elif len(placeholder) != 255:
                            return Error(self.path, 'C1133', u'Binary placeholder "{}" found in info/has_prefix does not have a length of 255 bytes' .format(placeholder))
コード例 #2
0
 def check_files_file_encoding(self):
     """Check the info/files file for non ascii characters."""
     if not all_ascii(self.files_file, self.win_pkg):
         return Error(
             self.path, 'C1119',
             'Found filenames in info/files containing non-ascii characters'
         )
コード例 #3
0
ファイル: checks.py プロジェクト: rs2/conda-verify
 def check_prefix_file(self):
     """Check the info/has_prefix file for proper formatting."""
     if self.prefix_file is not None:
         if not all_ascii(self.prefix_file, self.win_pkg):
             return Error(
                 self.path, "C1128", "Found non-ascii characters in info/has_prefix"
             )
コード例 #4
0
    def check_members(self):
        """Check the tar archive members for non ascii characters."""
        for member in self.archive.getmembers():
            if sys.version_info.major == 2:
                unicode_path = member.path.decode('utf-8')
            else:
                unicode_path = member.path.encode('utf-8')

            if not all_ascii(unicode_path):
                return Error(self.path, 'C1118', 'Found archive member names containing non-ascii characters')
コード例 #5
0
ファイル: checks.py プロジェクト: mingwandroid/conda-verify
    def check_members(self):
        """Check the tar archive members for non ascii characters."""
        for member in self.archive_members:
            if sys.version_info.major == 2:
                unicode_path = member.decode("utf-8")
            else:
                unicode_path = member.encode("utf-8")

            if not all_ascii(unicode_path):
                return Error(
                    self.path,
                    "C1118",
                    "Found archive member names containing non-ascii characters",
                )
コード例 #6
0
 def check_index_encoding(self):
     """Check that contents of info/index.json are all ascii characters."""
     if not all_ascii(self.index, self.win_pkg):
         return Error(self.path, 'C1116', 'Found non-ascii characters inside info/index.json')