From 2fe6b6a0d0fdeab16cf2dbc42d28701946753dbd Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 17 May 2015 02:53:20 +0300 Subject: [PATCH] remove feature added view version --- slpkg/binary/install.py | 12 ------------ slpkg/sbo/slackbuild.py | 25 ++++++++++--------------- slpkg/slack/patches.py | 15 ++------------- 3 files changed, 12 insertions(+), 40 deletions(-) diff --git a/slpkg/binary/install.py b/slpkg/binary/install.py index 47d32e4f..22c0b028 100644 --- a/slpkg/binary/install.py +++ b/slpkg/binary/install.py @@ -227,16 +227,6 @@ class BinaryInstall(object): if not self.if_upgrade: self.pkg_ver = [''] * len(packages) - def package_ver(self, package): - ''' - Return package version if package already installed - ''' - name = "-".join(package[:-4].split("-")[:-3]) + "-" - pkg = "".join(find_package(name, _m.pkg_path)[0]) - if pkg: - return split_package(pkg)[1] - return "" - def views(self, install, comp_sum, is_deps): ''' Views packages @@ -250,11 +240,9 @@ class BinaryInstall(object): for pkg, ver, comp in zip(install, self.pkg_ver, comp_sum): pkg_split = split_package(pkg[:-4]) if find_package(pkg[:-4], _m.pkg_path): - ver = '-' + self.package_ver(pkg) pkg_sum += 1 COLOR = _m.color['GREEN'] elif find_package(pkg_split[0] + "-", _m.pkg_path): - ver = '-' + self.package_ver(pkg) COLOR = _m.color['YELLOW'] upg_sum += 1 else: diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index e13146e0..da3905cc 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -66,6 +66,7 @@ class SBoInstall(object): def start(self, if_upgrade): try: self.if_upgrade = if_upgrade + self.view_version() if self.if_upgrade: self.slackbuilds, self.pkg_ver = (self.slackbuilds[0], self.slackbuilds[1]) @@ -100,13 +101,13 @@ class SBoInstall(object): self.top_view() Msg().upg_inst(self.if_upgrade) # view master packages - for sbo, ar in zip(self.master_packages, mas_src): + for sbo, ver, ar in zip(self.master_packages, self.pkg_ver, + mas_src): tagc, count_ins, count_upg, count_uni = self.tag( sbo, count_ins, count_upg, count_uni) - ver = self.package_ver(sbo) name = '-'.join(sbo.split('-')[:-1]) + '-' + ver - if not ver: - name = name[:-1] + if not if_upgrade: + name = '-'.join(sbo.split('-')[:-1]) self.view_packages(tagc, name, sbo.split('-')[-1], self.select_arch(ar)) self._view_installing_for_deps() @@ -114,10 +115,7 @@ class SBoInstall(object): for dep, ar in zip(self.dependencies, dep_src): tagc, count_ins, count_upg, count_uni = self.tag( dep, count_ins, count_upg, count_uni) - ver = self.package_ver(dep) - name = '-'.join(dep.split('-')[:-1]) + '-' + ver - if not ver: - name = name[:-1] + name = '-'.join(dep.split('-')[:-1]) self.view_packages(tagc, name, dep.split('-')[-1], self.select_arch(ar)) count_total = (count_ins + count_upg + count_uni) @@ -228,14 +226,12 @@ class SBoInstall(object): "Size")) Msg().template(78) - def package_ver(self, sbo): + def view_version(self): ''' - Return package version if package already installed + Create empty seats if not upgrade ''' - pkg = "".join(find_package(sbo.split("-")[0] + "-", _m.pkg_path)) - if pkg: - return split_package(pkg)[1] - return "" + if not self.if_upgrade: + self.pkg_ver = [''] * len(self.slackbuilds) def view_packages(self, *args): ''' @@ -267,7 +263,6 @@ class SBoInstall(object): else: paint = _m.color['RED'] count_uni += 1 - return paint, count_ins, count_upg, count_uni def select_arch(self, src): diff --git a/slpkg/slack/patches.py b/slpkg/slack/patches.py index cdfe7dc4..ec17e84a 100644 --- a/slpkg/slack/patches.py +++ b/slpkg/slack/patches.py @@ -145,16 +145,6 @@ class Patches(object): self.count_added += 1 self.count_upg -= 1 - def package_ver(self, package): - ''' - Return package version if package already installed - ''' - name = "-".join(package[:-4].split("-")[:-3]) + "-" - pkg = "".join(find_package(name, _m.pkg_path)[0]) - if pkg: - return split_package(pkg)[1] - return "" - def views(self): ''' Views packages @@ -162,12 +152,11 @@ class Patches(object): for upg, size in sorted(zip(self.upgrade_all, self.comp_sum)): pkg_split = split_package(upg[:-4]) color = _m.color['YELLOW'] - ver = "-" + self.package_ver(upg) if not find_package(pkg_split[0], _m.pkg_path): color = _m.color['RED'] print(" {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>12}{12}".format( - color, pkg_split[0] + ver, _m.color['ENDC'], - " " * (24-len(pkg_split[0] + ver)), pkg_split[1], + color, pkg_split[0], _m.color['ENDC'], + " " * (24-len(pkg_split[0])), pkg_split[1], " " * (18-len(pkg_split[1])), pkg_split[2], " " * (8-len(pkg_split[2])), pkg_split[3], " " * (7-len(pkg_split[3])), "Slack",