update colors

This commit is contained in:
Dimitris Zlatanidis 2014-09-13 07:04:47 +03:00
parent 6b14f89596
commit bdd46196d5
6 changed files with 32 additions and 26 deletions

View file

@ -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

View file

@ -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")

View file

@ -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:

View file

@ -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")

View file

@ -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"

View file

@ -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)