Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2022-05-12 20:19:42 +03:00
commit b69d90c986
13 changed files with 37 additions and 21 deletions

View file

@ -1,3 +1,9 @@
3.9.8 - 12/05/2022
Bugfix:
- Flag (--repos=) TypeError: exceptions must derive from BaseException
Updated:
- Slackbuild script switch to bash shell
3.9.7 - 09/05/2022
Fixed:
- Stderr error output

View file

@ -1,4 +1,4 @@
# slpkg 3.9.7
# slpkg 3.9.8
Slpkg is a powerful software package manager that installs, updates, and removes packages on
[Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# install.sh file is part of slpkg.

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Slackware build script for slpkg

View file

@ -81,7 +81,7 @@ class MetaData:
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (3, 9, 7)
__version_info__ = (3, 9, 8)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"

View file

@ -225,7 +225,7 @@ def usage(repo, stderr):
else:
error_repo = (f"slpkg: Error: Repository '{repo}' does not exist"
"\n")
raise(f"\n {error_repo}")
raise SystemExit(f"\n{error_repo}")
print(usage.__doc__)
print("For more information try 'slpkg -h, --help' or view manpage\n")
if stderr == 1:

View file

@ -61,8 +61,7 @@ class Auto:
try:
self.choice = input(" > ")
except EOFError:
print()
raise SystemExit()
raise SystemExit("\n")
if self.choice in self.commands.keys():
print(f" \x1b[1A{self.cyan}{self.commands[self.choice]}"
f"{self.endc}", end="\n\n")

View file

@ -67,30 +67,33 @@ class BlackList(Utils):
def black_listed(self):
"""Print blacklist packages
"""
print("Packages in the blacklist:\n")
print("Packages in the blacklist:")
for black in list(self.black_filter()):
if black:
print(f"{self.green}{black}{self.endc}")
print()
def black_add(self, pkgs):
"""Add blacklist packages if not exist
"""
blacklist = list(self.black_filter())
pkgs = set(pkgs)
print("Add packages in the blacklist:\n")
print("Add packages in the blacklist:")
with open(self.blackfile, "a") as black_conf:
for pkg in pkgs:
if pkg not in blacklist:
print(f"{self.green}{pkg}{self.endc}")
black_conf.write(pkg + "\n")
print()
def black_remove(self, pkgs):
"""Remove packages from blacklist
"""
print("Remove packages from the blacklist:\n")
print("Remove packages from the blacklist:")
with open(self.blackfile, "w") as remove:
for line in self.black_conf.splitlines():
if line not in pkgs:
remove.write(line + "\n")
else:
print(f"{self.red}{line}{self.endc}")
print(f"{self.red}{line}{self.endc}")
print()

View file

@ -43,8 +43,8 @@ class DialogUtil:
def imp_dialog(self):
try:
from dialog import Dialog
except ImportError:
raise SystemExit()
except ImportError as er:
raise SystemExit(er)
self.d = Dialog(dialog="dialog", autowidgetsize=True)
def checklist(self):

View file

@ -300,7 +300,8 @@ class SBoNetwork(BlackList, Utils):
status = False
pkg = DialogUtil(data, text, title, backtitle, status).checklist()
if pkg and len(pkg) > 1:
raise SystemExit("\nslpkg: Error: Choose only one package")
os.system("clear")
raise SystemExit("\nslpkg: Error: Choose only one package\n")
if pkg is None:
raise SystemExit(1)
self.name = "".join(pkg)
@ -341,7 +342,8 @@ class SBoNetwork(BlackList, Utils):
if self.FAULT:
print()
self.msg.template(78)
print(f"| Package {self.prgnam} {self.red} {self.FAULT} {self.endc}")
print(f"| Package {self.prgnam} {self.red} {self.FAULT} "
f"{self.endc}")
self.msg.template(78)
else:
sources = []

View file

@ -82,16 +82,17 @@ class QueuePkgs(Utils):
def listed(self):
"""Print packages from queue
"""
print("Packages in the queue:\n")
print("Packages in the queue:")
for pkg in self.packages():
print(f"{self.green}{pkg}{self.endc}")
print()
def add(self, pkgs):
"""Add packages in queue if not exist
"""
queue_list = list(self.packages())
pkgs = list(OrderedDict.fromkeys(pkgs))
print("Add packages in the queue:\n")
print("Add packages in the queue:")
with open(self.queue_list, "a") as queue:
for pkg in pkgs:
find = sbo_search_pkg(pkg)
@ -100,24 +101,30 @@ class QueuePkgs(Utils):
queue.write(pkg + "\n")
else:
print(f"{self.red}{pkg}{self.endc}")
print()
def remove(self, pkgs):
"""Remove packages from queue
"""
print("Remove packages from the queue:\n")
print("Remove packages from the queue:")
with open(self.queue_list, "w") as queue:
for line in self.queued.splitlines():
if line not in pkgs:
queue.write(line + "\n")
else:
print(f"{self.red}{line}{self.endc}")
print()
def build(self):
"""Build packages from queue
"""
sources = []
packages = list(self.packages())
if packages:
for pkg in packages:
if pkg not in SBoGrep(pkg).names():
raise SystemExit(f"\nPackage '{pkg}' was not found in "
f"the SBo repository\n")
if not os.path.exists(self.meta.build_path):
os.mkdir(self.meta.build_path)
if not os.path.exists(self._SOURCES):
@ -125,7 +132,6 @@ class QueuePkgs(Utils):
sbo_url = sbo_search_pkg(pkg)
sbo_dwn = SBoLink(sbo_url).tar_gz()
source_dwn = SBoGrep(pkg).source().split()
sources = []
os.chdir(self.meta.build_path)
script = sbo_dwn.split("/")[-1]
Download(self.meta.build_path, sbo_dwn.split(),

View file

@ -166,7 +166,7 @@ class SBoInstall(BlackList, Utils):
self.continue_to_install()
else:
self.msg.not_found(self.is_upgrade)
raise SystemExit(1)
raise SystemExit()
def case_insensitive(self):
"""Matching packages distinguish between uppercase and

View file

@ -53,6 +53,6 @@ def choose_upg(packages):
if name in packages:
selected_packages.append(name)
if not selected_packages:
raise SystemExit()
raise SystemExit(1)
print()
return selected_packages