Esempio n. 1
0
 def __log_setup(self):
     if self.__debug:
         misc.logger_setup(logroot='yumex.updater',
                           logfmt='%(asctime)s: [%(name)s] - %(message)s',
                           loglvl=logging.DEBUG)
     else:
         misc.logger_setup()
Esempio n. 2
0
 def _log_setup(self):
     if self.args.debug:
         misc.logger_setup(
             logroot='yumex.updater',
             logfmt='%(asctime)s: [%(name)s] - %(message)s',
             loglvl=logging.DEBUG)
     else:
         misc.logger_setup()
Esempio n. 3
0
    def on_command_line(self, app, args):
        parser = argparse.ArgumentParser(prog='app')
        parser.add_argument('-d', '--debug', action='store_true')
        parser.add_argument('-y',
                            '--yes',
                            action='store_true',
                            help='Answer yes/ok to all questions')
        parser.add_argument(
            '--exit',
            action='store_true',
            help='tell dnfdaemon dbus services used by yumex to exit')
        parser.add_argument('-I',
                            '--install',
                            type=str,
                            metavar='PACKAGE',
                            help='Install Package')
        parser.add_argument('-R',
                            '--remove',
                            type=str,
                            metavar='PACKAGE',
                            help='Remove Package')
        parser.add_argument('--updateall',
                            action='store_true',
                            help='apply all available updates')
        if not self.running:
            # First run
            self.args = parser.parse_args(args.get_arguments()[1:])
            if self.args.exit:  # kill dnf daemon and quit
                misc.dbus_dnfsystem('Exit')
                sys.exit(0)

            if self.args.debug:
                misc.logger_setup(loglvl=logging.DEBUG)
            else:
                misc.logger_setup()
            if self.args.install or self.args.remove or self.args.updateall:
                self.install_mode = True
        else:
            # Second Run
            # parse cmdline in a non quitting way
            self.current_args = \
                parser.parse_known_args(args.get_arguments()[1:])[0]
            if self.current_args.exit:
                if self.window.can_close():
                    self.quit()
                else:
                    logger.info("Application is busy")
            if self.current_args.install or self.current_args.remove or \
               self.current_args.updateall:
                self.install_mode = True
        self.activate()
        return 0
Esempio n. 4
0
    def on_command_line(self, app, args):
        parser = argparse.ArgumentParser(prog='app')
        parser.add_argument('-d', '--debug', action='store_true')
        parser.add_argument(
            '-y', '--yes', action='store_true',
             help='Answer yes/ok to all questions')
        parser.add_argument('--exit', action='store_true',
            help='tell dnfdaemon dbus services used by yumex to exit')
        parser.add_argument(
            '-I', '--install', type=str, metavar='PACKAGE',
            help='Install Package')
        parser.add_argument(
            '-R', '--remove', type=str, metavar='PACKAGE',
            help='Remove Package')
        parser.add_argument(
            '--updateall', action='store_true',
            help='apply all available updates')
        if not self.running:
            # First run
            self.args = parser.parse_args(args.get_arguments()[1:])
            if self.args.exit:  # kill dnf daemon and quit
                misc.dbus_dnfsystem('Exit')
                sys.exit(0)

            if self.args.debug:
                misc.logger_setup(loglvl=logging.DEBUG)
            else:
                misc.logger_setup()
            if self.args.install or self.args.remove or self.args.updateall:
                self.install_mode = True
        else:
            # Second Run
            # parse cmdline in a non quitting way
            self.current_args = \
                parser.parse_known_args(args.get_arguments()[1:])[0]
            if self.current_args.exit:
                if self.window.can_close():
                    self.quit()
                else:
                    self.logger.info("Application is busy")
            if self.current_args.install or self.current_args.remove or \
               self.current_args.updateall:
                self.install_mode = True
        self.activate()
        return 0