[med-svn] r1257 - trunk/community/infrastructure/test
tille at alioth.debian.org
tille at alioth.debian.org
Sat Feb 2 11:03:48 UTC 2008
Author: tille
Date: 2008-02-02 11:03:47 +0000 (Sat, 02 Feb 2008)
New Revision: 1257
Added:
trunk/community/infrastructure/test/test_read_tasks_file
Log:
This is another test how we should read our tasks files using python-apt to make sure everything is processed nicely.
Added: trunk/community/infrastructure/test/test_read_tasks_file
===================================================================
--- trunk/community/infrastructure/test/test_read_tasks_file (rev 0)
+++ trunk/community/infrastructure/test/test_read_tasks_file 2008-02-02 11:03:47 UTC (rev 1257)
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+# This is just a test how we should read tasks files
+# using python-debian to make sure everything is
+# processed nicely
+#
+# You should give the path to a tasks file at command
+# line for this simple test
+
+import sys
+
+# Some keys might be ignored because they work as
+# comments in the tasks file for the moment
+ignore_keys = [ "Why", "Responsible" ]
+
+# Theyse keys might contain more than one item that
+# has to be separated to detect the dependency
+dependency_keys = [ "Depends", "Recommends", "Suggests" ]
+
+from debian_bundle import deb822
+
+for fname in sys.argv[1:]:
+ f = file(fname)
+ for stanza in deb822.Sources.iter_paragraphs(f):
+ # pieces = stanza['version'].split('-')
+ # if len(pieces) < 2:
+ for key in stanza:
+ if key in ignore_keys:
+ continue
+ if key in dependency_keys:
+ # turn alternatives ('|') into real depends for this purpose
+ # because we are finally interested in all alternatives
+ dependencies = stanza[key].replace('|',',').split(',')
+ for dep in dependencies:
+ print key, ':', dep.strip()
+ else:
+ print key, ':', stanza[key]
+
+ f.close()
+
Property changes on: trunk/community/infrastructure/test/test_read_tasks_file
___________________________________________________________________
Name: svn:executable
+ *
More information about the debian-med-commit
mailing list