mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-20 10:26:44 +01:00
Fixed typos
This commit is contained in:
parent
caafd78aef
commit
c59dbc0b81
11 changed files with 65 additions and 75 deletions
|
@ -31,8 +31,7 @@ CURRENT = "current"
|
|||
|
||||
|
||||
def remove_repositories(repositories, default_repositories):
|
||||
"""
|
||||
Remove no default repositories
|
||||
"""Removes no default repositories
|
||||
"""
|
||||
for repo in repositories:
|
||||
if repo in default_repositories:
|
||||
|
@ -40,8 +39,7 @@ def remove_repositories(repositories, default_repositories):
|
|||
|
||||
|
||||
def update_repositories(repositories, conf_path):
|
||||
"""
|
||||
Upadate with user custom repositories
|
||||
"""Upadate with user custom repositories
|
||||
"""
|
||||
repo_file = f"{conf_path}custom-repositories"
|
||||
if os.path.isfile(repo_file):
|
||||
|
@ -56,8 +54,7 @@ def update_repositories(repositories, conf_path):
|
|||
|
||||
|
||||
def grab_sub_repo(repositories, repos):
|
||||
"""
|
||||
Grab SUB_REPOSITORY
|
||||
"""Grabs SUB_REPOSITORY
|
||||
"""
|
||||
for i, repo in enumerate(repositories):
|
||||
if repos in repo:
|
||||
|
@ -68,8 +65,7 @@ def grab_sub_repo(repositories, repos):
|
|||
|
||||
|
||||
def select_slack_release(slack_rel):
|
||||
"""
|
||||
Warning message if Slackware release not defined or
|
||||
"""Warning message if Slackware release not defined or
|
||||
defined wrong
|
||||
"""
|
||||
if slack_rel not in [STABLE, CURRENT]:
|
||||
|
@ -137,7 +133,7 @@ class MetaData:
|
|||
"slonly", "ktown", "multi", "slacke", "salix",
|
||||
"slackl", "rested", "msb", "csb", "connos", "mles"]
|
||||
|
||||
# read value from configuration file
|
||||
# reads values from the configuration file
|
||||
repositories = []
|
||||
for files in ["slpkg.conf", "repositories.conf"]:
|
||||
if os.path.isfile(f"{conf_path}{files}"):
|
||||
|
@ -152,7 +148,7 @@ class MetaData:
|
|||
elif files == "repositories.conf":
|
||||
repositories.append(line)
|
||||
|
||||
# Set values from configuration file
|
||||
# Sets values from the configuration file
|
||||
slack_rel = _conf_slpkg["RELEASE"]
|
||||
slackware_version = _conf_slpkg["SLACKWARE_VERSION"]
|
||||
comp_arch = _conf_slpkg["COMP_ARCH"]
|
||||
|
@ -183,22 +179,22 @@ class MetaData:
|
|||
# SBo downloading sources path
|
||||
SBo_SOURCES = build_path + "_SOURCES/"
|
||||
|
||||
# Remove any gaps
|
||||
# Removes any gaps
|
||||
repositories = [repo.strip() for repo in repositories]
|
||||
|
||||
# Check Slackware release
|
||||
# Checks Slackware release
|
||||
slack_rel = select_slack_release(slack_rel)
|
||||
|
||||
# Grap sub repositories
|
||||
# Grabs sub repositories
|
||||
ktown_kde_repo = grab_sub_repo(repositories, "ktown")
|
||||
slacke_sub_repo = grab_sub_repo(repositories, "slacke")
|
||||
msb_sub_repo = grab_sub_repo(repositories, "msb")
|
||||
mles_sub_repo = grab_sub_repo(repositories, "mles")
|
||||
|
||||
# remove no default repositories
|
||||
# removes no default repositories
|
||||
repositories = list(remove_repositories(repositories,
|
||||
default_repositories))
|
||||
# add custom repositories
|
||||
# adds custom repositories
|
||||
update_repositories(repositories, conf_path)
|
||||
|
||||
color = {
|
||||
|
@ -250,7 +246,7 @@ class MetaData:
|
|||
else:
|
||||
arch = comp_arch
|
||||
|
||||
# get sbo OUTPUT enviroment variable
|
||||
# gets sbo OUTPUT enviroment variable
|
||||
try:
|
||||
output = os.environ["OUTPUT"]
|
||||
except KeyError:
|
||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.pkg.manager import PackageManager
|
|||
|
||||
|
||||
class AutoInstall:
|
||||
"""Select Slackware command to install packages
|
||||
"""Select the Slackware command to install packages
|
||||
"""
|
||||
def __init__(self, packages):
|
||||
self.packages = packages
|
||||
|
@ -69,7 +69,7 @@ class AutoInstall:
|
|||
self.execute()
|
||||
|
||||
def execute(self):
|
||||
"""Execute Slackware command
|
||||
"""Executes Slackware command
|
||||
"""
|
||||
if self.choice in self.commands.keys():
|
||||
if self.choice == "i":
|
||||
|
|
|
@ -40,7 +40,7 @@ class Dependencies:
|
|||
self.meta = _meta_
|
||||
|
||||
def binary(self, name, flag):
|
||||
"""Build all dependencies of a package
|
||||
"""Builds all dependencies of a package
|
||||
"""
|
||||
if self.meta.rsl_deps in ["on", "ON"] and "--resolve-off" not in flag:
|
||||
sys.setrecursionlimit(10000)
|
||||
|
|
|
@ -31,7 +31,7 @@ from slpkg.slack.slack_version import slack_ver
|
|||
|
||||
|
||||
def repo_data(PACKAGES_TXT, repo, flag):
|
||||
"""Grap data packages
|
||||
"""Grabs data packages
|
||||
"""
|
||||
(name, location, size, unsize,
|
||||
rname, rlocation, rsize, runsize) = ([] for i in range(8))
|
||||
|
@ -180,7 +180,7 @@ class Requires:
|
|||
self.repo = repo
|
||||
|
||||
def get_deps(self):
|
||||
"""Grap package requirements from repositories
|
||||
"""Grabs package requirements from repositories
|
||||
"""
|
||||
if self.repo == "rlw":
|
||||
dependencies = {}
|
||||
|
|
|
@ -49,7 +49,7 @@ from slpkg.binary.dependency import Dependencies
|
|||
|
||||
|
||||
class BinaryInstall(BlackList, Utils):
|
||||
"""Install binaries packages with all dependencies from
|
||||
"""Installs binaries packages with all dependencies from
|
||||
repository
|
||||
"""
|
||||
def __init__(self, packages, repo, flag):
|
||||
|
@ -94,8 +94,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
self.tmp_path += "/"
|
||||
|
||||
def start(self, is_upgrade):
|
||||
"""
|
||||
Install packages from official Slackware distribution
|
||||
"""Installs packages from official Slackware distribution
|
||||
"""
|
||||
self.case_insensitive()
|
||||
# fix if packages is for upgrade
|
||||
|
@ -175,7 +174,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
raise SystemExit(1)
|
||||
|
||||
def if_all_installed(self):
|
||||
"""Check if all packages is already installed
|
||||
"""Checks if all packages is already installed
|
||||
"""
|
||||
count_inst = 0
|
||||
for inst in (self.dep_install + self.install):
|
||||
|
@ -200,7 +199,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
self.packages[index] = value
|
||||
|
||||
def update_deps(self):
|
||||
"""Update dependencies dictionary with all package
|
||||
"""Updates dependencies dictionary with all package
|
||||
"""
|
||||
for dep in self.dependencies:
|
||||
deps = self.dimensional_list(Dependencies(
|
||||
|
@ -219,7 +218,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
self.packages = packages
|
||||
|
||||
def install_packages(self):
|
||||
"""Install or upgrade packages
|
||||
"""Installs or upgrades packages
|
||||
"""
|
||||
installs, upgraded = [], []
|
||||
for inst in (self.dep_install + self.install):
|
||||
|
@ -259,7 +258,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
check_md5(pkg_checksum(install, self.repo), self.tmp_path + install)
|
||||
|
||||
def resolving_deps(self):
|
||||
"""Return package dependencies
|
||||
"""Returns package dependencies
|
||||
"""
|
||||
requires = []
|
||||
if (self.meta.rsl_deps in ["on", "ON"] and
|
||||
|
@ -274,7 +273,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
return self.remove_dbs(requires)
|
||||
|
||||
def _fix_deps_repos(self, dependencies):
|
||||
"""Fix store deps include in repository
|
||||
"""Fixes store deps include in the repository
|
||||
"""
|
||||
for dep in dependencies:
|
||||
if dep in self.repo_pkg_names:
|
||||
|
@ -311,7 +310,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
return [pkg_sum, res_sum, upg_sum, uni_sum]
|
||||
|
||||
def top_view(self):
|
||||
"""Print packages status bar
|
||||
"""Prints packages status bar
|
||||
"""
|
||||
self.msg.template(78)
|
||||
print(f"| Package{' ' * 17}New Version{' ' * 8}Arch{' ' * 4}"
|
||||
|
@ -319,7 +318,7 @@ class BinaryInstall(BlackList, Utils):
|
|||
self.msg.template(78)
|
||||
|
||||
def store(self, packages):
|
||||
"""Store and return packages for install
|
||||
"""Stores and returns packages for install
|
||||
"""
|
||||
dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
|
||||
# name = data[0]
|
||||
|
|
|
@ -31,7 +31,7 @@ from slpkg.slack.slack_version import slack_ver
|
|||
|
||||
|
||||
class RepoInit(Utils):
|
||||
"""Return PACKAGES.TXT and mirror by repository
|
||||
"""Returns PACKAGES.TXT and mirror by repository
|
||||
"""
|
||||
def __init__(self, repo):
|
||||
self.repo = repo
|
||||
|
|
|
@ -28,7 +28,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
def search_pkg(name, repo):
|
||||
"""Search if package exists in PACKAGES.TXT file
|
||||
"""Searching if the package exists in PACKAGES.TXT file
|
||||
and return the name.
|
||||
"""
|
||||
utils = Utils()
|
||||
|
|
|
@ -41,7 +41,7 @@ from slpkg.sbo.greps import SBoGrep
|
|||
|
||||
|
||||
class BuildPackage(Utils):
|
||||
"""Build SBo packages from source
|
||||
"""Builds SBo packages from source
|
||||
"""
|
||||
def __init__(self, script, sources, path, auto):
|
||||
self.script = script
|
||||
|
@ -66,10 +66,9 @@ class BuildPackage(Utils):
|
|||
os.mkdir(self.build_logs)
|
||||
|
||||
def build(self):
|
||||
"""
|
||||
Build package from source and create log
|
||||
"""Builds package from source and creates log
|
||||
file in path /var/log/slpkg/sbo/build_logs/.
|
||||
Also check md5sum calculates.
|
||||
Also checks the md5sum calculation.
|
||||
"""
|
||||
try:
|
||||
self._delete_dir()
|
||||
|
@ -115,7 +114,7 @@ class BuildPackage(Utils):
|
|||
self.msg.pkg_not_found("\n", self.prgnam, "Wrong file", "\n")
|
||||
|
||||
def _check_sources(self):
|
||||
"""Fix filenames with char +
|
||||
"""Fixes filenames with char +
|
||||
"""
|
||||
new_sources = []
|
||||
for src in self.sources:
|
||||
|
@ -123,7 +122,7 @@ class BuildPackage(Utils):
|
|||
self.sources = new_sources
|
||||
|
||||
def _create_md5_dict(self):
|
||||
"""Create md5 dictionary per source
|
||||
"""Creates md5 dictionary per source
|
||||
"""
|
||||
self.sbo_md5 = {}
|
||||
md5_lists = SBoGrep(self.prgnam).checksum()
|
||||
|
@ -131,7 +130,7 @@ class BuildPackage(Utils):
|
|||
self.sbo_md5[src] = md5
|
||||
|
||||
def _makeflags(self):
|
||||
"""Set variable MAKEFLAGS with the numbers of
|
||||
"""Sets variable MAKEFLAGS with the numbers of
|
||||
processors
|
||||
"""
|
||||
if self.meta.makeflags in ["on", "ON"]:
|
||||
|
@ -139,7 +138,7 @@ class BuildPackage(Utils):
|
|||
os.environ["MAKEFLAGS"] = f"-j{cpus}"
|
||||
|
||||
def _pass_variable(self):
|
||||
"""Return enviroment variables
|
||||
"""Returns enviroment variables
|
||||
"""
|
||||
pass_var = []
|
||||
for var in os.environ.keys():
|
||||
|
@ -149,21 +148,20 @@ class BuildPackage(Utils):
|
|||
return pass_var
|
||||
|
||||
def _delete_sbo_tar_gz(self):
|
||||
"""Delete slackbuild tar.gz file after untar
|
||||
"""Deletes slackbuild tar.gz file after untar
|
||||
"""
|
||||
if not self.auto and os.path.isfile(self.meta.build_path + self.script):
|
||||
os.remove(self.meta.build_path + self.script)
|
||||
|
||||
def _delete_dir(self):
|
||||
"""Delete old folder if exists before start build
|
||||
"""Deletes old folder if exists before start build
|
||||
"""
|
||||
if not self.auto and os.path.isdir(self.meta.build_path + self.prgnam):
|
||||
shutil.rmtree(self.meta.build_path + self.prgnam)
|
||||
|
||||
|
||||
def log_head(path, log_file, log_time):
|
||||
"""
|
||||
write headers to log file
|
||||
"""Writes headers to log file
|
||||
"""
|
||||
with open(path + log_file, "w") as log:
|
||||
log.write("#" * 79 + "\n\n")
|
||||
|
@ -175,8 +173,7 @@ def log_head(path, log_file, log_time):
|
|||
|
||||
|
||||
def log_end(path, log_file, sum_time):
|
||||
"""
|
||||
append END tag to a log file
|
||||
"""Appends END tag to a log file
|
||||
"""
|
||||
with open(path + log_file, "a") as log:
|
||||
log.seek(2)
|
||||
|
@ -188,8 +185,7 @@ def log_end(path, log_file, sum_time):
|
|||
|
||||
|
||||
def build_time(start_time):
|
||||
"""
|
||||
Calculate build time per package
|
||||
"""Calculates build time per package
|
||||
"""
|
||||
diff_time = round(time.time() - start_time, 2)
|
||||
if diff_time <= 59.99:
|
||||
|
|
|
@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
|
|||
|
||||
|
||||
class GetFromInstalled:
|
||||
"""Find and return version and package name from
|
||||
"""Finds and returns version and package name from
|
||||
already installed packages
|
||||
"""
|
||||
def __init__(self, package):
|
||||
|
@ -42,14 +42,14 @@ class GetFromInstalled:
|
|||
self.find = file
|
||||
|
||||
def version(self):
|
||||
"""Return version from installed packages
|
||||
"""Returns version from installed packages
|
||||
"""
|
||||
if self.find:
|
||||
return split_package(self.find)[1]
|
||||
return self.find
|
||||
|
||||
def name(self):
|
||||
"""Return installed package name
|
||||
"""Returns installed package name
|
||||
"""
|
||||
if self.find:
|
||||
return self.package
|
||||
|
|
|
@ -58,7 +58,7 @@ class PackageManager(Utils):
|
|||
self.unit = "Kb"
|
||||
|
||||
def install(self, flag):
|
||||
"""Install Slackware binary packages
|
||||
"""Installs Slackware binary packages
|
||||
"""
|
||||
for pkg in self.binary:
|
||||
try:
|
||||
|
@ -73,7 +73,7 @@ class PackageManager(Utils):
|
|||
raise SystemExit(1)
|
||||
|
||||
def upgrade(self, flag):
|
||||
"""Upgrade Slackware binary packages with new
|
||||
"""Upgrades Slackware binary packages with new
|
||||
"""
|
||||
for pkg in self.binary:
|
||||
try:
|
||||
|
@ -95,7 +95,7 @@ class PackageManager(Utils):
|
|||
self.msg.pkg_not_found(bol, pkg, message, eol)
|
||||
|
||||
def remove(self, flag, extra):
|
||||
"""Remove Slackware binary packages
|
||||
"""Removes Slackware binary packages
|
||||
"""
|
||||
self.flag = flag
|
||||
self.extra = extra
|
||||
|
@ -120,10 +120,9 @@ class PackageManager(Utils):
|
|||
if remove_pkg in ["y", "Y"]:
|
||||
self._check_if_used(self.binary)
|
||||
for rmv in self.removed:
|
||||
'''
|
||||
If package build and install with "slpkg -s sbo <package>"
|
||||
then look log file for dependencies in /var/log/slpkg/dep,
|
||||
read and remove all else remove only the package.
|
||||
'''If package build and install with "slpkg -s sbo <package>"
|
||||
then looks in the log file for dependencies "/var/log/slpkg/dep",
|
||||
reads and removes all but remove only the package.
|
||||
'''
|
||||
if (os.path.isfile(self.dep_path + rmv) and
|
||||
self.meta.del_deps in ["on", "ON"] or
|
||||
|
@ -141,7 +140,7 @@ class PackageManager(Utils):
|
|||
self._reference_rmvs(rmv_list)
|
||||
|
||||
def _rmv_deps_answer(self):
|
||||
"""Remove dependencies answer
|
||||
"""Removes dependencies answer
|
||||
"""
|
||||
if self.meta.remove_deps_answer in ["y", "Y"]:
|
||||
remove_dep = self.meta.remove_deps_answer
|
||||
|
@ -156,7 +155,7 @@ class PackageManager(Utils):
|
|||
return remove_dep
|
||||
|
||||
def _get_removed(self):
|
||||
"""Manage removed packages by extra options
|
||||
"""Manages removed packages by extra options
|
||||
"""
|
||||
extra = self.extra
|
||||
removed, packages, pkg = [], [], ""
|
||||
|
@ -195,7 +194,7 @@ class PackageManager(Utils):
|
|||
return removed, packages
|
||||
|
||||
def _view_removed(self):
|
||||
"""View packages before removed
|
||||
"""Views packages before removed
|
||||
"""
|
||||
print("Packages with name matching [ {0}{1}{2} ]\n".format(
|
||||
self.cyan, ", ".join(self.binary), self.endc))
|
||||
|
@ -248,7 +247,7 @@ class PackageManager(Utils):
|
|||
self.grey, round(self.size, 2), self.unit, self.endc))
|
||||
|
||||
def _view_deps(self, path, package):
|
||||
"""View dependencies before remove
|
||||
"""Views dependencies before remove
|
||||
"""
|
||||
self.size = 0
|
||||
packages = []
|
||||
|
@ -297,7 +296,7 @@ class PackageManager(Utils):
|
|||
raise SystemExit(er)
|
||||
|
||||
def _rmv_deps(self, dependencies, package):
|
||||
"""Remove dependencies
|
||||
"""Removes dependencies
|
||||
"""
|
||||
removes = []
|
||||
dependencies.append(package)
|
||||
|
@ -310,7 +309,7 @@ class PackageManager(Utils):
|
|||
return removes
|
||||
|
||||
def _rmv_pkg(self, package):
|
||||
"""Remove one signle package
|
||||
"""Removes one signle package
|
||||
"""
|
||||
removes = []
|
||||
if GetFromInstalled(package).name() and package not in self.skip:
|
||||
|
@ -335,7 +334,7 @@ class PackageManager(Utils):
|
|||
self.removed.remove(s)
|
||||
|
||||
def _check_if_used(self, removes):
|
||||
"""Check package if dependencies for another package
|
||||
"""Checks package if dependencies for another package
|
||||
before removed"""
|
||||
if "--check-deps" in self.extra:
|
||||
package, dependency, pkg_dep = [], [], []
|
||||
|
@ -387,7 +386,7 @@ class PackageManager(Utils):
|
|||
print() # new line at end
|
||||
|
||||
def find(self, flag):
|
||||
"""Find installed Slackware packages
|
||||
"""Finds installed Slackware packages
|
||||
"""
|
||||
matching, packages = 0, []
|
||||
pkg_cache, match_cache = "", ""
|
||||
|
@ -447,7 +446,7 @@ class PackageManager(Utils):
|
|||
break
|
||||
|
||||
def display(self):
|
||||
"""Print the Slackware packages contents
|
||||
"""Prints the Slackware packages contents
|
||||
"""
|
||||
for pkg in self.binary:
|
||||
name = GetFromInstalled(pkg).name()
|
||||
|
@ -502,7 +501,7 @@ class PackageManager(Utils):
|
|||
raise SystemExit(1)
|
||||
|
||||
def _splitting_packages(self, pkg, repo, name):
|
||||
"""Return package name from repositories
|
||||
"""Returns package name from repositories
|
||||
"""
|
||||
if name and repo != "sbo":
|
||||
pkg = split_package(pkg)[0]
|
||||
|
@ -511,7 +510,7 @@ class PackageManager(Utils):
|
|||
return pkg
|
||||
|
||||
def list_greps(self, repo, packages):
|
||||
"""Grep packages
|
||||
"""Grabs packages
|
||||
"""
|
||||
pkg_list, pkg_size = [], []
|
||||
for line in packages.splitlines():
|
||||
|
@ -529,7 +528,7 @@ class PackageManager(Utils):
|
|||
return pkg_list, pkg_size
|
||||
|
||||
def list_lib(self, repo):
|
||||
"""Return package lists
|
||||
"""Returns package lists
|
||||
"""
|
||||
packages = ""
|
||||
if repo == "sbo":
|
||||
|
@ -545,7 +544,7 @@ class PackageManager(Utils):
|
|||
return packages
|
||||
|
||||
def list_color_tag(self, pkg):
|
||||
"""Tag with color installed packages
|
||||
"""Tag with colour installed packages
|
||||
"""
|
||||
name = GetFromInstalled(pkg).name()
|
||||
find = f"{name}-"
|
||||
|
@ -556,7 +555,7 @@ class PackageManager(Utils):
|
|||
return pkg
|
||||
|
||||
def list_of_installed(self, repo, name):
|
||||
"""Return installed packages
|
||||
"""Returns installed packages
|
||||
"""
|
||||
all_installed_names = []
|
||||
all_installed_packages = find_package("", self.meta.pkg_path)
|
||||
|
@ -573,7 +572,7 @@ class PackageManager(Utils):
|
|||
|
||||
|
||||
def alien_filter(packages, sizes):
|
||||
"""This filter avoid list double packages from
|
||||
"""This filter avoids listing double packages from
|
||||
alien repository
|
||||
"""
|
||||
cache, npkg, nsize = [], [], []
|
||||
|
|
|
@ -107,6 +107,6 @@ class Utils:
|
|||
return "ISO-8859-1"
|
||||
|
||||
def debug(self, test):
|
||||
"""A function used for print some stuff for debugging
|
||||
"""A function used to print some stuff for debugging
|
||||
"""
|
||||
print(test)
|
||||
|
|
Loading…
Reference in a new issue