diff options
author | Derrell Lipman <derrell@samba.org> | 2006-12-30 05:09:59 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:30:29 -0500 |
commit | 1170417ceeb8c49a46cda522a38eaa71c9cae30c (patch) | |
tree | dbf4c3fdcdb1af928dbd55f642ea40f00d09283a /webapps/qooxdoo-0.6.3-sdk/frontend/framework/tool/modules/tagtool.py | |
parent | 23ccdca41670085da4486841b0d4900b4c8b02f3 (diff) | |
download | samba-1170417ceeb8c49a46cda522a38eaa71c9cae30c.tar.gz samba-1170417ceeb8c49a46cda522a38eaa71c9cae30c.tar.bz2 samba-1170417ceeb8c49a46cda522a38eaa71c9cae30c.zip |
r20414: Start to make SWAT usable by others. This is just a start...
(This used to be commit 26a34037a7ca6fbd05c5a6f7c2d5973e34bc6918)
Diffstat (limited to 'webapps/qooxdoo-0.6.3-sdk/frontend/framework/tool/modules/tagtool.py')
-rwxr-xr-x | webapps/qooxdoo-0.6.3-sdk/frontend/framework/tool/modules/tagtool.py | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/webapps/qooxdoo-0.6.3-sdk/frontend/framework/tool/modules/tagtool.py b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/tool/modules/tagtool.py new file mode 100755 index 0000000000..0313be750c --- /dev/null +++ b/webapps/qooxdoo-0.6.3-sdk/frontend/framework/tool/modules/tagtool.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python + +import sys, string, re, optparse +import config, filetool, comment, random + + +R_TAG = re.compile("random\(.*\)") + + + +def main(): + parser = optparse.OptionParser() + + parser.add_option("-q", "--quiet", action="store_false", dest="verbose", default=False, help="Quiet output mode.") + parser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="Verbose output mode.") + parser.add_option("--encoding", dest="encoding", default="utf-8", metavar="ENCODING", help="Defines the encoding expected for input files.") + + (options, args) = parser.parse_args() + + if len(args) == 0: + print "Needs one or more arguments (files) to tag!" + sys.exit(1) + + for fileName in args: + if options.verbose: + print " * Tagging %s" % fileName + + origFileContent = filetool.read(fileName, options.encoding) + patchedFileContent = R_TAG.sub("random(%s)" % random.randint(100, 999), origFileContent) + + if patchedFileContent != origFileContent: + filetool.save(fileName, patchedFileContent, options.encoding) + + + + +if __name__ == '__main__': + try: + main() + + except KeyboardInterrupt: + print + print " * Keyboard Interrupt" + sys.exit(1) +
\ No newline at end of file |