Removed massive comment speculating about needlessly complex variations
on the manifest file syntax.
This commit is contained in:
parent
346e320c6e
commit
d6c30f66c7
|
@ -457,142 +457,3 @@ def findall (dir = os.curdir):
|
|||
|
||||
list.sort()
|
||||
return list
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# ======================================================================
|
||||
# Here follows some extensive mental masturbation about how to
|
||||
# make the manifest file and search algorithm even more complex.
|
||||
# I think this is all gratuitous, really.
|
||||
|
||||
# Hmm, something extra: want to apply an exclude pattern over a whole
|
||||
# subtree without necessarily having to explicitly include files from it,
|
||||
# ie. it should apply after gathering files by other means (simple
|
||||
# include pattern)
|
||||
# . !*~ !*.bak !#*#
|
||||
# and we also want to prune at certain directories:
|
||||
# . !RCS !CVS
|
||||
# which again should apply globally.
|
||||
#
|
||||
# possible solution:
|
||||
# - exclude pattern in a directory applies to all files found under that
|
||||
# directory
|
||||
# - subdirectories that match an exclude pattern will be pruned
|
||||
# - hmmm, to be consistent, subdirectories that match an include
|
||||
# pattern should be recursively included
|
||||
# - and this should apply to "simple" patterns too
|
||||
#
|
||||
# thus:
|
||||
#
|
||||
# examples/
|
||||
#
|
||||
# means get everything in examples/ and all subdirs;
|
||||
#
|
||||
# examples/ !*~ !#*# !*.py[co]
|
||||
#
|
||||
# means get everything under examples/ except files matching those three globs;
|
||||
#
|
||||
# ./ !RCS !CVS
|
||||
#
|
||||
# means get everything under current dir, but prune RCS/CVS directories;
|
||||
#
|
||||
# ./ !*~ !#*# !*.py[co] !RCS !CVS
|
||||
# ! build/
|
||||
# ! experimental/
|
||||
#
|
||||
# means get everything under the distribution directory except the usual
|
||||
# excludes at all levels; exclude "build" and "experimental" under the
|
||||
# distribution dir only.
|
||||
#
|
||||
# Do the former examples still work?
|
||||
#
|
||||
# distutils/ *.py
|
||||
# ! distutils/bleeding_edge.py
|
||||
#
|
||||
# means all .py files recursively found under distutils, except for the one
|
||||
# explicitly named.
|
||||
#
|
||||
# distutils/ *.py !bleeding_edge.py
|
||||
#
|
||||
# means the same, except bleeding_edge.py will be excluded wherever it's
|
||||
# found -- thus this can exclude up to one file per directory under
|
||||
# distutils.
|
||||
#
|
||||
# distutils/*.py
|
||||
# ! distutils/bleeding_edge.py
|
||||
#
|
||||
# gets exactly distutils/*.py, minus the one explicitly mentioned exclude, and
|
||||
#
|
||||
# distutils/*.py
|
||||
# distutils/ !bleeding_edge.py
|
||||
#
|
||||
# coincidentally does the same, but only because there can only be one file
|
||||
# that matches the exclude pattern. Oh, we'd still like
|
||||
#
|
||||
# distutils *.py !bleeding*.py
|
||||
# distutils/bleeding_ledge.py
|
||||
#
|
||||
# to include distutils/bleeding_ledge.py -- i.e. it should override the
|
||||
# earlier exclude pattern by virtue of appearing later in the manifest. Does
|
||||
# this conflict with the above requirements, ie. that "!RCS" and "!*~" should
|
||||
# apply everywhere? Hmm, I think it doesn't have to, as long as we're smart
|
||||
# about it. Consequence:
|
||||
#
|
||||
# . !RCS !CVS
|
||||
# distutils *
|
||||
#
|
||||
# will go ahead and include RCS and CVS files under distutils, but
|
||||
#
|
||||
# distutils *
|
||||
# . !RCS !CVS
|
||||
#
|
||||
# will do the right thing. Hmmm. I think that's OK, and an inevitable
|
||||
# consequence of the ability to override exclusions.
|
||||
|
||||
# OK, new crack at the search algorithm.
|
||||
#
|
||||
# for pattern in manifest:
|
||||
# if dir-pattern: # ie. first word is a directory (incl. "."!)
|
||||
# dir = first word on line
|
||||
# patterns = rest of line
|
||||
# if patterns:
|
||||
# for dpattern in patterns:
|
||||
# if exclude-pattern:
|
||||
# remove from files anything matching dpattern (including pruning
|
||||
# subtrees rooted at directories that match dpattern)
|
||||
# else:
|
||||
# files.append (recursive_glob (dir, dpattern))
|
||||
# else:
|
||||
# files.append (recursive_glob (dir, '*')
|
||||
#
|
||||
# elif include-pattern: # it's a "simple include pattern"
|
||||
# files.append (glob (pattern))
|
||||
#
|
||||
# else: # it's a "simple exclude pattern"
|
||||
# remove from files anything matching pattern
|
||||
|
||||
# The two removal algorithms might be a bit tricky:
|
||||
#
|
||||
# "remove simple exclude pattern":
|
||||
# for f in files:
|
||||
# if f matches pattern:
|
||||
# delete it
|
||||
#
|
||||
# "remove recursive exclude pattern":
|
||||
# for f in files:
|
||||
#
|
||||
# t = tail (f)
|
||||
# while t:
|
||||
# if t matches pattern:
|
||||
# delete current file
|
||||
# continue
|
||||
# t = tail (t)
|
||||
#
|
||||
# Well, that was an interesting mental exercise. I'm not completely
|
||||
# convinced it will work, nor am I convinced this level of complexity
|
||||
# is necessary. If you want to exclude RCS or CVS directories, just
|
||||
# don't bloody include them!
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue