Commit 5d752a97 authored by onny's avatar onny
Browse files

small enhancements

parent eda7ca80
File deleted
......@@ -14,6 +14,8 @@ from clint.textui import progress
import json
import datetime
widgets = ['', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
PATH = os.path.dirname(os.path.abspath(__file__))
TEMPLATE_ENVIRONMENT = Environment(
autoescape=False,
......@@ -73,7 +75,7 @@ def get_repo_status(packagename):
package_databases = []
config = load_config('config/config.json')
for link in config['database_sources']:
for idx, link in enumerate(config['database_sources']):
local_filename = config['temp_directory'] + "/" + os.path.split(link)[1]
package_databases.append(local_filename)
......@@ -83,7 +85,7 @@ for link in config['database_sources']:
file_size = int(r.headers['Content-Length'])
chunk = 1
num_bars = file_size / chunk
widgets = ['Downloading databases : ', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
widgets[0] = 'Downloading databases (' +str(idx+1)+ '/' + str(len(config['database_sources'])) +'): '
bar = ProgressBar(widgets=widgets, maxval=num_bars).start()
i = 0
for chunk in r.iter_content():
......@@ -93,7 +95,7 @@ for link in config['database_sources']:
f.close()
print("")
widgets = ['Loading local database : ', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
widgets[0] = 'Loading local database : '
bar = ProgressBar(widgets=widgets, max_value=len(package_databases))
packages = []
for idx, database in enumerate(package_databases):
......@@ -105,7 +107,7 @@ print("")
packages_outdated = []
packages_uptodate = []
packages_notlisted = []
widgets = ['Checking upstream versions : ', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
widgets[0] = 'Checking upstream versions : '
bar = ProgressBar(widgets=widgets, max_value=len(packages))
for idx, package in enumerate(packages):
bar.update(idx)
......@@ -122,7 +124,7 @@ bar.update(idx+1)
print("")
if len(packages_outdated) != 0:
widgets = ['Checking repository status : ', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
widgets[0] = 'Checking repository status : '
bar = ProgressBar(widgets=widgets, max_value=len(packages_outdated))
for idx, package in enumerate(packages_outdated):
bar.update(idx)
......@@ -131,7 +133,7 @@ if len(packages_outdated) != 0:
bar.update(idx+1)
print("")
widgets = ['Writing template : ', Percentage(), ' ', SimpleProgress(format='(%(value)d of %(max_value)d)'), ' ', Bar(), ' ', Timer(), ' ', AdaptiveETA()]
widgets[0] = 'Writing template : '
bar = ProgressBar(widgets=widgets, max_value=2)
bar.update(0)
context = { 'packages_outdated' : packages_outdated,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment