From 4baef16447574f31e8718bc79751abc7be80a7fe Mon Sep 17 00:00:00 2001 From: "William R. Otte" Date: Tue, 25 Jul 2006 19:42:30 +0000 Subject: Tue Jul 25 19:40:54 UTC 2006 William R. Otte --- ACE/ChangeLog | 19 ++++++++ ACE/bin/PythonACE/__init__.py | 2 + ACE/bin/PythonACE/fuzz/check_includes.py | 2 +- ACE/bin/PythonACE/fuzz/no_conflict_markers.py | 2 +- ACE/bin/fuzz.py | 66 +++++++++++++++++++++++++++ ACE/bin/sets-manager.py | 6 +-- 6 files changed, 92 insertions(+), 5 deletions(-) create mode 100644 ACE/bin/PythonACE/__init__.py create mode 100755 ACE/bin/fuzz.py diff --git a/ACE/ChangeLog b/ACE/ChangeLog index 811bd4f6b20..ca759b3cf14 100644 --- a/ACE/ChangeLog +++ b/ACE/ChangeLog @@ -1,3 +1,22 @@ +Tue Jul 25 19:40:54 UTC 2006 William R. Otte + + * bin/PythonACE/__init__.py + + This enables PythonACE to be loaded as a module. + + * bin/PythonACE/fuzz/check_includes.py + * bin/PythonACE/fuzz/no_conflict_markers.py + + Fixed these checks, they were incorrectly flagging errors. + + * bin/fuzz.py + + Command line fuzz client that uses the PythonACE fuzz module. + + * bin/sets-manager.py + + Corrected this file to point at DOC/Middleware instead of ACE/Middleware. + Mon Jul 24 23:58:33 UTC 2006 William R. Otte * docs/svn/svn-prefs.reg diff --git a/ACE/bin/PythonACE/__init__.py b/ACE/bin/PythonACE/__init__.py new file mode 100644 index 00000000000..de05225d2cf --- /dev/null +++ b/ACE/bin/PythonACE/__init__.py @@ -0,0 +1,2 @@ + +import fuzz diff --git a/ACE/bin/PythonACE/fuzz/check_includes.py b/ACE/bin/PythonACE/fuzz/check_includes.py index d6ab7148597..7fd8e744c90 100644 --- a/ACE/bin/PythonACE/fuzz/check_includes.py +++ b/ACE/bin/PythonACE/fuzz/check_includes.py @@ -6,7 +6,7 @@ type_list = _types.source_files + _types.header_files + _types.inline_files + _t from sys import stderr import re -regex = re.compile ("\s*#\s*include\s*(\/\*\*\/){0,1}\s*<[(ace)|(tao)|(ciao)|(TAO)|(CIAO)].*>") +regex = re.compile ("\s*#\s*include\s*(\/\*\*\/){0,1}\s*<(ace|tao|ciao|TAO|CIAO).*>") begin_exclude = re.compile ("FUZZ\: disable check_for_include") end_exclude = re.compile ("FUZZ\: enable check_for_include") diff --git a/ACE/bin/PythonACE/fuzz/no_conflict_markers.py b/ACE/bin/PythonACE/fuzz/no_conflict_markers.py index d2d2f8e917a..62066b42333 100644 --- a/ACE/bin/PythonACE/fuzz/no_conflict_markers.py +++ b/ACE/bin/PythonACE/fuzz/no_conflict_markers.py @@ -6,7 +6,7 @@ type_list = ["*"] from sys import stderr import re -regex = re.compile ("^<<<<|^>>>>|^====", re.MULTILINE) +regex = re.compile ("^<<<<<<< \.|>>>>>>> \.r|^=======$", re.MULTILINE) begin_exclude = re.compile ("FUZZ\: disable conflict_marker_check") end_exclude = re.compile ("FUZZ\: enable conflict_marker_check") diff --git a/ACE/bin/fuzz.py b/ACE/bin/fuzz.py new file mode 100755 index 00000000000..cdf38de87f5 --- /dev/null +++ b/ACE/bin/fuzz.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python +""" Implements a command line client for the Python Fuzz module, much like fuzz.pl """ + +def parse_args (): + from optparse import OptionParser + + parser = OptionParser ("usage %prog [options] ") + + parser.add_option ("--exclude-dirs", dest="exclude_dir", action="append", default=list (), + help="A regular expression that when matched, will cause directories to be skipped.") + parser.add_option ("--exclude-files", dest="exclude_file", action="append", default=list (), + help="A regular expression that when matched, will cause files to be skipped.") + + return parser.parse_args () + + +import PythonACE.fuzz + +class Fuzz_Client: + def __init__ (self, opts, args): + import re + + self.ex_dirs = map (re.compile, opts.exclude_dir) + self.ex_files = map (re.compile, opts.exclude_file) + self.args = args + + def walk_dir (self, directory): + import os + + for root, dirs, files in os.walk (directory): + # Prune out .svn directories + for item in dirs: + if item == ".svn": + dirs.remove (item) + + # Prune out exclusions + for regex in self.ex_dirs: + if regex.search (item) != None: + dirs.remove (item) + + for item in files: + for regex in self.ex_files: + if regex.serch (item) != None: + continue + self.check_file (os.path.join (root, item)) + + def check_file (self, the_file): + f = open (the_file, 'r') + PythonACE.fuzz.fuzz_check (the_file, f.read ()) + f.close () + + def main (self): + for item in self.args: + import os.path + if os.path.isfile (item): + self.check_file (item) + elif os.path.isdir (item): + self.walk_dir (item) + else: + print item + " is not a file or directory." + +if __name__ == "__main__": + opts, args = parse_args () + Fuzz = Fuzz_Client(opts, args) + Fuzz.main () + diff --git a/ACE/bin/sets-manager.py b/ACE/bin/sets-manager.py index 73c922239f3..b840d705f31 100755 --- a/ACE/bin/sets-manager.py +++ b/ACE/bin/sets-manager.py @@ -1,4 +1,4 @@ -#!/opt/local/bin/python +#!/usr/bin/env python """ This script implements branching and tagging in the DOC group repository, and automates the process of creating sets. """ @@ -24,8 +24,8 @@ def parse_args (): parser.add_option ("-s", "--svn", dest="svn", default="svn", help="Full path to svn binary, if not in path") parser.add_option ("-r", "--repo", dest="repo", - default="https://svn.dre.vanderbilt.edu/DOC/ACE/", - help="Repository to use, defaults to s.d.v.e/DOC/ACE.") + default="https://svn.dre.vanderbilt.edu/DOC/Middleware/", + help="Repository to use, defaults to s.d.v.e/DOC/Middleware.") parser.add_option ("--src", dest="source", default="trunk/", help="Path in repository from which to branch, defaults to trunk") parser.add_option ("--dest", dest="dest", default="", -- cgit v1.2.1