[game-data-packager] 02/21: factorize reading control files
Simon McVittie
smcv at debian.org
Thu Jan 22 01:10:46 UTC 2015
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit 88171673612111f6768daff60e7dacc2d171329b
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Wed Jan 21 22:40:37 2015 +0100
factorize reading control files
---
lib/game_data_packager/__init__.py | 37 +++++++++++++------------------------
1 file changed, 13 insertions(+), 24 deletions(-)
diff --git a/lib/game_data_packager/__init__.py b/lib/game_data_packager/__init__.py
index 8e9ba95..c84149a 100644
--- a/lib/game_data_packager/__init__.py
+++ b/lib/game_data_packager/__init__.py
@@ -1629,30 +1629,19 @@ class GameData(object):
if control['Architecture'] == 'all' and 'Multi-Arch' not in control:
control['Multi-Arch'] = 'foreign'
- depends = set()
- recommends = set()
- suggests = set()
- provides = set()
- replaces = set()
- conflicts = set()
- if 'Depends' in control:
- for depend in control['Depends'].split(','):
- depends.add(depend.strip())
- if 'Recommends' in control:
- for recommend in control['Recommends'].split(','):
- recommends.add(recommend.strip())
- if 'Suggests' in control:
- for suggest in control['Suggests'].split(','):
- suggests.add(suggest.strip())
- if 'Provides' in control:
- for provide in control['Provides'].split(','):
- provides.add(provide.strip())
- if 'Replaces' in control:
- for replace in control['Replaces'].split(','):
- replaces.add(replace.strip())
- if 'Conflicts' in control:
- for conflict in control['Conflicts'].split(','):
- conflicts.add(conflict.strip())
+ def read_control_set(control, field):
+ result = set()
+ if field in control:
+ for value in control[field].split(','):
+ result.add(value.strip())
+ return result
+
+ depends = read_control_set(control, 'Depends')
+ recommends = read_control_set(control, 'Recommends')
+ suggests = read_control_set(control, 'Suggests')
+ provides = read_control_set(control, 'Provides')
+ replaces = read_control_set(control, 'Replaces')
+ conflicts = read_control_set(control, 'Conflicts')
if package.expansion_for:
depends.add(package.expansion_for)
--
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