Ejemplo n.º 1
0
 def run(self):
     if [self.kwargs[k] for k in ['installed', 'remote', 'available']].count(True) > 1:
         logger.error('Only one of --installed, --remote or --available '
                      'can be used simultaneously')
         return
     if self.kwargs['remote'] or self.kwargs['available']:
         logger.infolines(dapicli.format_daps(simple=self.kwargs['simple'],
                          skip_installed=self.kwargs['available']))
     else:
         logger.infolines(dapicli.format_installed_dap_list(simple=self.kwargs['simple']))
Ejemplo n.º 2
0
 def run(self):
     if [self.kwargs[k]
             for k in ['installed', 'remote', 'available']].count(True) > 1:
         logger.error('Only one of --installed, --remote or --available '
                      'can be used simultaneously')
         return
     if self.kwargs['remote'] or self.kwargs['available']:
         logger.infolines(
             dapicli.format_daps(simple=self.kwargs['simple'],
                                 skip_installed=self.kwargs['available']))
     else:
         logger.infolines(
             dapicli.format_installed_dap_list(
                 simple=self.kwargs['simple']))
Ejemplo n.º 3
0
    def run(self):
        newargs = {}
        newargs['q'] = ' '.join(self.kwargs['query'])
        newargs['noassistants'] = self.kwargs['noassistants']
        newargs['unstable'] = self.kwargs['unstable']
        newargs['notactive'] = self.kwargs['deactivated']
        newargs['minimal_rank'] = self.kwargs['minrank']
        newargs['minimal_rank_count'] = self.kwargs['mincount']
        if not self.kwargs['allplatforms']:
            newargs['platform'] = utils.get_distro_name()

        try:
            logger.infolines(dapicli.format_search(**newargs))
        except exceptions.DapiError as e:
            logger.error(utils.exc_as_decoded_string(e))
            raise exceptions.ExecutionException(utils.exc_as_decoded_string(e))
Ejemplo n.º 4
0
    def run(self):
        newargs = {}
        newargs['q'] = ' '.join(self.kwargs['query'])
        newargs['noassistants'] = self.kwargs['noassistants']
        newargs['unstable'] = self.kwargs['unstable']
        newargs['notactive'] = self.kwargs['deactivated']
        newargs['minimal_rank'] = self.kwargs['minrank']
        newargs['minimal_rank_count'] = self.kwargs['mincount']
        if not self.kwargs['allplatforms']:
            newargs['platform'] = utils.get_distro_name()

        try:
            logger.infolines(dapicli.format_search(**newargs))
        except exceptions.DapiError as e:
            logger.error(utils.exc_as_decoded_string(e))
            raise exceptions.ExecutionException(utils.exc_as_decoded_string(e))
Ejemplo n.º 5
0
 def run(self):
     if os.path.isfile(self.kwargs['package']):
         old_level = logger.getEffectiveLevel()
         logger.setLevel(logging.ERROR)
         try:
             d = dapi.Dap(self.kwargs['package'])
             if not dapi.DapChecker.check(d):
                 raise exceptions.ExecutionException(
                     'This DAP is not valid, info can\'t be displayed.')
         finally:
             logger.setLevel(old_level)
         logger.infolines(dapicli.format_local_dap(d, full=self.kwargs.get('full', False)))
     elif self.kwargs.get('installed'):
         try:
             logger.infolines(dapicli.format_installed_dap(self.kwargs['package'],
                                                           full=self.kwargs.get('full', False)))
         except exceptions.DapiError as e:
             logger.error(utils.exc_as_decoded_string(e))
             raise exceptions.ExecutionException(utils.exc_as_decoded_string(e))
     else:
         try:
             logger.infolines(dapicli.format_dap_from_dapi(self.kwargs['package'],
                                                           full=self.kwargs.get('full', False)))
         except exceptions.DapiError as e:
             logger.error(utils.exc_as_decoded_string(e))
             raise exceptions.ExecutionException(utils.exc_as_decoded_string(e))
Ejemplo n.º 6
0
 def run(self):
     if os.path.isfile(self.kwargs['package']):
         old_level = logger.getEffectiveLevel()
         logger.setLevel(logging.ERROR)
         try:
             d = dapi.Dap(self.kwargs['package'])
             if not dapi.DapChecker.check(d):
                 raise exceptions.ExecutionException(
                     'This DAP is not valid, info can\'t be displayed.')
         finally:
             logger.setLevel(old_level)
         logger.infolines(
             dapicli.format_local_dap(d,
                                      full=self.kwargs.get('full', False)))
     elif self.kwargs.get('installed'):
         try:
             logger.infolines(
                 dapicli.format_installed_dap(self.kwargs['package'],
                                              full=self.kwargs.get(
                                                  'full', False)))
         except exceptions.DapiError as e:
             logger.error(utils.exc_as_decoded_string(e))
             raise exceptions.ExecutionException(
                 utils.exc_as_decoded_string(e))
     else:
         try:
             logger.infolines(
                 dapicli.format_dap_from_dapi(self.kwargs['package'],
                                              full=self.kwargs.get(
                                                  'full', False)))
         except exceptions.DapiError as e:
             logger.error(utils.exc_as_decoded_string(e))
             raise exceptions.ExecutionException(
                 utils.exc_as_decoded_string(e))