2020-01-04 14:21:38 +00:00
|
|
|
#!/usr/bin/env python3
|
2020-03-12 15:23:25 +00:00
|
|
|
# This file is a part of toml++ and is subject to the the terms of the MIT license.
|
2021-01-02 15:48:47 +00:00
|
|
|
# Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
|
2020-03-12 15:23:25 +00:00
|
|
|
# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
|
2020-04-10 16:46:00 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
2020-01-04 14:21:38 +00:00
|
|
|
|
|
|
|
import sys
|
2020-06-25 14:33:01 +00:00
|
|
|
import utils
|
2021-04-18 12:04:46 +00:00
|
|
|
from pathlib import Path
|
2020-01-11 21:15:24 +00:00
|
|
|
|
|
|
|
|
2020-01-04 14:21:38 +00:00
|
|
|
def main():
|
2021-04-18 12:04:46 +00:00
|
|
|
hpp_path = Path(utils.entry_script_dir(), '..', 'toml.hpp').resolve()
|
|
|
|
hash1 = utils.sha1(utils.read_all_text_from_file(hpp_path, logger=True))
|
|
|
|
print(rf'Hash 1: {hash1}')
|
|
|
|
utils.run_python_script(r'generate_single_header.py')
|
|
|
|
hash2 = utils.sha1(utils.read_all_text_from_file(hpp_path, logger=True))
|
|
|
|
print(rf'Hash 2: {hash2}')
|
2020-01-04 14:21:38 +00:00
|
|
|
if (hash1 != hash2):
|
|
|
|
print(
|
|
|
|
"toml.hpp wasn't up-to-date!\nRun generate_single_header.py before your commit to prevent this error.",
|
|
|
|
file=sys.stderr
|
|
|
|
)
|
|
|
|
return 1
|
|
|
|
print("toml.hpp was up-to-date")
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2021-04-18 12:04:46 +00:00
|
|
|
utils.run(main, verbose=True)
|