From 8db63b22efd2738facf1ad7719dc596a93bd23eb Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 23 Sep 2015 11:52:09 +0300 Subject: [PATCH] Fix errors --- slpkg/__metadata__.py | 2 +- slpkg/arguments.py | 6 +++--- slpkg/graph.py | 2 +- slpkg/messages.py | 2 +- slpkg/repositories.py | 14 +++++++++++--- slpkg/sbo/network.py | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index b52a5754..7047b006 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -31,7 +31,7 @@ def s_user(user): Check for root user """ if user != "root": - print("\nslpkg: error: must have root privileges\n") + print("\nslpkg: Error: Must have root privileges\n") raise SystemExit() diff --git a/slpkg/arguments.py b/slpkg/arguments.py index 66d00921..0975ab97 100644 --- a/slpkg/arguments.py +++ b/slpkg/arguments.py @@ -54,7 +54,7 @@ Commands: repositories via dialog utility. repo-list Print a list of all the repositories. - repo-info [repository] Get information about a + lepo-info [repository] Get information about a repository. update slpkg Upgrade the program directly from repository. @@ -176,10 +176,10 @@ def usage(repo): all_repos = RepoList().all_repos del RepoList().all_repos if repo in all_repos: - error_repo = ("slpkg: error: repository '{0}' is not activated" + error_repo = ("slpkg: Error: Repository '{0}' is not activated" "\n".format(repo)) else: - error_repo = ("slpkg: error: repository '{0}' does not exist" + error_repo = ("slpkg: Error: Repository '{0}' does not exist" "\n".format(repo)) header() print(usage.__doc__) diff --git a/slpkg/graph.py b/slpkg/graph.py index 7e195f4f..2f1431d6 100644 --- a/slpkg/graph.py +++ b/slpkg/graph.py @@ -80,7 +80,7 @@ class Graph(object): ", ".join(self.file_format))) raise SystemExit() except IndexError: - print("slpkg: error: Image file suffix missing") + print("slpkg: Error: Image file suffix missing") raise SystemExit() def graph_easy(self): diff --git a/slpkg/messages.py b/slpkg/messages.py index d168002d..b8ac69d4 100644 --- a/slpkg/messages.py +++ b/slpkg/messages.py @@ -53,7 +53,7 @@ class Msg(object): """Check for root user """ if user != "root": - print("\nslpkg: error: must have root privileges\n") + print("\nslpkg: Error: Must have root privileges\n") raise SystemExit() def build_FAILED(self, prgnam): diff --git a/slpkg/repositories.py b/slpkg/repositories.py index 027dc90c..c475cb7e 100644 --- a/slpkg/repositories.py +++ b/slpkg/repositories.py @@ -33,6 +33,7 @@ class Repo(object): """ def __init__(self): self.meta = _meta_ + self.DEFAULT_REPOS_NAMES = self.meta.default_repositories self.custom_repo_file = "/etc/slpkg/custom-repositories" self.default_repo_file = "/etc/slpkg/default-repositories" self.custom_repositories_list = Utils().read_file(self.custom_repo_file) @@ -57,8 +58,8 @@ class Repo(object): "repo-list'.\n".format(repo)) raise SystemExit() elif len(repo) > 6: - print("\nMaximum repository name length must be six (6) " - "characters\n") + print("\nslpkg: Error: Maximum repository name length must be " + "six (6) characters\n") raise SystemExit() with open(self.custom_repo_file, "a") as repos: new_line = " {0}{1}{2}\n".format(repo, " " * (10 - len(repo)), url) @@ -102,7 +103,14 @@ class Repo(object): for line in self.default_repositories_list.splitlines(): line = line.lstrip() if not line.startswith("#"): - default_dict_repo[line.split()[0]] = line.split()[1] + if line.split()[0] in self.DEFAULT_REPOS_NAMES: + default_dict_repo[line.split()[0]] = line.split()[1] + else: + print("\nslpkg: Error: Repository name '{0}' is not " + "default name.\n Please check file: " + "/etc/slpkg/default-repositories\n".format( + line.split()[0])) + raise SystemExit() return default_dict_repo def slack(self): diff --git a/slpkg/sbo/network.py b/slpkg/sbo/network.py index 10ebdbc3..78a03924 100644 --- a/slpkg/sbo/network.py +++ b/slpkg/sbo/network.py @@ -322,7 +322,7 @@ class SBoNetwork(object): status = False pkg = DialogUtil(data, text, title, backtitle, status).checklist() if pkg and len(pkg) > 1: - print("\nslpkg: error: choose only one package") + print("\nslpkg: Error: Choose only one package") raise SystemExit() if pkg is None: raise SystemExit()