mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
Add return exit code
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
b83a952db4
commit
700d308de5
6 changed files with 14 additions and 3 deletions
|
@ -222,6 +222,6 @@ def usage(repo):
|
|||
error_repo = ("slpkg: Error: Repository '{0}' does not exist"
|
||||
"\n".format(repo))
|
||||
print("\n" + error_repo)
|
||||
raise SystemExit()
|
||||
raise SystemExit(1)
|
||||
print(usage.__doc__)
|
||||
print("For more information try 'slpkg -h, --help' or view manpage\n")
|
||||
|
|
|
@ -73,5 +73,6 @@ class PkgDesc(object):
|
|||
self.meta.color["ENDC"]))
|
||||
else:
|
||||
self.msg.pkg_not_found("", self.name, "No matching", "\n")
|
||||
raise SystemExit(1)
|
||||
if description and self.repo == "sbo":
|
||||
print("")
|
||||
|
|
|
@ -62,6 +62,7 @@ class PackageManager(object):
|
|||
raise SystemExit()
|
||||
except subprocess.CalledProcessError:
|
||||
self._not_found("Can't install", self.binary, pkg)
|
||||
raise SystemExit(1)
|
||||
|
||||
def upgrade(self, flag):
|
||||
"""Upgrade Slackware binary packages with new
|
||||
|
@ -77,6 +78,7 @@ class PackageManager(object):
|
|||
raise SystemExit()
|
||||
except subprocess.CalledProcessError:
|
||||
self._not_found("Can't upgrade", self.binary, pkg)
|
||||
raise SystemExit(1)
|
||||
|
||||
def _not_found(self, message, binary, pkg):
|
||||
if len(binary) > 1:
|
||||
|
@ -157,7 +159,8 @@ class PackageManager(object):
|
|||
removed.append(split_package(pkg)[0])
|
||||
packages.append(pkg)
|
||||
if not removed:
|
||||
self.msg.pkg_not_found("", "'tag'", "Can't remove", "")
|
||||
self.msg.pkg_not_found("", "'tag'", "Can't remove", "\n")
|
||||
raise SystemExit(1)
|
||||
else:
|
||||
for pkg in self.binary:
|
||||
name = GetFromInstalled(pkg).name()
|
||||
|
@ -168,7 +171,8 @@ class PackageManager(object):
|
|||
removed.append(pkg)
|
||||
packages.append(package[0])
|
||||
else:
|
||||
self.msg.pkg_not_found("", pkg, "Can't remove", "")
|
||||
self.msg.pkg_not_found("", pkg, "Can't remove", "\n")
|
||||
raise SystemExit(1)
|
||||
return removed, packages
|
||||
|
||||
def _view_removed(self):
|
||||
|
@ -394,6 +398,7 @@ class PackageManager(object):
|
|||
if matching == 0:
|
||||
message = "Can't find"
|
||||
self.msg.pkg_not_found("", ", ".join(self.binary), message, "\n")
|
||||
raise SystemExit(1)
|
||||
else:
|
||||
self._calc_sizes()
|
||||
print("\nFound summary")
|
||||
|
@ -437,6 +442,7 @@ class PackageManager(object):
|
|||
else:
|
||||
bol = eol = "\n"
|
||||
self.msg.pkg_not_found(bol, pkg, message, eol)
|
||||
raise SystemExit(1)
|
||||
|
||||
def package_list(self, repo, name, INDEX, installed):
|
||||
"""List with the installed packages
|
||||
|
|
|
@ -128,6 +128,7 @@ class SBoNetwork(object):
|
|||
pass
|
||||
else:
|
||||
self.msg.pkg_not_found("\n", self.name, "Can't view", "\n")
|
||||
raise SystemExit(1)
|
||||
|
||||
def case_insensitive(self):
|
||||
"""Matching packages distinguish between uppercase and
|
||||
|
|
|
@ -151,6 +151,7 @@ class QueuePkgs(object):
|
|||
auto=False).build()
|
||||
else:
|
||||
print("\nPackages not found in the queue for building\n")
|
||||
raise SystemExit(1)
|
||||
|
||||
def install(self):
|
||||
"""Install packages from queue
|
||||
|
@ -169,3 +170,4 @@ class QueuePkgs(object):
|
|||
"installation\n".format(prgnam, self.meta.output))
|
||||
else:
|
||||
print("\nPackages not found in the queue for installation\n")
|
||||
raise SystemExit(1)
|
||||
|
|
|
@ -120,6 +120,7 @@ class TrackingDeps(object):
|
|||
else:
|
||||
self.msg.done()
|
||||
print("\nNo package was found to match\n")
|
||||
raise SystemExit(1)
|
||||
|
||||
def repositories(self):
|
||||
"""Get dependencies by repositories
|
||||
|
|
Loading…
Reference in a new issue