def download(self, package_name):
        """Download given package."""
        if not package_name:
            ValueError('package_name required.')
        if self.is_dnf:
            cmd = 'dnf download {0}.{1}'.format(package_name, self.arch)
        else:
            cmd = 'yumdownloader {0}.{1}'.format(package_name, self.arch)
        try:
            Cmd.sh_e(cmd, stdout=subprocess.PIPE)
        except CmdError as e:
            for out in (e.stdout, e.stderr):
                for line in out.split('\n'):
                    if re.match(r'^No package [^ ]+ available', line) or \
                       re.match(r'^No Match for argument', line):
                        raise RemoteFileNotFoundError(
                            'Package {0} not found on remote'.format(
                                package_name
                            )
                        )
            raise e
def download ( self , package_name ) : if not package_name : ValueError ( 'package_name required.' ) if self . is_dnf : cmd = 'dnf download {0}.{1}' . format ( package_name , self . arch ) else : cmd = 'yumdownloader {0}.{1}' . format ( package_name , self . arch ) try : Cmd . sh_e ( cmd , stdout = subprocess . PIPE ) except CmdError as e : for out in ( e . stdout , e . stderr ) : for line in out . split ( '\n' ) : if re . match ( r'^No package [^ ]+ available' , line ) or re . match ( r'^No Match for argument' , line ) : raise RemoteFileNotFoundError ( 'Package {0} not found on remote' . format ( package_name ) ) raise e
Download given package.