[Python-checkins] r59798 - tracker/instances/python-dev/scripts/remove_py3k

martin.v.loewis python-checkins at python.org
Sun Jan 6 23:22:23 CET 2008


Author: martin.v.loewis
Date: Sun Jan  6 23:22:22 2008
New Revision: 59798

Added:
   tracker/instances/python-dev/scripts/remove_py3k   (contents, props changed)
Log:
Create script to change all py3k keyword occurrences
to the Python 3.0 version.


Added: tracker/instances/python-dev/scripts/remove_py3k
==============================================================================
--- (empty file)
+++ tracker/instances/python-dev/scripts/remove_py3k	Sun Jan  6 23:22:22 2008
@@ -0,0 +1,24 @@
+# This sample script changes all issues with the
+# py3k keyword to using the "Python 3.0" version instead.
+import sys
+sys.path.insert(1,'/home/roundup/roundup/lib/python2.4/site-packages')
+import roundup.instance
+
+tracker = roundup.instance.open('.')
+db = tracker.open('admin')
+
+py3k = db.keyword.lookup('py3k')
+py30 = db.version.lookup('Python 3.1')
+
+using_py3k = db.issue.find(keywords={py3k:1})
+
+for issue in using_py3k:
+    keywords = db.issue.get(issue, 'keywords')
+    keywords.remove(py3k)
+    versions = db.issue.get(issue, 'versions')
+    versions.append(py30)
+
+    # Use set_inner, so that auditors and reactors don't fire
+    db.issue.set_inner(issue, keywords=keywords, versions=versions)
+
+db.commit()


More information about the Python-checkins mailing list