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