blob: 76624e10f3d77f19d3598973682d315837096375 [file] [log] [blame]
hardlyb1e7e142014-08-06 00:43:51 +03001#!/usr/bin/python2.7
2
3import os
hardlyb1e7e142014-08-06 00:43:51 +03004import fileinput
hardlyb1e7e142014-08-06 00:43:51 +03005
onqtame6d0d512016-04-27 23:23:16 +03006# the version of the release
onqtame8bdda42016-06-01 15:12:36 +03007with open("version.txt") as f: version = f.read()
onqtame6d0d512016-04-27 23:23:16 +03008
onqtame8bdda42016-06-01 15:12:36 +03009def getVersionTuple(v):
10 return tuple(map(int, (v.split("."))))
11
12version_major = str(getVersionTuple(version)[0])
13version_minor = str(getVersionTuple(version)[1])
14version_patch = str(getVersionTuple(version)[2])
onqtame6d0d512016-04-27 23:23:16 +030015
16# update version in the header file
onqtame8bdda42016-06-01 15:12:36 +030017print("updating the version in the header file")
onqtame6d0d512016-04-27 23:23:16 +030018doctest_contents = ""
onqtame8bdda42016-06-01 15:12:36 +030019for line in fileinput.input(["../doctest/parts/doctest_fwd.h"]):
onqtamf3a680f2016-04-30 03:15:07 +030020 if line.startswith("#define DOCTEST_VERSION_MAJOR "):
onqtame6d0d512016-04-27 23:23:16 +030021 doctest_contents += "#define DOCTEST_VERSION_MAJOR " + version_major + "\n"
onqtamf3a680f2016-04-30 03:15:07 +030022 elif line.startswith("#define DOCTEST_VERSION_MINOR "):
onqtame6d0d512016-04-27 23:23:16 +030023 doctest_contents += "#define DOCTEST_VERSION_MINOR " + version_minor + "\n"
onqtamf3a680f2016-04-30 03:15:07 +030024 elif line.startswith("#define DOCTEST_VERSION_PATCH "):
onqtame6d0d512016-04-27 23:23:16 +030025 doctest_contents += "#define DOCTEST_VERSION_PATCH " + version_patch + "\n"
onqtamd1737e42016-08-01 19:05:07 +030026 elif line.startswith("#define DOCTEST_VERSION_STR "):
27 doctest_contents += "#define DOCTEST_VERSION_STR \"" + version + "\"\n"
onqtame6d0d512016-04-27 23:23:16 +030028 else:
29 doctest_contents += line
30
onqtame8bdda42016-06-01 15:12:36 +030031readme = open("../doctest/parts/doctest_fwd.h", "w")
onqtame6d0d512016-04-27 23:23:16 +030032readme.write(doctest_contents)
33readme.close()
34
hardlyb1e7e142014-08-06 00:43:51 +030035# run generate_html.py
onqtam8126b562016-05-27 17:01:15 +030036print("generating html documentation from markdown")
37os.system("python generate_html.py")