Ejemplo n.º 1
0
    def _stripped_name_version(self):
        """Returns filename stripped of the suffix.
        Returns:
            Filename stripped of the suffix (extension).
        """
        # we don't use splitext, because on "a.tar.gz" it returns ("a.tar", "gz")
        filename = os.path.basename(self.local_file)
        for archive_suffix in settings.ARCHIVE_SUFFIXES:
            if filename.endswith(archive_suffix):
                return filename.rstrip('{0}'.format(archive_suffix))

        raise exceptions.UnknownArchiveFormatException(
            'Unkown archive format of file {0}.'.format(filename))
Ejemplo n.º 2
0
 def _stripped_name_version(self):
     """Returns filename stripped of the suffix.
     Returns:
         Filename stripped of the suffix (extension).
     """
     # we don't use splitext, because on "a.tar.gz" it returns ("a.tar",
     # "gz")
     filename = os.path.basename(self.local_file)
     for archive_suffix in settings.ARCHIVE_SUFFIXES:
         if filename.endswith(archive_suffix):
             return filename.rstrip('{0}'.format(archive_suffix))
     # if for cycle is exhausted it means no suffix was found
     else:
         raise exceptions.UnknownArchiveFormatException(
             'Unkown archive format of file {0}.'.format(filename))
         logger.error(
             'Unkown archive format of file {0}.'.format(filename), exc_info=True)
         logger.info('Rpmbuild failed. See log for more info.')