mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-20 10:26:44 +01:00
Switch to raise the error
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
2e92d854e0
commit
66aa4cf118
6 changed files with 20 additions and 29 deletions
|
@ -67,7 +67,7 @@ class PackageManager(Utils):
|
|||
if os.path.isfile(self.meta.pkg_path + check):
|
||||
print("Completed!\n")
|
||||
else:
|
||||
raise SystemExit()
|
||||
raise SystemExit(1)
|
||||
except subprocess.CalledProcessError:
|
||||
self._not_found("Can't install", self.binary, pkg)
|
||||
raise SystemExit(1)
|
||||
|
@ -82,7 +82,7 @@ class PackageManager(Utils):
|
|||
if os.path.isfile(self.meta.pkg_path + check):
|
||||
print("Completed!\n")
|
||||
else:
|
||||
raise SystemExit()
|
||||
raise SystemExit(1)
|
||||
except subprocess.CalledProcessError:
|
||||
self._not_found("Can't upgrade", self.binary, pkg)
|
||||
raise SystemExit(1)
|
||||
|
@ -116,8 +116,7 @@ class PackageManager(Utils):
|
|||
"\nAre you sure to remove {0} {1} [y/N]? ".format(
|
||||
str(len(self.removed)), msg))
|
||||
except EOFError:
|
||||
print() # new line at exit
|
||||
raise SystemExit()
|
||||
raise SystemExit(1)
|
||||
if remove_pkg in ["y", "Y"]:
|
||||
self._check_if_used(self.binary)
|
||||
for rmv in self.removed:
|
||||
|
@ -153,8 +152,7 @@ class PackageManager(Utils):
|
|||
"other packages) [y/N]? ")
|
||||
print()
|
||||
except EOFError:
|
||||
print() # new line at exit
|
||||
raise SystemExit()
|
||||
raise SystemExit("\n")
|
||||
return remove_dep
|
||||
|
||||
def _get_removed(self):
|
||||
|
@ -296,8 +294,7 @@ class PackageManager(Utils):
|
|||
if os.path.isfile(self.dep_path + package):
|
||||
os.remove(self.dep_path + package) # remove log
|
||||
except subprocess.CalledProcessError as er:
|
||||
print(er)
|
||||
raise SystemExit(1)
|
||||
raise SystemExit(er)
|
||||
|
||||
def _rmv_deps(self, dependencies, package):
|
||||
"""Remove dependencies
|
||||
|
@ -332,8 +329,7 @@ class PackageManager(Utils):
|
|||
try:
|
||||
self.skip = input(" > ").split()
|
||||
except EOFError:
|
||||
print()
|
||||
raise SystemExit()
|
||||
raise SystemExit("\n")
|
||||
for s in self.skip:
|
||||
if s in self.removed:
|
||||
self.removed.remove(s)
|
||||
|
@ -503,8 +499,7 @@ class PackageManager(Utils):
|
|||
print(pkg)
|
||||
print() # new line at end
|
||||
except (EOFError, KeyboardInterrupt, BrokenPipeError, IOError):
|
||||
print() # new line at exit
|
||||
raise SystemExit()
|
||||
raise SystemExit(1)
|
||||
|
||||
def _splitting_packages(self, pkg, repo, name):
|
||||
"""Return package name from repositories
|
||||
|
|
|
@ -64,9 +64,9 @@ class AutoBuild:
|
|||
"""Check if SlackBuild archive.tar.gz and sources exist
|
||||
"""
|
||||
if not os.path.isfile(self.path + self.script):
|
||||
print("\nslpkg: Error: SlackBuild archive.tar.gz not found\n")
|
||||
raise SystemExit(1)
|
||||
raise SystemExit("\nslpkg: Error: SlackBuild archive.tar.gz "
|
||||
"not found\n")
|
||||
for src in self.sources:
|
||||
if not os.path.isfile(self.path + src):
|
||||
print(f"\nslpkg: Error: Source file '{src}' not found\n")
|
||||
raise SystemExit(1)
|
||||
raise SystemExit(f"\nslpkg: Error: Source file '{src}' "
|
||||
f"not found\n")
|
||||
|
|
|
@ -172,8 +172,7 @@ class SBoNetwork(BlackList, Utils):
|
|||
message = " Choose an option > "
|
||||
self.choice = input(f"{self.grey}{message}{self.endc}")
|
||||
except EOFError:
|
||||
print()
|
||||
raise SystemExit()
|
||||
raise SystemExit('\n')
|
||||
try:
|
||||
print("{0}\x1b[1A{1}{2}{3}\n".format(
|
||||
" " * len(message), self.cyan, commands[self.choice],
|
||||
|
@ -301,10 +300,9 @@ class SBoNetwork(BlackList, Utils):
|
|||
status = False
|
||||
pkg = DialogUtil(data, text, title, backtitle, status).checklist()
|
||||
if pkg and len(pkg) > 1:
|
||||
print("\nslpkg: Error: Choose only one package")
|
||||
raise SystemExit()
|
||||
raise SystemExit("\nslpkg: Error: Choose only one package")
|
||||
if pkg is None:
|
||||
raise SystemExit()
|
||||
raise SystemExit(1)
|
||||
self.name = "".join(pkg)
|
||||
os.system("clear")
|
||||
|
||||
|
|
|
@ -136,8 +136,8 @@ class QueuePkgs(Utils):
|
|||
BuildPackage(script, sources, self.meta.build_path,
|
||||
auto=False).build()
|
||||
else:
|
||||
print("\nPackages not found in the queue for building\n")
|
||||
raise SystemExit(1)
|
||||
raise SystemExit("\nPackages not found in the queue for "
|
||||
"building\n")
|
||||
|
||||
def install(self):
|
||||
"""Install packages from queue
|
||||
|
@ -155,5 +155,5 @@ class QueuePkgs(Utils):
|
|||
print(f"\nPackage {prgnam} not found in the "
|
||||
f"{self.meta.output} for installation\n")
|
||||
else:
|
||||
print("\nPackages not found in the queue for installation\n")
|
||||
raise SystemExit(1)
|
||||
raise SystemExit("\nPackages not found in the queue for "
|
||||
"installation\n")
|
||||
|
|
|
@ -153,8 +153,7 @@ class SBoInstall(BlackList, Utils):
|
|||
if self.match and [""] != self.slackbuilds:
|
||||
print("\nMatching summary")
|
||||
print("=" * 79)
|
||||
print(f"Total {count_total} matching packages\n")
|
||||
raise SystemExit(1)
|
||||
raise SystemExit(f"Total {count_total} matching packages\n")
|
||||
print("\nInstalling summary")
|
||||
print("=" * 79)
|
||||
print(f"{self.grey}Total {count_total} "
|
||||
|
|
|
@ -251,8 +251,7 @@ class Patches(BlackList, Utils):
|
|||
answer = input("\nThe kernel has been upgraded, "
|
||||
"reinstall boot loader [L/E/G]? ")
|
||||
except EOFError:
|
||||
print()
|
||||
raise SystemExit()
|
||||
raise SystemExit("\n")
|
||||
if answer in ["L"]:
|
||||
subprocess.call("lilo", shell=True)
|
||||
break
|
||||
|
|
Loading…
Reference in a new issue