[game-data-packager] 01/01: SuSE: parse zypper output in a simpler & more robust way

Alexandre Detiste detiste-guest at moszumanska.debian.org
Fri Jan 8 14:52:24 UTC 2016


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit 34fae682e9c3af1891d5960450940ad394386859
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Fri Jan 8 15:51:23 2016 +0100

    SuSE: parse zypper output in a simpler & more robust way
---
 game_data_packager/packaging/rpm.py | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/game_data_packager/packaging/rpm.py b/game_data_packager/packaging/rpm.py
index 6ccf655..3505b55 100644
--- a/game_data_packager/packaging/rpm.py
+++ b/game_data_packager/packaging/rpm.py
@@ -141,10 +141,7 @@ class ZypperPackaging(RpmPackaging):
                 stdout=subprocess.PIPE,
                 env={'LANG':'C'})
         for line in proc.stdout:
-            if ':' not in line:
-                continue
-            k, _, v = line.split(maxsplit=2)
-            if k == 'Version':
+            if line.startswith('Version:'):
                 return True
         return False
 
@@ -154,11 +151,8 @@ class ZypperPackaging(RpmPackaging):
                 stdout=subprocess.PIPE,
                 env={'LANG':'C'})
         for line in proc.stdout:
-            if ':' not in line:
-                continue
-            k, _, v = line.split(maxsplit=2)
-            if k == 'Version':
-                return v
+            if line.startswith('Version:'):
+                return line.split(':', maxsplit=1)[1]
 
     def install_packages(self, rpms, method='zypper', gain_root='su'):
         super(ZypperPackaging, self).install_packages(rpms, method=method,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list