add color in installed packages

This commit is contained in:
Dimitris Zlatanidis 2015-02-02 05:04:01 +02:00
parent f25fa4d4df
commit 4aa0ca8250
2 changed files with 15 additions and 2 deletions

View file

@ -208,8 +208,8 @@ class BinaryInstall(object):
requires = []
Msg().resolving()
for dep in self.packages:
dep_ver = '-'.join(dep.split('-')[:-1]) # fix if input pkg with
if not len(dep_ver) == 0: # version
dep_ver = '-'.join(dep.split('-')[:-1]) # fix if input pkg name
if not len(dep_ver) == 0: # with version
dep = dep_ver
dependencies = []
dependencies = Utils().dimensional_list(Dependencies(

View file

@ -290,6 +290,7 @@ class PackageManager(object):
if line.startswith("PACKAGE NAME: "):
pkg_list.append(line[15:].strip())
for pkg in sorted(pkg_list):
pkg = self._list_color_tag(pkg)
if INDEX:
index += 1
print("{0}{1}:{2} {3}".format(_m.color['GREY'], index,
@ -309,3 +310,15 @@ class PackageManager(object):
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
def _list_color_tag(self, pkg):
'''
Tag with color installed packages
'''
find = pkg + '-'
if pkg.endswith('.txz') or pkg.endswith('.tgz'):
find = pkg[:-4]
if find_package(find, _m.pkg_path):
pkg = '{0}{1}{2}'.format(_m.color['GREEN'], pkg,
_m.color['ENDC'])
return pkg