Merge branch 'develop'

This commit is contained in:
Dimitris Zlatanidis 2019-12-08 19:46:10 +01:00
commit ac99c027cd
44 changed files with 68 additions and 67 deletions

View file

@ -74,7 +74,7 @@ def select_slack_release(slack_rel):
return slack_rel return slack_rel
class MetaData(object): class MetaData:
__all__ = "slpkg" __all__ = "slpkg"
__author__ = "dslackw" __author__ = "dslackw"

View file

@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.manager import PackageManager from slpkg.pkg.manager import PackageManager
class Auto(object): class Auto:
"""Select Slackware command to install packages """Select Slackware command to install packages
""" """
def __init__(self, packages): def __init__(self, packages):

View file

@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.binary.greps import Requires from slpkg.binary.greps import Requires
class Dependencies(object): class Dependencies:
"""Resolving binary dependencies """Resolving binary dependencies
""" """
def __init__(self, repo, black): def __init__(self, repo, black):

View file

@ -144,7 +144,7 @@ def ktown_filter(name, location, size, unsize):
return [fname, flocation, fsize, funsize] return [fname, flocation, fsize, funsize]
class Requires(object): class Requires:
def __init__(self, name, repo): def __init__(self, name, repo):
self.name = name self.name = name

View file

@ -50,7 +50,7 @@ from slpkg.binary.dependency import Dependencies
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
class BinaryInstall(object): class BinaryInstall:
"""Install binaries packages with all dependencies from """Install binaries packages with all dependencies from
repository repository
""" """

View file

@ -30,7 +30,7 @@ from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
class RepoInit(object): class RepoInit:
"""Return PACKAGES.TXT and mirror by repository """Return PACKAGES.TXT and mirror by repository
""" """
def __init__(self, repo): def __init__(self, repo):

View file

@ -29,7 +29,7 @@ from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class BlackList(object): class BlackList:
"""Blacklist class to add, remove or listed packages """Blacklist class to add, remove or listed packages
in blacklist file.""" in blacklist file."""
def __init__(self): def __init__(self):

View file

@ -28,7 +28,7 @@ from slpkg.init import Initialization
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class Updates(object): class Updates:
"""Checking for news in ChangeLog.txt """Checking for news in ChangeLog.txt
""" """
def __init__(self, repo): def __init__(self, repo):

View file

@ -30,7 +30,7 @@ from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class Config(object): class Config:
"""Print or edit slpkg configuration file """Print or edit slpkg configuration file
""" """
def __init__(self): def __init__(self):

View file

@ -29,7 +29,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.sbo.greps import SBoGrep from slpkg.sbo.greps import SBoGrep
class PkgDesc(object): class PkgDesc:
"""Print package description from the repository """Print package description from the repository
""" """
def __init__(self, name, repo, paint): def __init__(self, name, repo, paint):

View file

@ -27,7 +27,7 @@ from __future__ import unicode_literals
import os import os
class DialogUtil(object): class DialogUtil:
"""Create dialog checklist """Create dialog checklist
""" """
def __init__(self, *args): def __init__(self, *args):

View file

@ -32,7 +32,7 @@ from slpkg.slack.slack_version import slack_ver
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class Download(object): class Download:
"""Downloader manager. Slpkg use wget by default but support """Downloader manager. Slpkg use wget by default but support
curl, aria2 and httpie curl, aria2 and httpie
""" """

View file

@ -26,7 +26,7 @@ import os
import requests import requests
class FileSize(object): class FileSize:
"""Check local or remote file size """Check local or remote file size
""" """
def __init__(self, registry): def __init__(self, registry):

View file

@ -26,7 +26,7 @@ import os
import subprocess import subprocess
class Graph(object): class Graph:
"""Drawing dependencies diagram """Drawing dependencies diagram
""" """
def __init__(self, image): def __init__(self, image):

View file

@ -30,7 +30,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
class PackageHealth(object): class PackageHealth:
"""Health check installed packages """Health check installed packages
""" """
def __init__(self, mode): def __init__(self, mode):

