diff options
| author | 2016-11-15 14:18:46 -0300 | |
|---|---|---|
| committer | 2016-11-15 14:18:46 -0300 | |
| commit | ffb671c61a24a9086343b54bad080e145ff33fc5 (patch) | |
| tree | 2c5291f7a34edf4afdc8e07887a148291bfa3fa1 /scripts/set_version.py | |
| parent | 4e3224c012df9f74f010eb92203520515e8537b9 (diff) | |
New upstream version 7.8.1upstream/7.8.1
Diffstat (limited to 'scripts/set_version.py')
| -rwxr-xr-x | scripts/set_version.py | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/scripts/set_version.py b/scripts/set_version.py deleted file mode 100755 index 7e6c3e0..0000000 --- a/scripts/set_version.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -"""Script to set the version number wherever it's needed before a release.""" - -from __future__ import unicode_literals, print_function -import io -import os -import re -import sys -import glob -import subprocess -import io - - -def sed_like_thing(pattern, repl, path): - """Like re.sub but applies to a file instead of a string.""" - - with io.open(path, 'r', encoding='utf8') as inf: - data = inf.read() - - data = re.sub(pattern, repl, data) - - with io.open(path, 'w+', encoding='utf8') as outf: - outf.write(data) - -if __name__ == "__main__": - inpf = raw_input if sys.version_info[0] == 2 else input - version = inpf("New version number (in format X.Y.Z): ").strip() - - for doc in glob.glob(os.path.join("docs/*.txt")): - sed_like_thing(":Version: .*", ":Version: {0}".format(version), doc) - - sed_like_thing("version='.+'", "version='{0}'".format(version), 'setup.py') - sed_like_thing("version = .*", "version = '{0}'".format(version), os.path.join('docs', 'sphinx', 'conf.py')) - sed_like_thing("release = .*", "release = '{0}'".format(version), os.path.join('docs', 'sphinx', 'conf.py')) - sed_like_thing('__version__ = ".*"', '__version__ = "{0}"'.format(version), os.path.join('nikola', '__init__.py')) - sed_like_thing('New in master', 'New in v{0}'.format(version), 'CHANGES.txt') - sed_like_thing(':Version: .*', ':Version: Nikola v{0}'.format(version), os.path.join('docs', 'man', 'nikola.rst')) - man = subprocess.check_output(["rst2man", os.path.join('docs', 'man', 'nikola.rst')]) - with io.open(os.path.join('docs', 'man', 'nikola.1'), 'w', encoding='utf-8') as fh: - try: - man = man.decode('utf-8') - except AttributeError: - pass - fh.write(man) - subprocess.call(["gzip", "-f", os.path.join('docs', 'man', 'nikola.1')]) |
