summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2012-12-22 17:21:48 -0800
committerBrian Dolbec <dolsen@gentoo.org>2012-12-22 17:21:48 -0800
commitfde00b46e7e01cb7fc73f336df79253ab27009c7 (patch)
treee66cc305e9d717d3391127960b3113a8cd2428be /setup.py
parent35132cb5822d4209cec0272ccc875a45bf830cf8 (diff)
downloadgentoolkit-fde00b46e7e01cb7fc73f336df79253ab27009c7.tar.gz
Make the man page titles more consistent and enable setup.py to set the manpage versions.
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index d07ab98..620ded8 100755
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,7 @@ bash_scripts = [os.path.join(cwd, path) for path in (
)]
# Python files that need `__version__ = ""` subbed, relative to this dir:
-python_scripts = [os.path.join(cwd, path) for path in (
+python_scripts = [(os.path.join(cwd, path), None) for path in (
'bin/eclean',
'bin/epkginfo',
'bin/glsa-check',
@@ -43,6 +43,17 @@ python_scripts = [os.path.join(cwd, path) for path in (
'pym/gentoolkit/revdep_rebuild/__init__.py'
)]
+manpages = [(os.path.join(cwd, path[0]), path[1]) for path in (
+ ('man/eclean.1', 'ECLEAN'),
+ ('man/enalyze.1', 'ENALYZE'),
+ ('man/epkginfo.1', 'EPKGINFO'),
+ ('man/equery.1', 'EQUERY'),
+ ('man/eread.1', 'EREAD'),
+ ('man/eshowkw.1', 'ESHOWKW'),
+ ('man/euse.1', 'EUSE'),
+ ('man/glsa-check.1', 'GLSA-CHECK'),
+ ('man/revdep-rebuild.1', 'REVDEP-REBUILD'),
+)]
class set_version(core.Command):
"""Set python __version__ and bash VERSION to our __version__."""
@@ -61,9 +72,13 @@ class set_version(core.Command):
def sub(files, pattern):
for f in files:
updated_file = []
- with io.open(f, 'r', 1, 'utf_8') as s:
+ with io.open(f[0], 'r', 1, 'utf_8') as s:
+ if f[1]:
+ _pattern = pattern % f[1]
+ else:
+ _pattern = pattern
for line in s:
- newline = re.sub(pattern, '"%s"' % ver, line, 1)
+ newline = re.sub(_pattern, '"%s"' % ver, line, 1)
if newline != line:
#log.info("%s: %s" % (f, newline))
print("%s: %s" % (f, newline))
@@ -76,6 +91,8 @@ class set_version(core.Command):
sub(bash_scripts, bash_re)
python_re = r'(?<=^__version__ = )' + quote + '[^\'"]*' + quote
sub(python_scripts, python_re)
+ man_re = r'(?<=^.TH "[.*]" "[0-9]" )' + quote + '[^\'"]*' + quote
+ sub(manpages, man_re)
def load_test():