diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x[-rw-r--r--] | scripts/import_po.py | 2 | ||||
| -rwxr-xr-x[-rw-r--r--] | scripts/nikola.bat | 0 | ||||
| -rwxr-xr-x | scripts/set_version.py | 36 |
3 files changed, 37 insertions, 1 deletions
diff --git a/scripts/import_po.py b/scripts/import_po.py index 6514391..89e1089 100644..100755 --- a/scripts/import_po.py +++ b/scripts/import_po.py @@ -12,7 +12,7 @@ os.system("tx pull -a") trans_files = glob(os.path.join('translations', 'nikola.messages', '*.po')) for fname in trans_files: lang = os.path.splitext(os.path.basename(fname))[0].lower() - outf = os.path.join('nikola', 'data', 'themes', 'default', + outf = os.path.join('nikola', 'data', 'themes', 'base', 'messages', 'messages_{0}.py'.format(lang)) po = polib.pofile(fname) lines = """# -*- encoding:utf-8 -*- diff --git a/scripts/nikola.bat b/scripts/nikola.bat index 0aad2d4..0aad2d4 100644..100755 --- a/scripts/nikola.bat +++ b/scripts/nikola.bat diff --git a/scripts/set_version.py b/scripts/set_version.py new file mode 100755 index 0000000..e34c7ae --- /dev/null +++ b/scripts/set_version.py @@ -0,0 +1,36 @@ +#!/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 codecs +import os +import re +import sys +import glob + + +def sed_like_thing(pattern, repl, path): + """Like re.sub but applies to a file instead of a string.""" + + with codecs.open(path, 'rb', 'utf8') as inf: + data = inf.read() + + data = re.sub(pattern, repl, data) + + with codecs.open(path, 'wb+', 'utf8') as outf: + outf.write(data) + +if __name__ == "__main__": + print("New version number: ", end="") + sys.stdout.flush() + version = sys.stdin.readline().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('nikola', '__init__.py')) + sed_like_thing('New in Master', 'New in {0}'.format(version), 'CHANGES.txt') + os.system("help2man -h help -N --version-string='{0}' nikola > {1}".format(version, os.path.join('docs', 'man', 'nikola.1'))) |
