diff options
author | goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2012-01-23 20:57:29 +0000 |
---|---|---|
committer | goodger <goodger@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2012-01-23 20:57:29 +0000 |
commit | e8d0605afd4966dbb52ad2c199e19e276db2d661 (patch) | |
tree | e676bd565cb91233583699245f7939ab9f7afcd6 /tools/buildhtml.py | |
parent | a02de2263c5611f1cafd3bec0fec3694492b5d85 (diff) | |
download | docutils-e8d0605afd4966dbb52ad2c199e19e276db2d661.tar.gz |
fixed the --prune & --ignore options of buildhtml.py
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@7323 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'tools/buildhtml.py')
-rwxr-xr-x | tools/buildhtml.py | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/tools/buildhtml.py b/tools/buildhtml.py index 807ef0109..954c53a15 100755 --- a/tools/buildhtml.py +++ b/tools/buildhtml.py @@ -47,6 +47,8 @@ class SettingsSpec(docutils.SettingsSpec): Runtime settings & command-line options for the front end. """ + prune_default = ['.hg', '.bzr', '.git', '.svn', 'CVS'] + # Can't be included in OptionParser below because we don't want to # override the base class. settings_spec = ( @@ -59,17 +61,19 @@ class SettingsSpec(docutils.SettingsSpec): 'validator': frontend.validate_boolean}), ('Do not scan subdirectories for files to process.', ['--local'], {'dest': 'recurse', 'action': 'store_false'}), - ('BROKEN Do not process files in <directory>. This option may be used ' - 'more than once to specify multiple directories.', + ('Do not process files in <directory> (shell globbing patterns, ' + 'separated by colons). This option may be used ' + 'more than once to specify multiple directories. Default: "%s".' + % ':'.join(prune_default), ['--prune'], {'metavar': '<directory>', 'action': 'append', - 'validator': frontend.validate_colon_separated_string_list}), - ('BROKEN Recursively ignore files or directories matching any of the given ' - 'wildcard (shell globbing) patterns (separated by colons). ' - 'Default: ".svn:CVS"', + 'validator': frontend.validate_colon_separated_string_list, + 'default': prune_default,}), + ('Recursively ignore files matching any of the given ' + 'wildcard (shell globbing) patterns (separated by colons).', ['--ignore'], {'metavar': '<patterns>', 'action': 'append', - 'default': ['.svn', 'CVS'], + 'default': [], 'validator': frontend.validate_colon_separated_string_list}), ('Work silently (no progress messages). Independent of "--quiet".', ['--silent'], @@ -190,17 +194,16 @@ class Builder: # influence by modifying dirs. if not recurse: del dirs[:] - self.visit(root, files) + self.visit(root, files, dirs) - def visit(self, directory, names): - # BUG prune and ignore do not work + def visit(self, directory, names, subdirectories): settings = self.get_settings('', directory) errout = ErrorOutput(encoding=settings.error_encoding) if settings.prune and (os.path.abspath(directory) in settings.prune): print >>errout, ('/// ...Skipping directory (pruned): %s' % directory) sys.stderr.flush() - names[:] = [] + del subdirectories[:] return if not self.initial_settings.silent: print >>errout, '/// Processing directory: %s' % directory @@ -212,12 +215,9 @@ class Builder: if fnmatch(names[i], pattern): # Modify in place! del names[i] - prune = 0 for name in names: if name.endswith('.txt'): - prune = self.process_txt(directory, name) - if prune: - break + self.process_txt(directory, name) def process_txt(self, directory, name): if name.startswith('pep-'): @@ -227,8 +227,6 @@ class Builder: settings = self.get_settings(publisher, directory) errout = ErrorOutput(encoding=settings.error_encoding) pub_struct = self.publishers[publisher] - if settings.prune and (directory in settings.prune): - return 1 settings._source = os.path.normpath(os.path.join(directory, name)) settings._destination = settings._source[:-4]+'.html' if not self.initial_settings.silent: |