View file

@ -34,7 +34,7 @@ from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
class Initialization(object): class Initialization:
"""Slpkg initialization start all from here. Create local """Slpkg initialization start all from here. Create local
package lists and update or upgrade these. package lists and update or upgrade these.
""" """

View file

@ -57,7 +57,7 @@ def library(repo):
return pkg_list return pkg_list
class Regex(object): class Regex:
"""Grap packages with simple regex using asterisk * """Grap packages with simple regex using asterisk *
with options: starts with string* with options: starts with string*
ends with *string ends with *string

View file

@ -44,4 +44,3 @@ def write_deps(deps_dict):
with open(dep_path + name, "w") as f: with open(dep_path + name, "w") as f:
for dep in dependencies: for dep in dependencies:
f.write(dep + "\n") f.write(dep + "\n")
f.close()

View file

@ -66,7 +66,7 @@ from slpkg.binary.check import pkg_upgrade
from slpkg.binary.install import BinaryInstall from slpkg.binary.install import BinaryInstall
class ArgParse(object): class ArgParse:
def __init__(self, args): def __init__(self, args):
self.args = args self.args = args

View file

@ -27,7 +27,7 @@ import itertools
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class Msg(object): class Msg:
"""Messages control """Messages control
""" """
def __init__(self): def __init__(self):
@ -70,22 +70,22 @@ class Msg(object):
"""Message checking """Message checking
""" """
print("{0}Checking...{1} ".format(self.meta.color["GREY"], print("{0}Checking...{1} ".format(self.meta.color["GREY"],
self.meta.color["ENDC"]), end="") self.meta.color["ENDC"]), end="",
print(end="", flush=True) flush=True)
def reading(self): def reading(self):
"""Message reading """Message reading
""" """
print("{0}Reading package lists...{1} ".format( print("{0}Reading package lists...{1} ".format(
self.meta.color["GREY"], self.meta.color["ENDC"]), end="") self.meta.color["GREY"], self.meta.color["ENDC"]), end="",
print(end="", flush=True) flush=True)
def resolving(self): def resolving(self):
"""Message resolving """Message resolving
""" """
print("{0}Resolving dependencies...{1} ".format( print("{0}Resolving dependencies...{1} ".format(
self.meta.color["GREY"], self.meta.color["ENDC"]), end="") self.meta.color["GREY"], self.meta.color["ENDC"]), end="",
print(end="", flush=True) flush=True)
def done(self): def done(self):
"""Message done """Message done

View file

@ -31,7 +31,7 @@ from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class NewConfig(object): class NewConfig:
"""Manage .new configuration files """Manage .new configuration files
""" """
def __init__(self): def __init__(self):
@ -187,15 +187,15 @@ class NewConfig(object):
diff1 = Utils().read_file(n[:-4]).splitlines() diff1 = Utils().read_file(n[:-4]).splitlines()
if os.path.isfile(n): if os.path.isfile(n):
diff2 = Utils().read_file(n).splitlines() diff2 = Utils().read_file(n).splitlines()
lines, l, c = [], 0, 0 lines, ln, c = [], 0, 0
for a, b in itertools.izip_longest(diff1, diff2): for a, b in itertools.izip_longest(diff1, diff2):
l += 1 ln += 1
if a != b: if a != b:
for s1, s2 in itertools.izip_longest(str(a), str(b)): for s1, s2 in itertools.izip_longest(str(a), str(b)):
c += 1 c += 1
if s1 != s2: if s1 != s2:
break break
print("@@ -{0},{1} +{2},{3} @@\n".format(l, c, l, c)) print("@@ -{0},{1} +{2},{3} @@\n".format(ln, c, ln, c))
for line in lines[-3:]: for line in lines[-3:]:
print("{0}".format(line)) print("{0}".format(line))
if a is None: if a is None:

View file

