Skip to content

Commit

Permalink
generate templates relative to source dir
Browse files Browse the repository at this point in the history
  • Loading branch information
shafeequ.ahmed committed May 11, 2020
1 parent d7d6979 commit 21f845e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions z3c/recipe/filetemplate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,16 @@ def __init__(self, buildout, name, options):
self.actions = [] # each entry is tuple of
# (relative path, source last-modified-time, mode)
if self.recursive:
for root, dirname, names in os.walk(self.source_dir):
relative_prefix = dirname[len(self.source_dir)+1:]
# def visit(ignored, dirname, names):
for directory, dirnames, names in os.walk(self.source_dir):
relative_prefix = directory[len(self.source_dir)+1:]
if relative_prefix in self.exclude_dirs:
# exclude current directory and its subdirectories
del names[:]
return
file_info = {}
for name in names:
val = os.path.join(root, name)
val = os.path.join(relative_prefix, name)
source = os.path.join(self.source_dir, val)
statinfo = os.stat(source)
last_modified = statinfo.st_mtime
Expand Down Expand Up @@ -551,4 +552,4 @@ def _relative_depth(common, path):
break
n += 1
path = dirname
return n
return n

0 comments on commit 21f845e

Please sign in to comment.