diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 7b30b8b9..7b69cca0 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -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" diff --git a/slpkg/binary/check.py b/slpkg/binary/check.py index 7fd8b0b1..493f1197 100644 --- a/slpkg/binary/check.py +++ b/slpkg/binary/check.py @@ -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 diff --git a/slpkg/binary/dependency.py b/slpkg/binary/dependency.py index 520e72e9..019fb79e 100644 --- a/slpkg/binary/dependency.py +++ b/slpkg/binary/dependency.py @@ -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: diff --git a/slpkg/binary/greps.py b/slpkg/binary/greps.py index 6b0657a0..4a0ad197 100644 --- a/slpkg/binary/greps.py +++ b/slpkg/binary/greps.py @@ -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:"): diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index f134c135..bdfad80a 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -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( diff --git a/slpkg/init.py b/slpkg/init.py index 1e3dbf16..9e721053 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -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: diff --git a/slpkg/messages.py b/slpkg/messages.py index 0c673e14..cdd80671 100644 --- a/slpkg/messages.py +++ b/slpkg/messages.py @@ -78,29 +78,29 @@ class Msg(object): def checking(self): """Message checking """ - sys.stdout.write("{0}Checking ...{1}".format(self.meta.color["GREY"], - self.meta.color["ENDC"])) + sys.stdout.write("{0}Checking... {1} ".format(self.meta.color["GREY"], + self.meta.color["ENDC"])) sys.stdout.flush() def reading(self): """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"])) sys.stdout.flush() def resolving(self): """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"])) sys.stdout.flush() def done(self): """Message done """ - sys.stdout.write("{0}Done{1}\n".format(self.meta.color["GREY"], - self.meta.color["ENDC"])) + sys.stdout.write("\b {0}Done{1}\n".format(self.meta.color["GREY"], + self.meta.color["ENDC"])) def pkg(self, count): """Print singular plural diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index a64b65eb..4b79fb63 100644 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -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): diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index aae20844..aff9bdb9 100644 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -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: diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index d9353596..fa52c979 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -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()) diff --git a/slpkg/toolbar.py b/slpkg/toolbar.py index 27f6ee34..dad7fa2f 100644 --- a/slpkg/toolbar.py +++ b/slpkg/toolbar.py @@ -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))