diff options
Diffstat (limited to 'pbr/hooks/files.py')
-rw-r--r-- | pbr/hooks/files.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pbr/hooks/files.py b/pbr/hooks/files.py index fb6a9bf..ba24aac 100644 --- a/pbr/hooks/files.py +++ b/pbr/hooks/files.py @@ -50,6 +50,25 @@ class FilesConfig(base.BaseConfig): self.config['data_files'] = self.data_files super(FilesConfig, self).save() + def expand_globs(self): + finished = [] + for line in self.data_files.split("\n"): + if line.rstrip().endswith('*') and '=' in line: + (target, source_glob) = line.split('=') + source_prefix = source_glob.strip()[:-1] + target = target.strip() + if not target.endswith(os.path.sep): + target += os.path.sep + for (dirpath, dirnames, fnames) in os.walk(source_prefix): + finished.append( + "%s = " % dirpath.replace(source_prefix, target)) + finished.extend( + [" %s" % os.path.join(dirpath, f) for f in fnames]) + else: + finished.append(line) + + self.data_files = "\n".join(finished) + def add_man_path(self, man_path): self.data_files = "%s\n%s =" % (self.data_files, man_path) @@ -71,6 +90,8 @@ class FilesConfig(base.BaseConfig): if os.path.isdir(package): self.config['packages'] = find_package.smart_find_packages(package) + self.expand_globs() + if 'manpages' in self.pbr_config: man_sections = self.get_man_sections() for (section, pages) in man_sections.items(): |