@ -39,7 +39,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.sbo.greps import SBoGrep from slpkg.sbo.greps import SBoGrep
class BuildPackage(object): class BuildPackage:
"""Build SBo packages from source """Build SBo packages from source
""" """
def __init__(self, script, sources, path, auto): def __init__(self, script, sources, path, auto):

View file

@ -28,7 +28,7 @@ from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class GetFromInstalled(object): class GetFromInstalled:
"""Find and return version and package name from """Find and return version and package name from
already installed packages already installed packages
""" """

View file

@ -39,7 +39,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.slack.slackware_repo import slackware_repository from slpkg.slack.slackware_repo import slackware_repository
class PackageManager(object): class PackageManager:
"""Package manager class for install, upgrade, """Package manager class for install, upgrade,
reinstall, remove, find and display packages""" reinstall, remove, find and display packages"""
def __init__(self, binary): def __init__(self, binary):
@ -520,9 +520,9 @@ class PackageManager(object):
self.meta.color["ENDC"], pkg)) self.meta.color["ENDC"], pkg))
if index == page: if index == page:
read = input("\nPress {0}Enter{1} to " read = input("\nPress {0}Enter{1} to "
"continue... ".format( "continue... ".format(
self.meta.color["CYAN"], self.meta.color["CYAN"],
self.meta.color["ENDC"])) self.meta.color["ENDC"]))
if read in ["Q", "q"]: if read in ["Q", "q"]:
break break
print() # new line after page print() # new line after page

View file

@ -28,7 +28,7 @@ from slpkg.pkg.manager import PackageManager
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class FindFromRepos(object): class FindFromRepos:
"""Find packages from all enabled repositories """Find packages from all enabled repositories
""" """
def __init__(self): def __init__(self):
@ -53,7 +53,8 @@ class FindFromRepos(object):
Msg().template(78) Msg().template(78)
for repo in _meta_.repositories: for repo in _meta_.repositories:
PACKAGES_TXT = PackageManager(pkg).list_lib(repo) PACKAGES_TXT = PackageManager(pkg).list_lib(repo)
packages, sizes = PackageManager(pkg).list_greps(repo, PACKAGES_TXT) packages, sizes = PackageManager(pkg).list_greps(repo,
PACKAGES_TXT)
for find, size in zip(packages, sizes): for find, size in zip(packages, sizes):
for p in pkg: for p in pkg:
if "--case-ins" in flag: if "--case-ins" in flag:

View file

@ -30,7 +30,7 @@ from slpkg.dialog_box import DialogUtil
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class RepoEnable(object): class RepoEnable:
"""Read repositories.conf file and update with new enabled or """Read repositories.conf file and update with new enabled or
disabled repositories disabled repositories
""" """

View file

@ -31,7 +31,7 @@ from slpkg.repolist import RepoList
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class RepoInfo(object): class RepoInfo:
"""Repository information """Repository information
""" """
def __init__(self): def __init__(self):
@ -78,8 +78,8 @@ class RepoInfo(object):
self.form["Number of packages:"] = data[0] self.form["Number of packages:"] = data[0]
self.form["Status:"] = status self.form["Status:"] = status
self.form["Last updated:"] = data[3] self.form["Last updated:"] = data[3]
elif (repo == "sbo" and os.path.isfile(self.meta.lib_path + "{0}_repo/" elif (repo == "sbo" and os.path.isfile(
"SLACKBUILDS.TXT".format(repo))): self.meta.lib_path + "{0}_repo/SLACKBUILDS.TXT".format(repo))):
status = "{0}enabled{1}".format(self.meta.color["GREEN"], status = "{0}enabled{1}".format(self.meta.color["GREEN"],
self.meta.color["ENDC"]) self.meta.color["ENDC"])
sum_sbo_pkgs = 0 sum_sbo_pkgs = 0
@ -100,7 +100,8 @@ class RepoInfo(object):
self.form["Last updated:"] = last_upd self.form["Last updated:"] = last_upd
print() print()
for key, value in sorted(self.form.items()): for key, value in sorted(self.form.items()):
print(self.meta.color["GREY"] + key + self.meta.color["ENDC"], value) print(self.meta.color["GREY"] + key + self.meta.color["ENDC"],
value)
print() print()
raise SystemExit() raise SystemExit()
@ -109,8 +110,8 @@ class RepoInfo(object):
Grap data packages Grap data packages
""" """
sum_pkgs, size, unsize, last_upd = 0, [], [], "" sum_pkgs, size, unsize, last_upd = 0, [], [], ""
for line in (Utils().read_file( f = self.meta.lib_path + repo + "_repo/PACKAGES.TXT"
self.meta.lib_path + repo + "_repo/PACKAGES.TXT").splitlines()): for line in Utils().read_file(f).splitlines():
if line.startswith("PACKAGES.TXT;"): if line.startswith("PACKAGES.TXT;"):
last_upd = line[14:].strip() last_upd = line[14:].strip()
if line.startswith("PACKAGE NAME:"): if line.startswith("PACKAGE NAME:"):

