diff options
author | Monty Taylor <mordred@inaugust.com> | 2013-04-05 20:46:36 -0400 |
---|---|---|
committer | Jenkins <jenkins@review.openstack.org> | 2013-04-06 01:42:59 +0000 |
commit | 2796f9add5be6e2b2c0b5139070eb746eb05ce4c (patch) | |
tree | e6bb93491b725db7b2a2aae4d6f313476ea6bc01 | |
parent | 5d39f9220aeef1720f7636ea5b4e0fb08ac16aca (diff) | |
download | pbr-2796f9add5be6e2b2c0b5139070eb746eb05ce4c.tar.gz |
Add support for manpages.
Change-Id: I7fc77c48b515437d40f4046324cbff2536296c20
Reviewed-on: https://review.openstack.org/26284
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
-rw-r--r-- | pbr/hooks.py | 21 | ||||
-rw-r--r-- | pbr/packaging.py | 11 |
2 files changed, 30 insertions, 2 deletions
diff --git a/pbr/hooks.py b/pbr/hooks.py index 923b0e4..0b572d6 100644 --- a/pbr/hooks.py +++ b/pbr/hooks.py @@ -51,9 +51,9 @@ pbr.packaging.LocalBuildLatex """ pbr_config = config.get('pbr', dict()) - if ('single-version-externally-mananged' in pbr_config and + if (('single-version-externally-mananged' in pbr_config and pbr_config['single-version-externally-mananged'] in - packaging.TRUE_VALUES): + packaging.TRUE_VALUES) or 'manpages' in pbr_config): config['global']['commands'] = config['global']['commands'] + """ pbr.packaging.DistutilsInstall """ @@ -66,4 +66,21 @@ pbr.packaging.DistutilsInstall files = config.get('files', dict()) files['packages'] = smart_find_packages( files.get('packages', metadata['name'])) + + if 'manpages' in pbr_config: + man_sections = dict() + manpages = pbr_config['manpages'] + data_files = files.get('data_files', '') + for manpage in manpages.split(): + section_number = manpage.strip()[-1] + section = man_sections.get(section_number, list()) + section.append(manpage.strip()) + man_sections[section_number] = section + for (section, pages) in man_sections.items(): + manpath = os.path.join(packaging.get_manpath(), 'man%s' % section) + data_files = "%s\n%s" % (data_files, "%s =" % manpath) + for page in pages: + data_files = "%s\n%s" % (data_files, page) + files['data_files'] = data_files + config['files'] = files diff --git a/pbr/packaging.py b/pbr/packaging.py index 75b14c4..7a2cd76 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -438,3 +438,14 @@ def get_version(package_name, pre_version=None): return version raise Exception("Versioning for this project requires either an sdist" " tarball, or access to an upstream git repository.") + + +def get_manpath(): + manpath = 'share/man' + if os.path.exists(os.path.join(sys.prefix, 'man')): + # This works around a bug with install where it expects every node + # in the relative data directory to be an actual directory, since at + # least Debian derivatives (and probably other platforms as well) + # like to symlink Unixish /usr/local/man to /usr/local/share/man. + manpath = 'man' + return manpath |