diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-07-27 14:57:05 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-07-27 14:57:05 +0000 |
commit | 54ca83a2e87248420de873ca83a577cde3132711 (patch) | |
tree | 5a789b0ed077736c4eadf02dc65a8d2631acecdc /pbr/hooks/files.py | |
parent | a8cffe5bf56a151b919d1f2cba1a7e57e6204775 (diff) | |
parent | 761b27fee6ed0d3082d043dff2a7c61436a7aab9 (diff) | |
download | pbr-54ca83a2e87248420de873ca83a577cde3132711.tar.gz |
Merge "Add support for globbing in data files"
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(): |