View file

@ -27,7 +27,7 @@ from slpkg.repositories import Repo
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class RepoList(object): class RepoList:
"""List of repositories """List of repositories
""" """
def __init__(self): def __init__(self):

View file

@ -28,7 +28,7 @@ from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class Repo(object): class Repo:
"""Manage repositories configuration files """Manage repositories configuration files
""" """
def __init__(self): def __init__(self):
@ -36,7 +36,8 @@ class Repo(object):
self.DEFAULT_REPOS_NAMES = self.meta.default_repositories self.DEFAULT_REPOS_NAMES = self.meta.default_repositories
self.custom_repo_file = "/etc/slpkg/custom-repositories" self.custom_repo_file = "/etc/slpkg/custom-repositories"
self.default_repo_file = "/etc/slpkg/default-repositories" self.default_repo_file = "/etc/slpkg/default-repositories"
self.custom_repositories_list = Utils().read_file(self.custom_repo_file) self.custom_repositories_list = Utils().read_file(
self.custom_repo_file)
self.default_repositories_list = Utils().read_file( self.default_repositories_list = Utils().read_file(
self.default_repo_file) self.default_repo_file)
self.default_repository() self.default_repository()
@ -62,9 +63,9 @@ class Repo(object):
"six (6) characters\n") "six (6) characters\n")
raise SystemExit() raise SystemExit()
with open(self.custom_repo_file, "a") as repos: with open(self.custom_repo_file, "a") as repos:
new_line = " {0}{1}{2}\n".format(repo, " " * (10 - len(repo)), url) new_line = " {0}{1}{2}\n".format(repo, " " * (10 - len(repo)),
url)
repos.write(new_line) repos.write(new_line)
repos.close()
print("\nRepository '{0}' successfully added\n".format(repo)) print("\nRepository '{0}' successfully added\n".format(repo))
raise SystemExit() raise SystemExit()

View file

@ -29,7 +29,7 @@ from slpkg.pkg.build import BuildPackage
from slpkg.sbo.greps import SBoGrep from slpkg.sbo.greps import SBoGrep
class AutoBuild(object): class AutoBuild:
"""Autobuild package if sources and script is already """Autobuild package if sources and script is already
downloaded downloaded
""" """

View file

@ -29,7 +29,7 @@ from slpkg.url_read import URL
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class BuildNumber(object): class BuildNumber:
"""Get build number from SlackBuild script """Get build number from SlackBuild script
""" """
def __init__(self, sbo_url, pkg): def __init__(self, sbo_url, pkg):

View file

@ -22,7 +22,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
class SBoLink(object): class SBoLink:
"""Create slackbuild tar.gz archive from url """Create slackbuild tar.gz archive from url
""" """
def __init__(self, sbo_url): def __init__(self, sbo_url):

View file

@ -31,7 +31,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.sbo.greps import SBoGrep from slpkg.sbo.greps import SBoGrep
class Requires(object): class Requires:
"""Resolving SBo dependencies """Resolving SBo dependencies
""" """
def __init__(self, flag): def __init__(self, flag):

