commit 5974512b79234882c59eab75669440628a6a8142 Author: Tomas Touceda chiiph@gentoo.org Date: Wed Jun 22 08:07:14 2011 -0300
Make optional keys actually optional --- lib/thandy/formats.py | 30 ++++++++++++++---------------- 1 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/lib/thandy/formats.py b/lib/thandy/formats.py index cd7cb0a..b73e5ac 100644 --- a/lib/thandy/formats.py +++ b/lib/thandy/formats.py @@ -811,20 +811,21 @@ def makeThpPackageObj(config_fname, package_path): package_fname, return a new unsigned package object. """ preload = {} + optKeys = ['additional_files', + 'install_order', + 'options', + 'platform', + 'require_features', + 'require_packages', + 'scripts' + ] r = readConfigFile(config_fname, ['format_version', 'files', 'package_name', 'package_version', 'package_version_tuple', - ], ['additional_files', - 'install_order', - 'options', - 'platform', - 'require_features', - 'require_packages', - 'scripts' - ], preload) + ], optKeys, preload)
file_list = [] for (file, is_config) in r["files"]: @@ -841,16 +842,13 @@ def makeThpPackageObj(config_fname, package_path): 'package_name' : r['package_name'], 'package_version' : r['package_version'], 'package_version_tuple' : r['package_version_tuple'], - 'timestamp' : formatTime(time.time()), - 'additional_files' : r['additional_files'], - 'install_order' : r['install_order'], - 'options' : r['options'], - 'platform' : r['platform'], - 'require_features' : r['require_features'], - 'require_packages' : r['require_packages'], - 'scripts' : r['scripts'] + 'timestamp' : formatTime(time.time()) }
+ for optKey in optKeys: + if optKey in r: + result[optKey] = r[optKey] + THP_PACKAGE_SCHEMA.checkMatch(result)
return result