mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-05 11:02:14 +01:00
Fixed typos
This commit is contained in:
parent
6d1934a1d9
commit
caafd78aef
29 changed files with 110 additions and 146 deletions
|
@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
class BlackList(Utils):
|
||||
"""Blacklist class to add, remove or listed packages
|
||||
"""Blacklist class to add, remove or list packages
|
||||
in blacklist file."""
|
||||
def __init__(self):
|
||||
self.green = _meta_.color["GREEN"]
|
||||
|
@ -56,8 +56,8 @@ class BlackList(Utils):
|
|||
yield black
|
||||
|
||||
def black_filter(self):
|
||||
"""Return all the installed files that start
|
||||
by the name*
|
||||
"""Returns all the installed files that start
|
||||
by the name
|
||||
"""
|
||||
for read in self.black_conf.splitlines():
|
||||
read = read.lstrip()
|
||||
|
@ -65,7 +65,7 @@ class BlackList(Utils):
|
|||
yield read.replace("\n", "")
|
||||
|
||||
def black_listed(self):
|
||||
"""Print blacklist packages
|
||||
"""Prints blacklist packages
|
||||
"""
|
||||
print("Packages in the blacklist:")
|
||||
for black in list(self.black_filter()):
|
||||
|
@ -74,7 +74,7 @@ class BlackList(Utils):
|
|||
print()
|
||||
|
||||
def black_add(self, pkgs):
|
||||
"""Add blacklist packages if not exist
|
||||
"""Adds blacklist packages if not exist
|
||||
"""
|
||||
blacklist = list(self.black_filter())
|
||||
pkgs = set(pkgs)
|
||||
|
@ -87,7 +87,7 @@ class BlackList(Utils):
|
|||
print()
|
||||
|
||||
def black_remove(self, pkgs):
|
||||
"""Remove packages from blacklist
|
||||
"""Removes packages from blacklist
|
||||
"""
|
||||
print("Remove packages from the blacklist:")
|
||||
with open(self.blackfile, "w") as remove:
|
||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
def clean_tmp():
|
||||
"""Delete packages and sources from tmp/ directory
|
||||
"""Deletes packages and sources from tmp/ directory
|
||||
"""
|
||||
tmps = [_meta_.tmp_path, # /tmp/slpkg/
|
||||
_meta_.build_path, # /tmp/slpkg/build/
|
||||
|
|
|
@ -28,7 +28,7 @@ import os
|
|||
|
||||
|
||||
class DialogUtil:
|
||||
"""Create dialog checklist
|
||||
"""Creates dialog checklist
|
||||
"""
|
||||
def __init__(self, *args):
|
||||
self.imp_dialog()
|
||||
|
|
|
@ -51,7 +51,7 @@ class Download(Utils):
|
|||
self.downder_options = self.meta.downder_options
|
||||
|
||||
def start(self):
|
||||
"""Download files using wget or other downloader.
|
||||
"""Download files using wget or other downloaders.
|
||||
Optional curl, aria2c and httpie
|
||||
"""
|
||||
dwn_count = 1
|
||||
|
@ -82,7 +82,7 @@ class Download(Utils):
|
|||
dwn_count += 1
|
||||
|
||||
def _make_tarfile(self, output_filename, source_dir):
|
||||
"""Create .tar.gz file
|
||||
"""Creates .tar.gz file
|
||||
"""
|
||||
with tarfile.open(output_filename, "w:gz") as tar:
|
||||
tar.add(source_dir, arcname=os.path.basename(source_dir))
|
||||
|
@ -96,7 +96,7 @@ class Download(Utils):
|
|||
self.dir_prefix = "--dir="
|
||||
|
||||
def _check_if_downloaded(self):
|
||||
"""Check if file downloaded
|
||||
"""Checks if file downloaded
|
||||
"""
|
||||
if not os.path.isfile(self.path + self.file_name):
|
||||
print()
|
||||
|
@ -109,7 +109,7 @@ class Download(Utils):
|
|||
raise SystemExit()
|
||||
|
||||
def _check_certificate(self):
|
||||
"""Check for certificates options for wget
|
||||
"""Checks for certificates options for wget
|
||||
"""
|
||||
if (self.file_name.startswith("jdk-") and self.repo == "sbo" and
|
||||
self.downder == "wget"):
|
||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
class FileSize:
|
||||
"""Check local or remote file size
|
||||
"""Checks local or remote file size
|
||||
"""
|
||||
def __init__(self, registry):
|
||||
self.meta = _meta_
|
||||
|
|
|
@ -47,7 +47,7 @@ class Graph:
|
|||
]
|
||||
|
||||
def dependencies(self, deps_dict):
|
||||
"""Generate graph file with depenndencies map tree
|
||||
"""Generates graph file with dependencies map tree
|
||||
"""
|
||||
try:
|
||||
import pygraphviz as pgv
|
||||
|
@ -75,7 +75,7 @@ class Graph:
|
|||
raise SystemExit()
|
||||
|
||||
def check_file(self):
|
||||
"""Check for file format and type
|
||||
"""Checks for file format and type
|
||||
"""
|
||||
try:
|
||||
image_type = f".{self.image.split('.')[1]}"
|
||||
|
@ -87,7 +87,7 @@ class Graph:
|
|||
raise SystemExit("slpkg: Error: Image file suffix missing")
|
||||
|
||||
def graph_easy(self):
|
||||
"""Draw ascii diagram. graph-easy perl module require
|
||||
"""Drawing ascii diagram. graph-easy perl module requires
|
||||
"""
|
||||
if not os.path.isfile("/usr/bin/graph-easy"):
|
||||
print("Require 'graph-easy': Install with 'slpkg -s sbo"
|
||||
|
@ -99,7 +99,7 @@ class Graph:
|
|||
raise SystemExit(1)
|
||||
|
||||
def remove_dot(self):
|
||||
"""Remove .dot files
|
||||
"""Removes .dot files
|
||||
"""
|
||||
if os.path.isfile(f"{self.image}.dot"):
|
||||
os.remove(f"{self.image}.dot")
|
||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
def pkg_checksum(binary, repo):
|
||||
"""Return checksum from CHECKSUMS.md5 file by repository
|
||||
"""Returns checksum from CHECKSUMS.md5 file by repository
|
||||
"""
|
||||
md5 = "None"
|
||||
if repo == "slack_patches" and _meta_.slack_rel == "stable":
|
||||
|
|
|
@ -31,7 +31,7 @@ from slpkg.pkg.find import find_package
|
|||
|
||||
|
||||
class PackageHealth:
|
||||
"""Health check installed packages
|
||||
"""Health check for the installed packages
|
||||
"""
|
||||
def __init__(self, mode):
|
||||
self.mode = mode
|
||||
|
@ -46,7 +46,7 @@ class PackageHealth:
|
|||
self.cn = 0
|
||||
|
||||
def packages(self):
|
||||
"""Get all installed packages from /var/log/packages/ path
|
||||
"""Gets all installed packages from /var/log/packages/ path
|
||||
"""
|
||||
self.installed = find_package("", self.pkg_path)
|
||||
|
||||
|
@ -67,7 +67,7 @@ class PackageHealth:
|
|||
raise SystemExit("\n")
|
||||
|
||||
def test(self):
|
||||
"""Get started test each package and read file list
|
||||
"""Starts testing each package and reading the file list
|
||||
"""
|
||||
self.packages()
|
||||
self.cf = 0
|
||||
|
@ -86,7 +86,7 @@ class PackageHealth:
|
|||
self.results()
|
||||
|
||||
def results(self):
|
||||
"""Print results
|
||||
"""Prints results
|
||||
"""
|
||||
print()
|
||||
per = int(round((float(self.cf) / (self.cf + self.cn)) * 100))
|
||||
|
|
|
@ -38,8 +38,8 @@ from slpkg.slack.slack_version import slack_ver
|
|||
|
||||
|
||||
class Initialization(Utils):
|
||||
"""Slpkg initialization start all from here. Create local
|
||||
package lists and update or upgrade these.
|
||||
"""Slpkg initialization starts all from here.
|
||||
Creates local package lists and updates or upgrades these.
|
||||
"""
|
||||
def __init__(self, check):
|
||||
self.check = check
|
||||
|
@ -97,7 +97,7 @@ class Initialization(Utils):
|
|||
os.makedirs(p)
|
||||
|
||||
def custom(self, name):
|
||||
"""Creating user select repository local library
|
||||
"""Creating user custom repository local library
|
||||
"""
|
||||
repo = Repo().custom_repository()[name]
|
||||
log = self.log_path + name + "/"
|
||||
|
@ -599,14 +599,14 @@ class Initialization(Utils):
|
|||
FILELIST_TXT, repo_name)
|
||||
|
||||
def down(self, path, link, repo):
|
||||
"""Download files
|
||||
"""Downloads files
|
||||
"""
|
||||
filename = link.split("/")[-1]
|
||||
if not os.path.isfile(path + filename):
|
||||
Download(path, link.split(), repo).start()
|
||||
|
||||
def remote(self, *args):
|
||||
"""Remove and recreate files
|
||||
"""Removes and recreates files
|
||||
"""
|
||||
log_path = args[0]
|
||||
ChangeLog_txt = args[1]
|
||||
|
@ -642,7 +642,7 @@ class Initialization(Utils):
|
|||
self.con.commit()
|
||||
|
||||
def merge(self, path, outfile, infiles):
|
||||
"""Merge files
|
||||
"""Merging files
|
||||
"""
|
||||
code = "utf-8"
|
||||
with open(path + outfile, 'w', encoding=code) as out_f:
|
||||
|
@ -655,7 +655,7 @@ class Initialization(Utils):
|
|||
out_f.write(line)
|
||||
|
||||
def file_remove(self, path, filename):
|
||||
"""Check if filename exists and remove
|
||||
"""Checks if filename exists and removes
|
||||
"""
|
||||
if os.path.isfile(path + filename):
|
||||
os.remove(path + filename)
|
||||
|
@ -718,7 +718,7 @@ class Update:
|
|||
self.error = f"{self.red}Error{self.endc}\n"
|
||||
|
||||
def run(self, repos):
|
||||
"""Update repositories lists
|
||||
"""Updates repositories lists
|
||||
"""
|
||||
print("\nCheck and update repositories:\n")
|
||||
default = self.meta.default_repositories
|
||||
|
@ -772,7 +772,7 @@ def check_exists_repositories(repo):
|
|||
|
||||
|
||||
def check_for_local_repos(repo):
|
||||
"""Check if repository is local
|
||||
"""Checks if repository is local
|
||||
"""
|
||||
repos_dict = Repo().default_repository()
|
||||
if repo in repos_dict:
|
||||
|
|
|
@ -32,7 +32,7 @@ from slpkg.pkg.find import find_package
|
|||
|
||||
|
||||
def library(repo):
|
||||
"""Load packages from slpkg library and from local
|
||||
"""Loads packages from slpkg library and from local
|
||||
"""
|
||||
utils = Utils()
|
||||
pkg_list, packages = [], ""
|
||||
|
@ -59,7 +59,7 @@ def library(repo):
|
|||
|
||||
|
||||
class Regex:
|
||||
"""Grap packages with simple regex using asterisk *
|
||||
"""Graps packages with simple regex using asterisk *
|
||||
with options: starts with string*
|
||||
ends with *string
|
||||
include *string*
|
||||
|
@ -90,7 +90,7 @@ class Regex:
|
|||
return lib
|
||||
|
||||
def add(self, repo, pkg):
|
||||
"""Split packages by repository
|
||||
"""Splits packages by repository
|
||||
"""
|
||||
if repo == "sbo":
|
||||
return pkg
|
||||
|
|
|
@ -30,8 +30,8 @@ from slpkg.pkg.find import find_package
|
|||
|
||||
|
||||
def write_deps(deps_dict):
|
||||
"""Write dependencies in a log file
|
||||
into directory `/var/log/slpkg/dep/`
|
||||
"""Writes dependencies in a log file
|
||||
into the directory `/var/log/slpkg/dep/`
|
||||
"""
|
||||
for name, dependencies in deps_dict.items():
|
||||
if find_package(f"{name}-", _meta_.pkg_path):
|
||||
|
|
|
@ -25,12 +25,12 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
from slpkg.clean import clean_tmp
|
||||
from slpkg.load import Regex
|
||||
from slpkg.desc import PkgDesc
|
||||
from slpkg.messages import Msg
|
||||
from slpkg.config import Config
|
||||
from slpkg.checks import Updates
|
||||
from slpkg.clean import clean_tmp
|
||||
from slpkg.repoinfo import RepoInfo
|
||||
from slpkg.repolist import RepoList
|
||||
from slpkg.repositories import Repo
|
||||
|
@ -99,7 +99,7 @@ class ArgParse(BlackList):
|
|||
"-f", "--find"
|
||||
]
|
||||
|
||||
# checking if repositories exists
|
||||
# checking if the repositories exist
|
||||
enabled_repos = _meta_.repositories
|
||||
|
||||
if len(self.args) > 1:
|
||||
|
@ -126,7 +126,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def command_update(self):
|
||||
"""Update package lists repositories
|
||||
"""Updates package lists repositories
|
||||
"""
|
||||
update = Update()
|
||||
|
||||
|
@ -143,7 +143,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def command_upgrade(self):
|
||||
"""Recreate repositories package lists
|
||||
"""Recreates repositories package lists
|
||||
"""
|
||||
upgrade = Upgrade()
|
||||
|
||||
|
@ -185,7 +185,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def command_repo_add(self):
|
||||
"""Add custom repositories
|
||||
"""Adds custom repositories
|
||||
"""
|
||||
if len(self.args) == 3 and self.args[0] == "repo-add":
|
||||
Repo().add(self.args[1], self.args[2])
|
||||
|
@ -193,7 +193,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def command_repo_remove(self):
|
||||
"""Remove custom repositories
|
||||
"""Removes custom repositories
|
||||
"""
|
||||
if len(self.args) == 2 and self.args[0] == "repo-remove":
|
||||
Repo().remove(self.args[1])
|
||||
|
@ -214,7 +214,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def command_health(self):
|
||||
"""Check package health
|
||||
"""Checks package health
|
||||
"""
|
||||
if len(self.args) == 1 and self.args[0] == "health":
|
||||
PackageHealth(mode="").test()
|
||||
|
@ -225,7 +225,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def command_deps_status(self):
|
||||
"""Print dependencies status
|
||||
"""Prints dependencies status
|
||||
"""
|
||||
image = ""
|
||||
|
||||
|
@ -247,7 +247,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def command_new_config(self):
|
||||
"""Manage .new configuration files
|
||||
"""Manages .new configuration files
|
||||
"""
|
||||
if len(self.args) == 1 and self.args[0] == "new-config":
|
||||
NewConfig().run()
|
||||
|
@ -307,7 +307,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def pkg_upgrade(self):
|
||||
"""Check and upgrade packages by repository
|
||||
"""Checks and upgrade packages by repository
|
||||
"""
|
||||
options = [
|
||||
"-c",
|
||||
|
@ -322,7 +322,7 @@ class ArgParse(BlackList):
|
|||
]
|
||||
flag, skip = self.__pkg_upgrade_flags(flags)
|
||||
|
||||
# Remove --checklist flag from args so that works with
|
||||
# Removes --checklist flag from args so that works with
|
||||
# both conditions
|
||||
# if flags[3] in self.args:
|
||||
# self.args.remove(flags[3])
|
||||
|
@ -351,7 +351,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def __pkg_upgrade_flags(self, flags):
|
||||
"""Manage flags for package upgrade option
|
||||
"""Manages flags for the package upgrade option
|
||||
"""
|
||||
# Check for typos or unssuported flags
|
||||
for arg in self.args[2:]:
|
||||
|
@ -373,7 +373,7 @@ class ArgParse(BlackList):
|
|||
return flag, skip
|
||||
|
||||
def pkg_install(self):
|
||||
"""Install packages by repository
|
||||
"""Installs packages by repository
|
||||
"""
|
||||
flag = []
|
||||
options = [
|
||||
|
@ -451,7 +451,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def sbo_network(self):
|
||||
"""View slackbuilds packages
|
||||
"""Views slackbuilds packages
|
||||
"""
|
||||
flag = []
|
||||
options = [
|
||||
|
@ -479,7 +479,7 @@ class ArgParse(BlackList):
|
|||
usage("sbo", 1)
|
||||
|
||||
def pkg_blacklist(self):
|
||||
"""Manage blacklist packages
|
||||
"""Manages blacklist packages
|
||||
"""
|
||||
options = [
|
||||
"-b",
|
||||
|
@ -509,7 +509,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def pkg_queue(self):
|
||||
"""Manage packages in queue
|
||||
"""Manages packages in queue
|
||||
"""
|
||||
queue = QueuePkgs()
|
||||
options = [
|
||||
|
@ -555,7 +555,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def bin_install(self):
|
||||
"""Install Slackware binary packages
|
||||
"""Installs Slackware binary packages
|
||||
"""
|
||||
packages = self.args[1:]
|
||||
options = [
|
||||
|
@ -583,7 +583,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def bin_upgrade(self):
|
||||
"""Install-upgrade Slackware binary packages
|
||||
"""Installs, upgrades Slackware binary packages
|
||||
"""
|
||||
packages = self.args[1:]
|
||||
options = [
|
||||
|
@ -651,7 +651,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def bin_find(self):
|
||||
"""Find installed packages
|
||||
"""Finds installed packages
|
||||
"""
|
||||
flag = []
|
||||
options = [
|
||||
|
@ -681,7 +681,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def pkg_desc(self):
|
||||
"""Print slack-desc by repository
|
||||
"""Prints slack-desc by repository
|
||||
"""
|
||||
options = [
|
||||
"-p",
|
||||
|
@ -722,7 +722,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def pkg_find(self):
|
||||
"""Find packages from all enabled repositories
|
||||
"""Finds packages from all the enabled repositories
|
||||
"""
|
||||
flag = []
|
||||
options = [
|
||||
|
@ -743,7 +743,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def pkg_contents(self):
|
||||
"""Print packages contents
|
||||
"""Prints packages contents
|
||||
"""
|
||||
packages = self.args[1:]
|
||||
options = [
|
||||
|
@ -757,7 +757,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def congiguration(self):
|
||||
"""Manage slpkg configuration file
|
||||
"""Manages slpkg configuration file
|
||||
"""
|
||||
options = [
|
||||
"-g",
|
||||
|
@ -782,7 +782,7 @@ class ArgParse(BlackList):
|
|||
usage("", 1)
|
||||
|
||||
def auto_detect(self, args):
|
||||
"""Check for already Slackware binary packages exist
|
||||
"""Checks for already Slackware binary packages
|
||||
"""
|
||||
suffixes = [
|
||||
".tgz",
|
||||
|
|
|
@ -39,23 +39,15 @@ class Msg:
|
|||
self.endc = _meta_.color["ENDC"]
|
||||
|
||||
def pkg_not_found(self, bol, pkg, message, eol):
|
||||
"""Print message when package not found
|
||||
"""
|
||||
print(f"{bol}No such package {pkg}: {message}{eol}")
|
||||
|
||||
def pkg_found(self, prgnam):
|
||||
"""Print message when package found
|
||||
"""
|
||||
print(f"| Package {prgnam} is already installed")
|
||||
|
||||
def pkg_installed(self, pkg):
|
||||
"""Print message when package installed
|
||||
"""
|
||||
print(f"| Package {pkg} installed")
|
||||
|
||||
def build_FAILED(self, prgnam):
|
||||
"""Print error message if build failed
|
||||
"""
|
||||
self.template(78)
|
||||
print(f"| Some error on the package {prgnam} "
|
||||
f"[ {self.red}FAILED{self.endc} ]")
|
||||
|
@ -67,59 +59,41 @@ class Msg:
|
|||
print() # new line at end
|
||||
|
||||
def template(self, max_len):
|
||||
"""Print template
|
||||
"""
|
||||
print("+" + "=" * max_len)
|
||||
|
||||
def checking(self):
|
||||
"""Message checking
|
||||
"""
|
||||
print(f"{self.grey}Checking...{self.endc} ", end="", flush=True)
|
||||
|
||||
def reading(self):
|
||||
"""Message reading
|
||||
"""
|
||||
print(f"{self.grey}Reading package lists...{self.endc} ",
|
||||
end="", flush=True)
|
||||
|
||||
def resolving(self):
|
||||
"""Message resolving
|
||||
"""
|
||||
print(f"{self.grey}Resolving dependencies...{self.endc} ",
|
||||
end="", flush=True)
|
||||
|
||||
def done(self):
|
||||
"""Message done
|
||||
"""
|
||||
print(f"\b{self.green}Done{self.endc}\n", end="")
|
||||
|
||||
def pkg(self, count):
|
||||
"""Print singular plural
|
||||
"""
|
||||
message = "package"
|
||||
if count > 1:
|
||||
message = message + "s"
|
||||
return message
|
||||
|
||||
def not_found(self, if_upgrade):
|
||||
"""Message not found packages
|
||||
"""
|
||||
if if_upgrade:
|
||||
print("\nNot found packages for upgrade\n")
|
||||
else:
|
||||
print("\nNot found packages for installation\n")
|
||||
|
||||
def upg_inst(self, if_upgrade):
|
||||
"""Message installing or upgrading
|
||||
"""
|
||||
if not if_upgrade:
|
||||
print("Installing:")
|
||||
else:
|
||||
print("Upgrading:")
|
||||
|
||||
def answer(self):
|
||||
"""Message answer
|
||||
"""
|
||||
if self.meta.default_answer in ["y", "Y"]:
|
||||
answer = self.meta.default_answer
|
||||
else:
|
||||
|
@ -130,8 +104,6 @@ class Msg:
|
|||
return answer
|
||||
|
||||
def security_pkg(self, pkg):
|
||||
"""Warning message for some special reasons
|
||||
"""
|
||||
print()
|
||||
self.template(78)
|
||||
print(f"| {' ' * 27}{self.red}*** WARNING ***{self.endc}")
|
||||
|
@ -143,9 +115,6 @@ class Msg:
|
|||
print()
|
||||
|
||||
def reference(self, install, upgrade):
|
||||
"""Reference list with packages installed
|
||||
and upgraded
|
||||
"""
|
||||
self.template(78)
|
||||
print(f"| Total {len(install)} {self.pkg(len(install))} installed and "
|
||||
f"{len(upgrade)} {self.pkg(len(upgrade))} upgraded")
|
||||
|
@ -159,8 +128,6 @@ class Msg:
|
|||
print()
|
||||
|
||||
def matching(self, packages):
|
||||
"""Message for matching packages
|
||||
"""
|
||||
print(f"\nNot found package with the name "
|
||||
f"[ {self.cyan}{''.join(packages)}{self.endc} ]. "
|
||||
"Matching packages:\nNOTE: Not dependencies are resolved\n")
|
||||
|
|
|
@ -32,7 +32,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
class NewConfig(Utils):
|
||||
"""Manage .new configuration files
|
||||
"""Manages .new configuration files
|
||||
"""
|
||||
def __init__(self):
|
||||
self.meta = _meta_
|
||||
|
@ -47,7 +47,7 @@ class NewConfig(Utils):
|
|||
self.news = []
|
||||
|
||||
def run(self):
|
||||
"""print .new configuration files
|
||||
"""prints .new configuration files
|
||||
"""
|
||||
self.find_new()
|
||||
for n in self.news:
|
||||
|
@ -59,7 +59,7 @@ class NewConfig(Utils):
|
|||
self.choices()
|
||||
|
||||
def find_new(self):
|
||||
"""Find all '.new' files from /etc/ folder
|
||||
"""Finds all '.new' files from /etc/ folder
|
||||
and subfolders
|
||||
"""
|
||||
print("Search for .new configuration files:\n")
|
||||
|
@ -97,14 +97,14 @@ class NewConfig(Utils):
|
|||
self.prompt()
|
||||
|
||||
def overwrite_all(self):
|
||||
"""Overwrite all .new files and keep
|
||||
"""Overwrites all .new files and keep
|
||||
old with suffix .old
|
||||
"""
|
||||
for n in self.news:
|
||||
self._overwrite(n)
|
||||
|
||||
def remove_all(self):
|
||||
"""Remove all .new files
|
||||
"""Removes all .new files
|
||||
"""
|
||||
for n in self.news:
|
||||
self._remove(n)
|
||||
|
@ -131,7 +131,7 @@ class NewConfig(Utils):
|
|||
raise SystemExit("\n")
|
||||
|
||||
def question(self, n):
|
||||
"""Choose what do to file by file
|
||||
"""Chooses what do to file by file
|
||||
"""
|
||||
print()
|
||||
prompt_ask = input(f"{n} [K/O/R/D/M/Q]? ")
|
||||
|
@ -151,7 +151,7 @@ class NewConfig(Utils):
|
|||
self.quit()
|
||||
|
||||
def _remove(self, n):
|
||||
"""Remove one single file
|
||||
"""Removes one single file
|
||||
"""
|
||||
if os.path.isfile(n):
|
||||
os.remove(n)
|
||||
|
@ -159,7 +159,7 @@ class NewConfig(Utils):
|
|||
print(f"File '{n}' removed")
|
||||
|
||||
def _overwrite(self, n):
|
||||
"""Overwrite old file with new and keep file with suffix .old
|
||||
"""Overwrites old file with new and keep file with suffix .old
|
||||
"""
|
||||
if os.path.isfile(n[:-4]):
|
||||
shutil.copy2(n[:-4], n[:-4] + ".old")
|
||||
|
@ -174,7 +174,7 @@ class NewConfig(Utils):
|
|||
pass
|
||||
|
||||
def diff(self, n):
|
||||
"""Print the differences between the two files
|
||||
"""Prints the differences between the two files
|
||||
"""
|
||||
if os.path.isfile(n[:-4]):
|
||||
diff1 = self.read_file(n[:-4]).splitlines()
|
||||
|
@ -203,7 +203,7 @@ class NewConfig(Utils):
|
|||
lines.append(a)
|
||||
|
||||
def merge(self, n):
|
||||
"""Merge new file into old
|
||||
"""Merges new file into old
|
||||
"""
|
||||
if os.path.isfile(n[:-4]):
|
||||
old = self.read_file(n[:-4]).splitlines()
|
||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
class FindFromRepos:
|
||||
"""Find packages from all enabled repositories
|
||||
"""Finds packages from all enabled repositories
|
||||
"""
|
||||
def __init__(self):
|
||||
self.cache = ""
|
||||
|
@ -44,7 +44,7 @@ class FindFromRepos:
|
|||
self.endc = self.meta.color["ENDC"]
|
||||
|
||||
def find(self, pkg, flag):
|
||||
"""Start to find packages and print
|
||||
"""Starts to find packages and print
|
||||
"""
|
||||
print(f"Packages with name matching [ {self.cyan}"
|
||||
f"{', '.join(pkg)}{self.endc} ]\n")
|
||||
|
@ -78,8 +78,7 @@ class FindFromRepos:
|
|||
f"{self.count_repo} repositories.{self.endc}\n")
|
||||
|
||||
def sbo_version(self, repo, find):
|
||||
"""
|
||||
Add version to SBo packages
|
||||
"""Adds version to SBo packages
|
||||
"""
|
||||
ver = ""
|
||||
if repo == "sbo":
|
||||
|
|
|
@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
def delete_package(path, packages):
|
||||
"""Delete downloaded packages
|
||||
"""Deletes downloaded packages
|
||||
"""
|
||||
if _meta_.del_all in ["on", "ON"]:
|
||||
for pkg in packages:
|
||||
|
@ -38,7 +38,7 @@ def delete_package(path, packages):
|
|||
|
||||
|
||||
def delete_folder(folder):
|
||||
"""Delete folder with all files.
|
||||
"""Deletes folder with all files.
|
||||
"""
|
||||
if _meta_.del_folder in ["on", "ON"] and os.path.exists(folder):
|
||||
shutil.rmtree(folder)
|
||||
|
|
|
@ -31,7 +31,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
class RepoEnable(Utils):
|
||||
"""Read repositories.conf file and update with new enabled or
|
||||
"""Reads repositories.conf file and update with new enabled or
|
||||
disabled repositories
|
||||
"""
|
||||
def __init__(self):
|
||||
|
@ -77,7 +77,7 @@ Keys: SPACE select or deselect the highlighted repositories,
|
|||
self.reference()
|
||||
|
||||
def read_enabled(self):
|
||||
"""Read enable repositories
|
||||
"""Reads enabled repositories
|
||||
"""
|
||||
for line in self.conf.splitlines():
|
||||
line = line.lstrip()
|
||||
|
@ -89,7 +89,7 @@ Keys: SPACE select or deselect the highlighted repositories,
|
|||
self.tag_line = False
|
||||
|
||||
def read_disabled(self):
|
||||
"""Read disable repositories
|
||||
"""Reads disabled repositories
|
||||
"""
|
||||
for line in self.conf.splitlines():
|
||||
line = line.lstrip()
|
||||
|
|
|
@ -57,7 +57,7 @@ class RepoInfo(Utils):
|
|||
|
||||
def view(self, repo):
|
||||
"""
|
||||
View repository information
|
||||
Views repository information
|
||||
"""
|
||||
status = f"{self.red}disabled{self.endc}"
|
||||
self.form["Status:"] = status
|
||||
|
@ -109,7 +109,7 @@ class RepoInfo(Utils):
|
|||
print(f"{self.green}{key}{self.endc} {value}")
|
||||
|
||||
def repository_data(self, repo):
|
||||
"""Grap data packages
|
||||
"""Graps data packages
|
||||
"""
|
||||
sum_pkgs, size, unsize, last_upd = 0, [], [], ""
|
||||
f = f"{self.meta.lib_path}{repo}_repo/PACKAGES.TXT"
|
||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
class Repo(Utils):
|
||||
"""Manage repositories configuration files
|
||||
"""Manages repositories configuration files
|
||||
"""
|
||||
def __init__(self):
|
||||
self.meta = _meta_
|
||||
|
@ -43,7 +43,7 @@ class Repo(Utils):
|
|||
self.default_repository()
|
||||
|
||||
def add(self, repo, url):
|
||||
"""Write custom repository name and url in a file
|
||||
"""Writes custom repository name and url in a file
|
||||
"""
|
||||
repo_name = []
|
||||
if not url.endswith("/"):
|
||||
|
@ -67,7 +67,7 @@ class Repo(Utils):
|
|||
print(f"\nRepository '{repo}' successfully added\n")
|
||||
|
||||
def remove(self, repo):
|
||||
"""Remove custom repository
|
||||
"""Removes custom repository
|
||||
"""
|
||||
rem_repo = False
|
||||
with open(self.custom_repo_file, "w") as repos:
|
||||
|
@ -83,7 +83,7 @@ class Repo(Utils):
|
|||
print(f"\nRepository '{repo}' doesn't exist\n")
|
||||
|
||||
def custom_repository(self):
|
||||
"""Return dictionary with repo name and url (used external)
|
||||
"""Returns dictionary with repo name and url (used external)
|
||||
"""
|
||||
custom_dict_repo = {}
|
||||
for line in self.custom_repositories_list.splitlines():
|
||||
|
@ -93,7 +93,7 @@ class Repo(Utils):
|
|||
return custom_dict_repo
|
||||
|
||||
def default_repository(self):
|
||||
"""Return dictionary with default repo name and url
|
||||
"""Returns dictionary with default repo name and url
|
||||
"""
|
||||
default_dict_repo = {}
|
||||
for line in self.default_repositories_list.splitlines():
|
||||
|
|
|
@ -27,7 +27,7 @@ from slpkg.messages import Msg
|
|||
|
||||
|
||||
def pkg_security(pkgs):
|
||||
"""Check packages before install or upgrade for security
|
||||
"""Checks packages before installing or upgrading for security
|
||||
reasons. Configuration file in the /etc/slpkg/pkg_security"""
|
||||
packages, msg, utils = [], Msg(), Utils()
|
||||
security_packages = utils.read_file("/etc/slpkg/pkg_security")
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
def units(comp_sum, uncomp_sum):
|
||||
"""Calculate package size
|
||||
"""Calculates package size
|
||||
"""
|
||||
compressed = round((sum(map(float, comp_sum)) / 1024), 2)
|
||||
uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2)
|
||||
|
|
|
@ -35,8 +35,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
def it_self_update():
|
||||
"""Check from GitLab slpkg repository if new version is available
|
||||
download and update itself
|
||||
"""Checks from GitLab slpkg repository if a new version is available
|
||||
"""
|
||||
__new_version__ = ""
|
||||
repository = "gitlab"
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
|
||||
def split_package(package):
|
||||
"""
|
||||
Split package in name, version
|
||||
"""Splits package in name, version
|
||||
arch and build tag.
|
||||
"""
|
||||
name = ver = arch = build = []
|
||||
|
|
|
@ -34,7 +34,7 @@ from slpkg.pkg.find import find_package
|
|||
|
||||
|
||||
class DependenciesStatus(Utils):
|
||||
"""Print dependencies status used by packages
|
||||
"""Prints dependencies status used by packages
|
||||
"""
|
||||
def __init__(self, image):
|
||||
self.image = image
|
||||
|
@ -53,7 +53,7 @@ class DependenciesStatus(Utils):
|
|||
self.installed = find_package("", self.meta.pkg_path)
|
||||
|
||||
def data(self):
|
||||
"""Check all installed packages and create
|
||||
"""Checks all installed packages and create
|
||||
dictionary database
|
||||
"""
|
||||
for pkg in self.installed:
|
||||
|
@ -72,7 +72,7 @@ class DependenciesStatus(Utils):
|
|||
self.count_packages()
|
||||
|
||||
def count_packages(self):
|
||||
"""Count dependencies and packages
|
||||
"""Counts dependencies and packages
|
||||
"""
|
||||
packages = []
|
||||
for pkg in self.dmap.values():
|
||||
|
|
|
@ -27,14 +27,14 @@ import getpass
|
|||
|
||||
|
||||
def s_user():
|
||||
"""Check for root user
|
||||
"""Checks for root user
|
||||
"""
|
||||
if getpass.getuser() != "root":
|
||||
raise SystemExit("\nslpkg: Error: Must have root privileges\n")
|
||||
|
||||
|
||||
def virtual_env():
|
||||
"""Check if a virtual enviroment exists
|
||||
"""Checks if a virtual enviroment exists
|
||||
"""
|
||||
if "VIRTUAL_ENV" in os.environ.keys():
|
||||
raise SystemExit("\nslpkg: Error: Please exit from virtual "
|
||||
|
|
|
@ -39,9 +39,9 @@ from slpkg.binary.dependency import Dependencies
|
|||
|
||||
|
||||
class TrackingDeps(BlackList, Utils):
|
||||
"""View tree of dependencies and also
|
||||
highlight packages with color green
|
||||
if already installed and color red
|
||||
"""Views tree of dependencies and also
|
||||
highlights packages with the colour green
|
||||
if already installed and the colour red
|
||||
if not installed.
|
||||
"""
|
||||
def __init__(self, name, repo, flag):
|
||||
|
@ -71,7 +71,7 @@ class TrackingDeps(BlackList, Utils):
|
|||
self.flag[i] = "--graph="
|
||||
|
||||
def run(self):
|
||||
"""Run tracking dependencies
|
||||
"""Runs tracking dependencies
|
||||
"""
|
||||
self.msg.resolving()
|
||||
self.repositories()
|
||||
|
@ -124,7 +124,7 @@ class TrackingDeps(BlackList, Utils):
|
|||
raise SystemExit("\nNo package was found to match\n")
|
||||
|
||||
def repositories(self):
|
||||
"""Get dependencies by repositories
|
||||
"""Gets dependencies by repositories
|
||||
"""
|
||||
if self.repo == "sbo":
|
||||
self.sbo_case_insensitive()
|
||||
|
@ -169,7 +169,7 @@ class TrackingDeps(BlackList, Utils):
|
|||
Graph(self.image).dependencies(self.deps_dict)
|
||||
|
||||
def check_used(self, pkg):
|
||||
"""Check if dependencies used
|
||||
"""Checks if dependencies used
|
||||
"""
|
||||
used = []
|
||||
dep_path = f"{self.meta.log_path}dep/"
|
||||
|
@ -197,7 +197,7 @@ class TrackingDeps(BlackList, Utils):
|
|||
self.deps_dict[dep] = self.dimensional_list(deps)
|
||||
|
||||
def deps_used(self, pkg, used):
|
||||
"""Create dependencies dictionary
|
||||
"""Creates dependencies dictionary
|
||||
"""
|
||||
if find_package(f"{pkg}-", self.meta.pkg_path):
|
||||
if pkg not in self.deps_dict.values():
|
||||
|
|
|
@ -41,7 +41,7 @@ class URL:
|
|||
self.http = urllib3.PoolManager()
|
||||
|
||||
def get_request(self):
|
||||
"""Open url and read
|
||||
"""Opens url and read
|
||||
"""
|
||||
try:
|
||||
f = self.http.request('GET', self.link)
|
||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.splitting import split_package
|
|||
|
||||
|
||||
class Utils:
|
||||
"""Class with usefull utilities
|
||||
"""Class with useful utilities
|
||||
"""
|
||||
def case_sensitive(self, lst):
|
||||
"""Create dictionary from list with key in lower case
|
||||
|
@ -41,7 +41,7 @@ class Utils:
|
|||
return dictionary
|
||||
|
||||
def dimensional_list(self, lists):
|
||||
"""Create one dimensional list
|
||||
"""Creates one dimensional list
|
||||
"""
|
||||
one_list = []
|
||||
for lst in lists:
|
||||
|
@ -49,7 +49,7 @@ class Utils:
|
|||
return one_list
|
||||
|
||||
def remove_dbs(self, double):
|
||||
"""Remove double item from list
|
||||
"""Removes double item from list
|
||||
"""
|
||||
return list(OrderedDict.fromkeys(double))
|
||||
|
||||
|
@ -71,7 +71,7 @@ class Utils:
|
|||
yield split_package(line[14:].strip())[0]
|
||||
|
||||
def check_downloaded(self, path, downloaded):
|
||||
"""Check if files downloaded and return downloaded
|
||||
"""Checks if files downloaded and return downloaded
|
||||
packages
|
||||
"""
|
||||
for pkg in downloaded:
|
||||
|
@ -79,8 +79,8 @@ class Utils:
|
|||
yield pkg
|
||||
|
||||
def read_config(self, config):
|
||||
"""Read config file and returns first uncomment line
|
||||
and stop. Used for Slackware mirrors
|
||||
"""Reads config file and returns first uncomment line
|
||||
and stops. Used for Slackware mirrors
|
||||
"""
|
||||
for line in config.splitlines():
|
||||
line = line.lstrip()
|
||||
|
@ -107,6 +107,6 @@ class Utils:
|
|||
return "ISO-8859-1"
|
||||
|
||||
def debug(self, test):
|
||||
"""Function used for print some stuff for debugging
|
||||
"""A function used for print some stuff for debugging
|
||||
"""
|
||||
print(test)
|
||||
|
|
|
@ -26,7 +26,7 @@ from slpkg.__metadata__ import MetaData as m
|
|||
|
||||
|
||||
def prog_version():
|
||||
"""Print version, license and email
|
||||
"""Prints version, license and email
|
||||
"""
|
||||
print(f"Version : {m.__version__}\n"
|
||||
f"Licence : {m.__license__}\n"
|
||||
|
|
Loading…
Reference in a new issue