Skip to content
Snippets Groups Projects
Commit 04857ec7 authored by David Hendriks's avatar David Hendriks
Browse files

added a function to add the build information to the documents

parent ec5b98d8
No related branches found
No related tags found
No related merge requests found
......@@ -881,6 +881,27 @@ def get_help_super(print_help: bool=False, fail_silently: bool=True) -> dict:
return help_all_super_dict
def make_build_text() -> str:
"""
Function to make build text
Returns:
string containing information about the build and the git branch
"""
version_info = return_binary_c_version_info(parsed=True)
git_revision = version_info['miscellaneous']['git_revision']
git_branch = version_info['miscellaneous']['git_branch']
build_datetime = version_info['miscellaneous']['build']
info_string = "This information was obtained by the following binary_c build: \n\t**binary_c git branch**: {}\t**binary_c git revision**: {}\t**Built on**: {}".format(git_branch, git_revision, build_datetime)
return info_string
def write_binary_c_parameter_descriptions_to_rst_file(output_file: str) -> None:
"""
Function that calls the get_help_super() to get the help text/descriptions for all the parameters available in that build.
......@@ -896,6 +917,8 @@ def write_binary_c_parameter_descriptions_to_rst_file(output_file: str) -> None:
# Get the whole arguments dictionary
arguments_dict = get_help_super()
build_info = make_build_text()
if not output_file.endswith(".rst"):
print("Filename doesn't end with .rst, please provide a proper filename")
return None
......@@ -906,6 +929,8 @@ def write_binary_c_parameter_descriptions_to_rst_file(output_file: str) -> None:
print("{}".format("="*len("Binary\\_c parameters")), file=f)
print("The following chapter contains all the parameters that the current version of binary\\_c can handle, along with their descriptions and other properties.", file=f)
print("\n", file=f)
print(build_info, file=f)
print("\n", file=f)
for el in arguments_dict.keys():
print("Section: {}".format(el), file=f)
......@@ -927,6 +952,7 @@ def write_binary_c_parameter_descriptions_to_rst_file(output_file: str) -> None:
print("| **Extra**: {}".format(argdict["rest"]), file=f)
print("", file=f)
########################################################
# logfile functions
########################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment