[Python-checkins] CVS: distutils/distutils filelist.py,1.7,1.8
Greg Ward
python-dev@python.org
Mon, 25 Sep 2000 19:02:54 -0700
Update of /cvsroot/python/distutils/distutils
In directory slayer.i.sourceforge.net:/tmp/cvs-serv25577
Modified Files:
filelist.py
Log Message:
Standardize whitespace in function calls.
Index: filelist.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/filelist.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** filelist.py 2000/07/30 01:45:42 1.7
--- filelist.py 2000/09/26 02:02:51 1.8
***************
*** 56,60 ****
def __warn (self, msg):
! sys.stderr.write ("warning: %s\n" % msg)
def __debug_print (self, msg):
--- 56,60 ----
def __warn (self, msg):
! sys.stderr.write("warning: %s\n" % msg)
def __debug_print (self, msg):
***************
*** 88,92 ****
def remove_duplicates (self):
# Assumes list has been sorted!
! for i in range (len(self.files)-1, 0, -1):
if self.files[i] == self.files[i-1]:
del self.files[i]
--- 88,92 ----
def remove_duplicates (self):
# Assumes list has been sorted!
! for i in range(len(self.files)-1, 0, -1):
if self.files[i] == self.files[i-1]:
del self.files[i]
***************
*** 96,100 ****
def _parse_template_line (self, line):
! words = string.split (line)
action = words[0]
--- 96,100 ----
def _parse_template_line (self, line):
! words = string.split(line)
action = words[0]
***************
*** 103,107 ****
if action in ('include', 'exclude',
'global-include', 'global-exclude'):
! if len (words) < 2:
raise DistutilsTemplateError, \
"'%s' expects <pattern1> <pattern2> ..." % action
--- 103,107 ----
if action in ('include', 'exclude',
'global-include', 'global-exclude'):
! if len(words) < 2:
raise DistutilsTemplateError, \
"'%s' expects <pattern1> <pattern2> ..." % action
***************
*** 110,114 ****
elif action in ('recursive-include', 'recursive-exclude'):
! if len (words) < 3:
raise DistutilsTemplateError, \
"'%s' expects <dir> <pattern1> <pattern2> ..." % action
--- 110,114 ----
elif action in ('recursive-include', 'recursive-exclude'):
! if len(words) < 3:
raise DistutilsTemplateError, \
"'%s' expects <dir> <pattern1> <pattern2> ..." % action
***************
*** 118,122 ****
elif action in ('graft', 'prune'):
! if len (words) != 2:
raise DistutilsTemplateError, \
"'%s' expects a single <dir_pattern>" % action
--- 118,122 ----
elif action in ('graft', 'prune'):
! if len(words) != 2:
raise DistutilsTemplateError, \
"'%s' expects a single <dir_pattern>" % action
***************
*** 147,151 ****
self.debug_print("include " + string.join(patterns))
for pattern in patterns:
! if not self.include_pattern (pattern, anchor=1):
self.warn("no files found matching '%s'" % pattern)
--- 147,151 ----
self.debug_print("include " + string.join(patterns))
for pattern in patterns:
! if not self.include_pattern(pattern, anchor=1):
self.warn("no files found matching '%s'" % pattern)
***************
*** 153,157 ****
self.debug_print("exclude " + string.join(patterns))
for pattern in patterns:
! if not self.exclude_pattern (pattern, anchor=1):
self.warn(
"no previously-included files found matching '%s'"%
--- 153,157 ----
self.debug_print("exclude " + string.join(patterns))
for pattern in patterns:
! if not self.exclude_pattern(pattern, anchor=1):
self.warn(
"no previously-included files found matching '%s'"%
***************
*** 161,173 ****
self.debug_print("global-include " + string.join(patterns))
for pattern in patterns:
! if not self.include_pattern (pattern, anchor=0):
! self.warn (("no files found matching '%s' " +
! "anywhere in distribution") %
! pattern)
elif action == 'global-exclude':
self.debug_print("global-exclude " + string.join(patterns))
for pattern in patterns:
! if not self.exclude_pattern (pattern, anchor=0):
self.warn(("no previously-included files matching '%s' " +
"found anywhere in distribution") %
--- 161,173 ----
self.debug_print("global-include " + string.join(patterns))
for pattern in patterns:
! if not self.include_pattern(pattern, anchor=0):
! self.warn(("no files found matching '%s' " +
! "anywhere in distribution") %
! pattern)
elif action == 'global-exclude':
self.debug_print("global-exclude " + string.join(patterns))
for pattern in patterns:
! if not self.exclude_pattern(pattern, anchor=0):
self.warn(("no previously-included files matching '%s' " +
"found anywhere in distribution") %
***************
*** 178,183 ****
(dir, string.join(patterns)))
for pattern in patterns:
! if not self.include_pattern (pattern, prefix=dir):
! self.warn (("no files found matching '%s' " +
"under directory '%s'") %
(pattern, dir))
--- 178,183 ----
(dir, string.join(patterns)))
for pattern in patterns:
! if not self.include_pattern(pattern, prefix=dir):
! self.warn(("no files found matching '%s' " +
"under directory '%s'") %
(pattern, dir))
***************
*** 191,199 ****
"found under directory '%s'") %
(pattern, dir))
!
elif action == 'graft':
self.debug_print("graft " + dir_pattern)
if not self.include_pattern(None, prefix=dir_pattern):
! self.warn ("no directories found matching '%s'" % dir_pattern)
elif action == 'prune':
--- 191,199 ----
"found under directory '%s'") %
(pattern, dir))
!
elif action == 'graft':
self.debug_print("graft " + dir_pattern)
if not self.include_pattern(None, prefix=dir_pattern):
! self.warn("no directories found matching '%s'" % dir_pattern)
elif action == 'prune':
***************
*** 213,218 ****
def include_pattern (self, pattern,
! anchor=1, prefix=None, is_regex=0):
!
"""Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern. Patterns
--- 213,217 ----
def include_pattern (self, pattern,
! anchor=1, prefix=None, is_regex=0):
"""Select strings (presumably filenames) from 'self.files' that
match 'pattern', a Unix-style wildcard (glob) pattern. Patterns
***************
*** 240,244 ****
"""
files_found = 0
! pattern_re = translate_pattern (pattern, anchor, prefix, is_regex)
self.debug_print("include_pattern: applying regex r'%s'" %
pattern_re.pattern)
--- 239,243 ----
"""
files_found = 0
! pattern_re = translate_pattern(pattern, anchor, prefix, is_regex)
self.debug_print("include_pattern: applying regex r'%s'" %
pattern_re.pattern)
***************
*** 249,255 ****
for name in self.allfiles:
! if pattern_re.search (name):
self.debug_print(" adding " + name)
! self.files.append (name)
files_found = 1
--- 248,254 ----
for name in self.allfiles:
! if pattern_re.search(name):
self.debug_print(" adding " + name)
! self.files.append(name)
files_found = 1
***************
*** 268,276 ****
"""
files_found = 0
! pattern_re = translate_pattern (pattern, anchor, prefix, is_regex)
self.debug_print("exclude_pattern: applying regex r'%s'" %
pattern_re.pattern)
! for i in range (len(self.files)-1, -1, -1):
! if pattern_re.search (self.files[i]):
self.debug_print(" removing " + self.files[i])
del self.files[i]
--- 267,275 ----
"""
files_found = 0
! pattern_re = translate_pattern(pattern, anchor, prefix, is_regex)
self.debug_print("exclude_pattern: applying regex r'%s'" %
pattern_re.pattern)
! for i in range(len(self.files)-1, -1, -1):
! if pattern_re.search(self.files[i]):
self.debug_print(" removing " + self.files[i])
del self.files[i]
***************
*** 300,308 ****
while stack:
dir = pop()
! names = os.listdir (dir)
for name in names:
if dir != os.curdir: # avoid the dreaded "./" syndrome
! fullname = os.path.join (dir, name)
else:
fullname = name
--- 299,307 ----
while stack:
dir = pop()
! names = os.listdir(dir)
for name in names:
if dir != os.curdir: # avoid the dreaded "./" syndrome
! fullname = os.path.join(dir, name)
else:
fullname = name
***************
*** 312,318 ****
mode = stat[ST_MODE]
if S_ISREG(mode):
! list.append (fullname)
elif S_ISDIR(mode) and not S_ISLNK(mode):
! push (fullname)
return list
--- 311,317 ----
mode = stat[ST_MODE]
if S_ISREG(mode):
! list.append(fullname)
elif S_ISDIR(mode) and not S_ISLNK(mode):
! push(fullname)
return list
***************
*** 325,329 ****
platform-specific).
"""
! pattern_re = fnmatch.translate (pattern)
# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which
--- 324,328 ----
platform-specific).
"""
! pattern_re = fnmatch.translate(pattern)
# '?' and '*' in the glob pattern become '.' and '.*' in the RE, which
***************
*** 334,338 ****
# XXX currently the "special characters" are just slash -- i.e. this is
# Unix-only.
! pattern_re = re.sub (r'(^|[^\\])\.', r'\1[^/]', pattern_re)
return pattern_re
--- 333,337 ----
# XXX currently the "special characters" are just slash -- i.e. this is
# Unix-only.
! pattern_re = re.sub(r'(^|[^\\])\.', r'\1[^/]', pattern_re)
return pattern_re
***************
*** 353,368 ****
if pattern:
! pattern_re = glob_to_re (pattern)
else:
pattern_re = ''
if prefix is not None:
! prefix_re = (glob_to_re (prefix))[0:-1] # ditch trailing $
! pattern_re = "^" + os.path.join (prefix_re, ".*" + pattern_re)
else: # no prefix -- respect anchor flag
if anchor:
pattern_re = "^" + pattern_re
! return re.compile (pattern_re)
# translate_pattern ()
--- 352,367 ----
if pattern:
! pattern_re = glob_to_re(pattern)
else:
pattern_re = ''
if prefix is not None:
! prefix_re = (glob_to_re(prefix))[0:-1] # ditch trailing $
! pattern_re = "^" + os.path.join(prefix_re, ".*" + pattern_re)
else: # no prefix -- respect anchor flag
if anchor:
pattern_re = "^" + pattern_re
! return re.compile(pattern_re)
# translate_pattern ()