aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2012-12-23 01:47:45 (GMT)
committerBrian Dolbec <dolsen@gentoo.org>2012-12-23 01:47:45 (GMT)
commit9557946ecdb28ebebc38f664dd770a690e50d64a (patch)
tree3affbbfbc3111b26d7f1bbadc5ba971a467dee21
parentMake the man page titles more consistent and enable setup.py to set the manpa... (diff)
downloadgentoolkit-9557946ecdb28ebebc38f664dd770a690e50d64a.zip
gentoolkit-9557946ecdb28ebebc38f664dd770a690e50d64a.tar.gz
gentoolkit-9557946ecdb28ebebc38f664dd770a690e50d64a.tar.bz2
doh! fix setup.py breakage
-rwxr-xr-xsetup.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/setup.py b/setup.py
index 620ded8..c70d580 100755
--- a/setup.py
+++ b/setup.py
@@ -26,13 +26,13 @@ except ImportError:
# Bash files that need `VERSION=""` subbed, relative to this dir:
-bash_scripts = [os.path.join(cwd, path) for path in (
+bash_scripts = [(os.path.join(cwd, path), 'VERSION=') for path in (
'bin/euse',
'bin/revdep-rebuild.sh'
)]
# Python files that need `__version__ = ""` subbed, relative to this dir:
-python_scripts = [(os.path.join(cwd, path), None) for path in (
+python_scripts = [(os.path.join(cwd, path), '__version__ = ') for path in (
'bin/eclean',
'bin/epkginfo',
'bin/glsa-check',
@@ -67,31 +67,27 @@ class set_version(core.Command):
pass
def run(self):
- ver = 'svn' if __version__ == '9999' else __version__
+ ver = 'git' if __version__ == '9999' else __version__
print("Setting version to %s" % ver)
def sub(files, pattern):
for f in files:
updated_file = []
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 %f[1], '"%s"' % ver, line, 1)
if newline != line:
#log.info("%s: %s" % (f, newline))
- print("%s: %s" % (f, newline))
+ print("%s: %s" % (f[0], newline.strip('\n')))
updated_file.append(newline)
- with io.open(f, 'w', 1, 'utf_8') as s:
+ with io.open(f[0], 'w', 1, 'utf_8') as s:
s.writelines(updated_file)
quote = r'[\'"]{1}'
- bash_re = r'(?<=VERSION=)' + quote + '[^\'"]*' + quote
+ bash_re = r'(?<=%s)' + quote + '[^\'"]*' + quote
sub(bash_scripts, bash_re)
- python_re = r'(?<=^__version__ = )' + quote + '[^\'"]*' + quote
+ python_re = r'(?<=^%s)' + quote + '[^\'"]*' + quote
sub(python_scripts, python_re)
- man_re = r'(?<=^.TH "[.*]" "[0-9]" )' + quote + '[^\'"]*' + quote
+ man_re = r'(?<=^.TH "%s" "[0-9]" )' + quote + '[^\'"]*' + quote
sub(manpages, man_re)