hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 1 | #!/usr/bin/python2.7 |
| 2 | |
| 3 | import os |
hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 4 | import fileinput |
hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 5 | |
onqtam | e6d0d51 | 2016-04-27 23:23:16 +0300 | [diff] [blame] | 6 | # the version of the release |
onqtam | e8bdda4 | 2016-06-01 15:12:36 +0300 | [diff] [blame] | 7 | with open("version.txt") as f: version = f.read() |
onqtam | e6d0d51 | 2016-04-27 23:23:16 +0300 | [diff] [blame] | 8 | |
onqtam | e8bdda4 | 2016-06-01 15:12:36 +0300 | [diff] [blame] | 9 | def getVersionTuple(v): |
| 10 | return tuple(map(int, (v.split(".")))) |
| 11 | |
| 12 | version_major = str(getVersionTuple(version)[0]) |
| 13 | version_minor = str(getVersionTuple(version)[1]) |
| 14 | version_patch = str(getVersionTuple(version)[2]) |
onqtam | e6d0d51 | 2016-04-27 23:23:16 +0300 | [diff] [blame] | 15 | |
| 16 | # update version in the header file |
onqtam | e8bdda4 | 2016-06-01 15:12:36 +0300 | [diff] [blame] | 17 | print("updating the version in the header file") |
onqtam | e6d0d51 | 2016-04-27 23:23:16 +0300 | [diff] [blame] | 18 | doctest_contents = "" |
onqtam | e8bdda4 | 2016-06-01 15:12:36 +0300 | [diff] [blame] | 19 | for line in fileinput.input(["../doctest/parts/doctest_fwd.h"]): |
onqtam | f3a680f | 2016-04-30 03:15:07 +0300 | [diff] [blame] | 20 | if line.startswith("#define DOCTEST_VERSION_MAJOR "): |
onqtam | e6d0d51 | 2016-04-27 23:23:16 +0300 | [diff] [blame] | 21 | doctest_contents += "#define DOCTEST_VERSION_MAJOR " + version_major + "\n" |
onqtam | f3a680f | 2016-04-30 03:15:07 +0300 | [diff] [blame] | 22 | elif line.startswith("#define DOCTEST_VERSION_MINOR "): |
onqtam | e6d0d51 | 2016-04-27 23:23:16 +0300 | [diff] [blame] | 23 | doctest_contents += "#define DOCTEST_VERSION_MINOR " + version_minor + "\n" |
onqtam | f3a680f | 2016-04-30 03:15:07 +0300 | [diff] [blame] | 24 | elif line.startswith("#define DOCTEST_VERSION_PATCH "): |
onqtam | e6d0d51 | 2016-04-27 23:23:16 +0300 | [diff] [blame] | 25 | doctest_contents += "#define DOCTEST_VERSION_PATCH " + version_patch + "\n" |
| 26 | else: |
| 27 | doctest_contents += line |
| 28 | |
onqtam | e8bdda4 | 2016-06-01 15:12:36 +0300 | [diff] [blame] | 29 | readme = open("../doctest/parts/doctest_fwd.h", "w") |
onqtam | e6d0d51 | 2016-04-27 23:23:16 +0300 | [diff] [blame] | 30 | readme.write(doctest_contents) |
| 31 | readme.close() |
| 32 | |
onqtam | 43271a6 | 2019-05-06 11:29:37 +0300 | [diff] [blame] | 33 | # update meson file with version |
| 34 | meson_contents = "" |
| 35 | for line in fileinput.input(["../meson.build"]): |
| 36 | if line.startswith("project('doctest'"): |
| 37 | meson_contents += "project('doctest', ['cpp'], version: '" + version + "', meson_version:'>=0.50')\n" |
| 38 | else: |
| 39 | meson_contents += line |
| 40 | |
| 41 | meson = open("../meson.build", "w") |
| 42 | meson.write(meson_contents) |
| 43 | meson.close() |
| 44 | |
hardly | b1e7e14 | 2014-08-06 00:43:51 +0300 | [diff] [blame] | 45 | # run generate_html.py |
onqtam | 8126b56 | 2016-05-27 17:01:15 +0300 | [diff] [blame] | 46 | print("generating html documentation from markdown") |
| 47 | os.system("python generate_html.py") |