View file

@ -26,7 +26,7 @@ from slpkg.utils import Utils
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class SBoGrep(object): class SBoGrep:
"""Grab data from SLACKBUILDS.TXT file """Grab data from SLACKBUILDS.TXT file
""" """
def __init__(self, name): def __init__(self, name):

View file

@ -49,7 +49,7 @@ from slpkg.sbo.slack_find import slack_package
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
class SBoNetwork(object): class SBoNetwork:
"""View SBo site in terminal and also read, build or """View SBo site in terminal and also read, build or
install packages install packages
""" """

View file

@ -39,7 +39,7 @@ from slpkg.sbo.search import sbo_search_pkg
from slpkg.sbo.slack_find import slack_package from slpkg.sbo.slack_find import slack_package
class QueuePkgs(object): class QueuePkgs:
"""Manage SBo packages, add or remove for building or """Manage SBo packages, add or remove for building or
installation installation
""" """

View file

@ -25,7 +25,7 @@
from slpkg.url_read import URL from slpkg.url_read import URL
class ReadSBo(object): class ReadSBo:
"""Read SBo files from urls """Read SBo files from urls
""" """
def __init__(self, sbo_url): def __init__(self, sbo_url):

View file

@ -25,7 +25,7 @@
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class SBoArch(object): class SBoArch:
"""Manage computer architecture for sbo repository """Manage computer architecture for sbo repository
""" """
def __init__(self): def __init__(self):

View file

@ -49,7 +49,7 @@ from slpkg.sbo.search import sbo_search_pkg
from slpkg.sbo.slack_find import slack_package from slpkg.sbo.slack_find import slack_package
class SBoInstall(object): class SBoInstall:
"""Build and install SBo packages with all dependencies """Build and install SBo packages with all dependencies
""" """
def __init__(self, slackbuilds, flag): def __init__(self, slackbuilds, flag):

View file

@ -51,7 +51,7 @@ from slpkg.slack.mirrors import mirrors
from slpkg.slack.slack_version import slack_ver from slpkg.slack.slack_version import slack_ver
class Patches(object): class Patches:
"""Upgrade distribution from official Slackware mirrors """Upgrade distribution from official Slackware mirrors
""" """
def __init__(self, skip, flag): def __init__(self, skip, flag):

View file

@ -34,7 +34,7 @@ from slpkg.__metadata__ import MetaData as _meta_
from slpkg.pkg.find import find_package from slpkg.pkg.find import find_package
class DependenciesStatus(object): class DependenciesStatus:
"""Print dependencies status used by packages """Print dependencies status used by packages
""" """
def __init__(self, image): def __init__(self, image):
@ -111,8 +111,7 @@ class DependenciesStatus(object):
for d in dep: for d in dep:
print("+-- {0}".format(d)) print("+-- {0}".format(d))
print("|") print("|")
print("\x1b[1A{0}\n".format(" "), end="") print("\x1b[1A{0}\n".format(" "), end="", flush=True)
print(end="", flush=True)
self.summary() self.summary()
if self.image: if self.image:
Graph(self.image).dependencies(self.dmap) Graph(self.image).dependencies(self.dmap)

View file

@ -38,7 +38,7 @@ from slpkg.binary.search import search_pkg
from slpkg.binary.dependency import Dependencies from slpkg.binary.dependency import Dependencies
class TrackingDeps(object): class TrackingDeps:
"""View tree of dependencies and also """View tree of dependencies and also
highlight packages with color green highlight packages with color green
if already installed and color red if already installed and color red

View file

@ -27,7 +27,7 @@ import requests
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class URL(object): class URL:
"""Urls reading class """Urls reading class
""" """
def __init__(self, link): def __init__(self, link):

View file

@ -27,7 +27,7 @@ import os
from slpkg.splitting import split_package from slpkg.splitting import split_package
class Utils(object): class Utils:
"""Class with usefull utilities """Class with usefull utilities
""" """
def case_sensitive(self, lst): def case_sensitive(self, lst):