from . import client
from . import config
from . import daemon
-from . import ui
from . import util
from .system import system
class Cli(object):
default_path = "/"
- def __init__(self):
- self.ui = ui.cli.CliUI()
-
def parse_cli(self):
parser = argparse.ArgumentParser(
description = _("Pakfire command line interface"),
return args.func(args)
except KeyboardInterrupt:
- self.ui.message(_("Received keyboard interupt (Ctrl-C). Exiting."),
- level=logging.CRITICAL)
-
return 128 + signal.SIGINT
except DependencyError as e:
- self.ui.message(_("One or more dependencies could not been resolved"))
- self.ui.message("") # empty line
+ print(_("One or more dependencies could not been resolved"))
+ print("") # empty line
# This exception provides a list of all problems
problems, = e.args
# List all problems
for problem in problems:
- self.ui.message(" * %s" % problem)
+ print(" * %s" % problem)
- self.ui.message(" %s" % _("Possible solutions are:"))
+ print(" %s" % _("Possible solutions are:"))
for solution in problem.solutions:
- self.ui.message(" * %s" % solution)
+ print(" * %s" % solution)
# Add another empty line
- self.ui.message("")
+ print("")
return 4
# Catch all errors and show a user-friendly error message.
except Error as e:
- self.ui.message(_("An error has occured when running Pakfire"), level=logging.CRITICAL)
-
- self.ui.message(_("%s: %s") % (e.__class__.__name__, e.message),
- level=logging.ERROR)
+ print(_("An error has occured when running Pakfire"))
+ print(_("%s: %s") % (e.__class__.__name__, e.message))
return e.exit_code
- def _dump_transaction(self, transaction):
- """
- Dumps the transaction
- """
- t = transaction.dump()
-
- for line in t.splitlines():
- self.ui.message(line)
-
def _execute_transaction(self, transaction):
transaction.run()
with self.pakfire(ns) as p:
for pkg in p.info(ns.package):
s = pkg.dump(long=ns.long)
- self.ui.message(s)
+ print(s)
def handle_search(self, ns):
with self.pakfire(ns) as p:
if pkg.name.endswith("-debuginfo"):
continue
- self.ui.message("%-24s: %s" % (pkg.name, pkg.summary))
+ print("%-24s: %s" % (pkg.name, pkg.summary))
def handle_update(self, ns, check=False):
with self.pakfire(ns) as p:
print(FORMAT % (repo.name, repo.enabled, repo.priority, len(repo)))
def handle_clean(self, ns):
- self.ui.message(_("Cleaning up everything..."))
+ print(_("Cleaning up everything..."))
p = self.pakfire(ns)
p.clean()
# This will throw an exception when there are errors
transaction = p.check()
- self.ui.message(_("Everything okay"))
+ print(_("Everything okay"))
def handle_extract(self, ns):
with self.pakfire(ns) as p:
with b.pakfire as p:
for pkg in p.info(ns.package):
s = pkg.dump(long=True, filelist=ns.filelist)
- self.ui.message(s)
+ print(s)
def handle_repolist(self, ns):
with self.builder(ns) as b: