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