From bdd46196d581750f9a146a6a4224a8261cb12eed Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 13 Sep 2014 07:04:47 +0300 Subject: [PATCH] update colors --- slpkg/sbo/check.py | 18 ++++++++++-------- slpkg/sbo/dependency.py | 10 ++++++---- slpkg/sbo/slackbuild.py | 8 +++++--- slpkg/sbo/views.py | 7 ++++--- slpkg/slack/install.py | 6 +++--- slpkg/slack/patches.py | 9 ++++----- 6 files changed, 32 insertions(+), 26 deletions(-) diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index 771a1adc..b9f0582f 100755 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -50,7 +50,8 @@ def sbo_check(): some version in /tmp directory. ''' try: - sys.stdout.write("Reading package lists ...") + sys.stdout.write("{0}Reading package lists ...{1}".format( + colors.GREY, colors.ENDC)) sys.stdout.flush() initialization() index, toolbar_width = 0, 3 @@ -65,9 +66,9 @@ def sbo_check(): for pkg in sbo_list: index += 1 if index == toolbar_width: - sys.stdout.write(".") + sys.stdout.write("{0}.{1}".format(colors.GREY, ENDC)) sys.stdout.flush() - toolbar_width += 3 + toolbar_width += 4 if "-x86_64-" in pkg: arch = "x86_64" elif "-i486-" in pkg: @@ -88,9 +89,10 @@ def sbo_check(): sbo_package = ("{0}-{1}".format(name, sbo_version_pkg(name))) if sbo_package > package: upg_name.append(name) - sys.stdout.write("Done\n") + sys.stdout.write("{0}Done{1}\n".format(colors.GREY, ENDC)) if upg_name: - sys.stdout.write("Resolving dependencies ...") + sys.stdout.write("{0}Resolving dependencies ...{1}".format( + colors.GREY, ENDC)) sys.stdout.flush() ''' Of the packages found to need upgrading, @@ -136,7 +138,7 @@ def sbo_check(): # take version from repository if find_package(prgnam, pkg_path) == []: for sbo in os.listdir(pkg_path): - if sbo.startswith(pkg + "-") and sbo.endswith("_SBo"): + if sbo.startswith(pkg + sp) and sbo.endswith("_SBo"): # search if packages installed # if yes grab package name, # version and arch @@ -156,7 +158,7 @@ def sbo_check(): pkg_for_upg.append("{0}-{1}".format(pkg, pkg_version)) upg_ver.append(ver) upg_arch.append(arch) - sys.stdout.write("Done\n") + sys.stdout.write("{0}Done{1}\n".format(colors.GREY, ENDC)) if pkg_for_upg: print("\nThese packages need upgrading:\n") template(78) @@ -241,7 +243,7 @@ def sbo_check(): else: print("\nTotal {0} SBo packages are up to date\n".format(len(sbo_list))) else: - sys.stdout.write("Done\n") + sys.stdout.write("{0}Done{1}\n".format(colors.GREY, colors.ENDC)) print("\nNo SBo packages found\n") except KeyboardInterrupt: print # new line at exit diff --git a/slpkg/sbo/dependency.py b/slpkg/sbo/dependency.py index 179cdd75..552a5a5e 100755 --- a/slpkg/sbo/dependency.py +++ b/slpkg/sbo/dependency.py @@ -50,7 +50,8 @@ def sbo_dependencies_pkg(name): if dependencies: dep_results.append(dependencies) for dep in dependencies: - sys.stdout.write(".") + sys.stdout.write("{0}.{1}".format( + colors.GREY, colors.ENDC)) sys.stdout.flush() sbo_dependencies_pkg(dep) return dep_results @@ -65,14 +66,15 @@ def pkg_tracking(name): if allready installed and color red if not installed. ''' - sys.stdout.write("Reading package lists ...") + sys.stdout.write("{0}Reading package lists ...{1}".format( + colors.GREY, colors.ENDC)) sys.stdout.flush() initialization() dependencies_list = sbo_dependencies_pkg(name) GREEN, RED = colors.GREEN, colors.RED YELLOW, CYAN, ENDC = colors.YELLOW, colors.CYAN, colors.ENDC if dependencies_list is not None: - sys.stdout.write("Done\n") + sys.stdout.write("{0}Done{1}\n".format(colors.GREY, colors.ENDC)) print # new line at start requires, dependencies = [], [] ''' @@ -106,6 +108,6 @@ def pkg_tracking(name): print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC)) print # new line at end else: - sys.stdout.write("Done\n") + sys.stdout.write("{0}Done{1}\n".format(colors.GREY, colors.ENDC)) message = "From slackbuilds.org" pkg_not_found("\n", name, message, "\n") diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index f70fd65a..9dd93b1d 100755 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -46,7 +46,8 @@ def sbo_build(name): with all dependencies if version is greater than that established. ''' - sys.stdout.write("Building dependency tree ...") + sys.stdout.write("{0}Building dependency tree ...{1}".format( + colors.GREY, colors.ENDC)) initialization() dependencies_list = sbo_dependencies_pkg(name) try: @@ -100,7 +101,8 @@ def sbo_build(name): sbo_pkg = ("{0}-{1}".format(pkg, version)) if find_package(sbo_pkg, pkg_path): pkg_sum += 1 - sys.stdout.write("Done\n") + sys.stdout.write("{0}Done{1}\n".format( + colors.GREY, ENDC)) ''' Tag with color green if package already installed, color yellow for packages to upgrade and color red @@ -258,7 +260,7 @@ def sbo_build(name): f.write(dep + "\n") f.close() else: - sys.stdout.write("Done\n") + sys.stdout.write("{0}Done{1}\n".format(colors.GREY, colors.ENDC)) message = "From slackbuilds.org" pkg_not_found("\n", name, message, "\n") except KeyboardInterrupt: diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py index 55c83f2c..ca96d073 100755 --- a/slpkg/sbo/views.py +++ b/slpkg/sbo/views.py @@ -46,7 +46,8 @@ def sbo_network(name): from slackbuilds.org ''' rdm_path = slpkg_tmp + "readme/" - sys.stdout.write("Reading package lists ...") + sys.stdout.write("{0}Reading package lists ...{1}".format( + colors.GREY, colors.ENDC)) sys.stdout.flush() initialization() sbo_url = sbo_search_pkg(name) @@ -54,7 +55,7 @@ def sbo_network(name): sbo_req = sbo_requires_pkg(sbo_url, name) sbo_dwn = sbo_slackbuild_dwn(sbo_url) source_dwn = sbo_source_dwn(name).split() - sys.stdout.write ("Done\n") + sys.stdout.write ("{0}Done{1}\n".format(colors.GREY, colors.ENDC)) view_sbo(name, sbo_url, get_file(sbo_dwn, "/"), \ ", ".join([get_file(src, "/") for src in source_dwn]), \ sbo_req) @@ -157,6 +158,6 @@ def sbo_network(name): else: break else: - sys.stdout.write ("Done\n") + sys.stdout.write ("{0}Done{1}\n".format(colors.GREY, colors.ENDC)) message = "From slackbuilds.org" pkg_not_found("\n", name, message, "\n") diff --git a/slpkg/slack/install.py b/slpkg/slack/install.py index 52b44366..96f61430 100755 --- a/slpkg/slack/install.py +++ b/slpkg/slack/install.py @@ -52,7 +52,7 @@ def install(slack_pkg): os.mkdir(tmp_path) print("\nPackages with name matching [ {0}{1}{2} ]\n".format( colors.CYAN, slack_pkg, ENDC)) - sys.stdout.write ("Reading package lists ...") + sys.stdout.write ("{0}Reading package lists ...{1}".format(colors.GREY, ENDC)) sys.stdout.flush() PACKAGES = url_read(mirrors(name="PACKAGES.TXT", location="")) EXTRA = url_read(mirrors(name="PACKAGES.TXT", location="extra/")) @@ -62,7 +62,7 @@ def install(slack_pkg): for line in PACKAGES_TXT.splitlines(): index += 1 if index == toolbar_width: - sys.stdout.write(".") + sys.stdout.write("{0}.{1}".format(colors.GREY, ENDC)) sys.stdout.flush() toolbar_width += 800 time.sleep(0.00888) @@ -80,7 +80,7 @@ def install(slack_pkg): install_all.append(name) comp_sum.append(comp) uncomp_sum.append(uncomp) - sys.stdout.write("Done\n\n") + sys.stdout.write("{0}Done{1}\n\n".format(colors.GREY, ENDC)) if install_all: template(78) print "| Package", " " * 33, "Arch", " " * 3, "Build", " ", "Repos", " ", "Size" diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index 5190fc27..b5f229e9 100755 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -29,8 +29,7 @@ import subprocess from colors import colors from url_read import url_read from messages import template -from __metadata__ import (pkg_path, slpkg_tmp, - slack_archs) +from __metadata__ import pkg_path, slpkg_tmp, slack_archs from pkg.manager import pkg_upgrade @@ -52,14 +51,14 @@ def patches(): os.mkdir(slpkg_tmp) if not os.path.exists(patch_path): os.mkdir(patch_path) - sys.stdout.write ("Reading package lists ...") + sys.stdout.write ("{0}Reading package lists ...{1}".format(colors.GREY, ENDC)) sys.stdout.flush() PACKAGE_TXT = url_read(mirrors(name="PACKAGES.TXT", location="patches/")) index, toolbar_width = 0, 100 for line in PACKAGE_TXT.splitlines(): index += 1 if index == toolbar_width: - sys.stdout.write(".") + sys.stdout.write("{0}.{1}".format(colors.GREY, ENDC)) sys.stdout.flush() toolbar_width += 100 time.sleep(0.05) @@ -77,7 +76,7 @@ def patches(): comp_sum.append(comp) uncomp_sum.append(uncomp) upgrade_all.append(name) - sys.stdout.write("Done\n") + sys.stdout.write("{0}Done{1}\n".format(colors.GREY, ENDC)) if upgrade_all: print("\nThese packages need upgrading:\n") template(78)