Fix errors

This commit is contained in:
Dimitris Zlatanidis 2015-09-23 11:52:09 +03:00
parent 9e09de72d3
commit 8db63b22ef
6 changed files with 18 additions and 10 deletions

View file

@ -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()

View file

@ -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__)

View file

@ -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):

View file

@ -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):

View file

@ -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):

View file

@ -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()