mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-16 03:41:11 +01:00
Update toolbar status
This commit is contained in:
parent
056e60f64f
commit
711d47986c
11 changed files with 22 additions and 45 deletions
|
@ -88,7 +88,7 @@ class MetaData(object):
|
||||||
|
|
||||||
__all__ = "slpkg"
|
__all__ = "slpkg"
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
__version_info__ = (2, 5, 9)
|
__version_info__ = (2, 6, 0)
|
||||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||||
__email__ = "d.zlatanidis@gmail.com"
|
__email__ = "d.zlatanidis@gmail.com"
|
||||||
|
|
|
@ -49,10 +49,8 @@ def pkg_upgrade(repo, skip):
|
||||||
# size = data[2]
|
# size = data[2]
|
||||||
# unsize = data[3]
|
# unsize = data[3]
|
||||||
data = repo_data(PACKAGES_TXT, 2000, repo, flag="")
|
data = repo_data(PACKAGES_TXT, 2000, repo, flag="")
|
||||||
index, toolbar_width = 0, 1000
|
|
||||||
for pkg in installed():
|
for pkg in installed():
|
||||||
index += 1
|
status(0.00003)
|
||||||
toolbar_width = status(index, toolbar_width, 30)
|
|
||||||
inst_pkg = split_package(pkg)
|
inst_pkg = split_package(pkg)
|
||||||
for name in data[0]:
|
for name in data[0]:
|
||||||
if name: # this tips because some pkg_name is empty
|
if name: # this tips because some pkg_name is empty
|
||||||
|
|
|
@ -48,11 +48,9 @@ class Dependencies(object):
|
||||||
sys.setrecursionlimit(10000)
|
sys.setrecursionlimit(10000)
|
||||||
dependencies = []
|
dependencies = []
|
||||||
requires = Requires(name, self.repo).get_deps()
|
requires = Requires(name, self.repo).get_deps()
|
||||||
toolbar_width, index = 2, 0
|
|
||||||
if requires:
|
if requires:
|
||||||
for req in requires:
|
for req in requires:
|
||||||
index += 1
|
status(0)
|
||||||
toolbar_width = status(index, toolbar_width, 7)
|
|
||||||
if req and req not in self.black:
|
if req and req not in self.black:
|
||||||
dependencies.append(req)
|
dependencies.append(req)
|
||||||
if dependencies:
|
if dependencies:
|
||||||
|
|
|
@ -38,11 +38,9 @@ def repo_data(PACKAGES_TXT, step, repo, flag):
|
||||||
"""
|
"""
|
||||||
(name, location, size, unsize,
|
(name, location, size, unsize,
|
||||||
rname, rlocation, rsize, runsize) = ([] for i in range(8))
|
rname, rlocation, rsize, runsize) = ([] for i in range(8))
|
||||||
index, toolbar_width = 0, 100
|
|
||||||
for line in PACKAGES_TXT.splitlines():
|
for line in PACKAGES_TXT.splitlines():
|
||||||
if _meta_.rsl_deps in ["on", "ON"] and flag != "--resolve-off":
|
if _meta_.rsl_deps in ["on", "ON"] and flag != "--resolve-off":
|
||||||
index += 1
|
status(0.000005)
|
||||||
toolbar_width = status(index, toolbar_width, step)
|
|
||||||
if line.startswith("PACKAGE NAME:"):
|
if line.startswith("PACKAGE NAME:"):
|
||||||
name.append(line[15:].strip())
|
name.append(line[15:].strip())
|
||||||
if line.startswith("PACKAGE LOCATION:"):
|
if line.startswith("PACKAGE LOCATION:"):
|
||||||
|
|
|
@ -189,10 +189,8 @@ class BinaryInstall(object):
|
||||||
if (self.meta.rsl_deps in ["on", "ON"] and
|
if (self.meta.rsl_deps in ["on", "ON"] and
|
||||||
self.flag != "--resolve-off"):
|
self.flag != "--resolve-off"):
|
||||||
Msg().resolving()
|
Msg().resolving()
|
||||||
toolbar_width, index = 2, 0
|
|
||||||
for dep in self.packages:
|
for dep in self.packages:
|
||||||
index += 1
|
status(0.05)
|
||||||
toolbar_width = status(index, toolbar_width, 3)
|
|
||||||
dependencies = []
|
dependencies = []
|
||||||
dependencies = Utils().dimensional_list(Dependencies(
|
dependencies = Utils().dimensional_list(Dependencies(
|
||||||
self.PACKAGES_TXT, self.repo, self.blacklist).binary(
|
self.PACKAGES_TXT, self.repo, self.blacklist).binary(
|
||||||
|
|
|
@ -543,12 +543,10 @@ class Initialization(object):
|
||||||
def write_file(self, path, archive, contents_txt):
|
def write_file(self, path, archive, contents_txt):
|
||||||
"""Create local file
|
"""Create local file
|
||||||
"""
|
"""
|
||||||
toolbar_width, index = 2, 0
|
|
||||||
try:
|
try:
|
||||||
with open("{0}{1}".format(path, archive), "w") as f:
|
with open("{0}{1}".format(path, archive), "w") as f:
|
||||||
for line in contents_txt.splitlines():
|
for line in contents_txt.splitlines():
|
||||||
index += 1
|
status(0.00005)
|
||||||
toolbar_width = status(index, toolbar_width, 700)
|
|
||||||
f.write(line + "\n")
|
f.write(line + "\n")
|
||||||
f.close()
|
f.close()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|
|
@ -78,29 +78,29 @@ class Msg(object):
|
||||||
def checking(self):
|
def checking(self):
|
||||||
"""Message checking
|
"""Message checking
|
||||||
"""
|
"""
|
||||||
sys.stdout.write("{0}Checking ...{1}".format(self.meta.color["GREY"],
|
sys.stdout.write("{0}Checking... {1} ".format(self.meta.color["GREY"],
|
||||||
self.meta.color["ENDC"]))
|
self.meta.color["ENDC"]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def reading(self):
|
def reading(self):
|
||||||
"""Message reading
|
"""Message reading
|
||||||
"""
|
"""
|
||||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
sys.stdout.write("{0}Reading package lists... {1} ".format(
|
||||||
self.meta.color["GREY"], self.meta.color["ENDC"]))
|
self.meta.color["GREY"], self.meta.color["ENDC"]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def resolving(self):
|
def resolving(self):
|
||||||
"""Message resolving
|
"""Message resolving
|
||||||
"""
|
"""
|
||||||
sys.stdout.write("{0}Resolving dependencies ...{1}".format(
|
sys.stdout.write("{0}Resolving dependencies... {1} ".format(
|
||||||
self.meta.color["GREY"], self.meta.color["ENDC"]))
|
self.meta.color["GREY"], self.meta.color["ENDC"]))
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def done(self):
|
def done(self):
|
||||||
"""Message done
|
"""Message done
|
||||||
"""
|
"""
|
||||||
sys.stdout.write("{0}Done{1}\n".format(self.meta.color["GREY"],
|
sys.stdout.write("\b {0}Done{1}\n".format(self.meta.color["GREY"],
|
||||||
self.meta.color["ENDC"]))
|
self.meta.color["ENDC"]))
|
||||||
|
|
||||||
def pkg(self, count):
|
def pkg(self, count):
|
||||||
"""Print singular plural
|
"""Print singular plural
|
||||||
|
|
|
@ -42,12 +42,10 @@ def sbo_upgrade(skip):
|
||||||
try:
|
try:
|
||||||
Msg().checking()
|
Msg().checking()
|
||||||
upgrade_names = []
|
upgrade_names = []
|
||||||
index, toolbar_width = 0, 3
|
|
||||||
data = SBoGrep(name="").names()
|
data = SBoGrep(name="").names()
|
||||||
blacklist = BlackList().packages(pkgs=data, repo="sbo")
|
blacklist = BlackList().packages(pkgs=data, repo="sbo")
|
||||||
for pkg in sbo_list():
|
for pkg in sbo_list():
|
||||||
index += 1
|
status(0.03)
|
||||||
toolbar_width = status(index, toolbar_width, 4)
|
|
||||||
name = split_package(pkg)[0]
|
name = split_package(pkg)[0]
|
||||||
ver = split_package(pkg)[1]
|
ver = split_package(pkg)[1]
|
||||||
if (name in data and name not in skip and name not in blacklist):
|
if (name in data and name not in skip and name not in blacklist):
|
||||||
|
|
|
@ -50,11 +50,10 @@ class Requires(object):
|
||||||
sys.setrecursionlimit(10000)
|
sys.setrecursionlimit(10000)
|
||||||
dependencies = []
|
dependencies = []
|
||||||
requires = SBoGrep(name).requires()
|
requires = SBoGrep(name).requires()
|
||||||
toolbar_width, index = 2, 0
|
|
||||||
if requires:
|
if requires:
|
||||||
for req in requires:
|
for req in requires:
|
||||||
index += 1
|
status(0.03)
|
||||||
toolbar_width = status(index, toolbar_width, 1)
|
# toolbar_width = status(index, toolbar_width, 1)
|
||||||
# avoid to add %README% as dependency and
|
# avoid to add %README% as dependency and
|
||||||
# if require in blacklist
|
# if require in blacklist
|
||||||
if "%README%" not in req and req not in self.blacklist:
|
if "%README%" not in req and req not in self.blacklist:
|
||||||
|
|
|
@ -60,7 +60,6 @@ class SBoInstall(object):
|
||||||
self.package_not_found = []
|
self.package_not_found = []
|
||||||
self.package_found = []
|
self.package_found = []
|
||||||
self.deps_dict = {}
|
self.deps_dict = {}
|
||||||
self.toolbar_width, self.index = 2, 0
|
|
||||||
self.answer = ""
|
self.answer = ""
|
||||||
self.match = False
|
self.match = False
|
||||||
Msg().reading()
|
Msg().reading()
|
||||||
|
@ -72,8 +71,7 @@ class SBoInstall(object):
|
||||||
tagc = ""
|
tagc = ""
|
||||||
count_ins = count_upg = count_uni = 0
|
count_ins = count_upg = count_uni = 0
|
||||||
for _sbo in self.slackbuilds:
|
for _sbo in self.slackbuilds:
|
||||||
self.index += 1
|
status(0.03)
|
||||||
self.toolbar_width = status(self.index, self.toolbar_width, 4)
|
|
||||||
if _sbo in self.data and _sbo not in self.blacklist:
|
if _sbo in self.data and _sbo not in self.blacklist:
|
||||||
sbo_deps = Requires(self.flag).sbo(_sbo)
|
sbo_deps = Requires(self.flag).sbo(_sbo)
|
||||||
self.deps += sbo_deps
|
self.deps += sbo_deps
|
||||||
|
@ -171,8 +169,7 @@ class SBoInstall(object):
|
||||||
"""
|
"""
|
||||||
sbo_versions, sources = [], []
|
sbo_versions, sources = [], []
|
||||||
for sbo in slackbuilds:
|
for sbo in slackbuilds:
|
||||||
self.index += 1
|
status(0.02)
|
||||||
self.toolbar_width = status(self.index, self.toolbar_width, 4)
|
|
||||||
sbo_ver = "{0}-{1}".format(sbo, SBoGrep(sbo).version())
|
sbo_ver = "{0}-{1}".format(sbo, SBoGrep(sbo).version())
|
||||||
sbo_versions.append(sbo_ver)
|
sbo_versions.append(sbo_ver)
|
||||||
sources.append(SBoGrep(sbo).source())
|
sources.append(SBoGrep(sbo).source())
|
||||||
|
|
|
@ -25,17 +25,10 @@
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from __metadata__ import MetaData as _meta_
|
|
||||||
|
|
||||||
|
def status(sec):
|
||||||
def status(index, width, step):
|
syms = ["\\", "|", "/", "-"]
|
||||||
"""
|
for sym in syms:
|
||||||
Print toolbar status
|
sys.stdout.write("\b{0}".format(sym))
|
||||||
"""
|
|
||||||
if index == width:
|
|
||||||
sys.stdout.write("{0}.{1}".format(_meta_.color["GREY"],
|
|
||||||
_meta_.color["ENDC"]))
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
width += step
|
time.sleep(float(sec))
|
||||||
time.sleep(0.009)
|
|
||||||
return width
|
|
||||||
|
|
Loading…
Reference in a new issue