From 476b48830118a68a67bbd1e1de3aa0be33d5b2b9 Mon Sep 17 00:00:00 2001 From: myrrc Date: Tue, 22 Sep 2020 18:08:48 +0300 Subject: [PATCH 1/5] fix: resulting files path --- docs/tools/cmake_in_clickhouse_generator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tools/cmake_in_clickhouse_generator.py b/docs/tools/cmake_in_clickhouse_generator.py index 614ac87882c..066ffe08df1 100644 --- a/docs/tools/cmake_in_clickhouse_generator.py +++ b/docs/tools/cmake_in_clickhouse_generator.py @@ -97,9 +97,9 @@ def process_folder(root_path:str, name: str) -> None: process_file(root_path, os.path.join(root, f)) def generate_cmake_flags_files(root_path: str) -> None: - output_file_name: str = root_path + "docs/en/development/cmake-in-clickhouse.md" - header_file_name: str = root_path + "docs/_includes/cmake_in_clickhouse_header.md" - footer_file_name: str = root_path + "docs/_includes/cmake_in_clickhouse_footer.md" + output_file_name: str = os.path.join(root_path, "docs/en/development/cmake-in-clickhouse.md") + header_file_name: str = os.path.join(root_path, "docs/_includes/cmake_in_clickhouse_header.md") + footer_file_name: str = os.path.join(root_path, "docs/_includes/cmake_in_clickhouse_footer.md") process_file(root_path, "CMakeLists.txt") process_file(root_path, "programs/CMakeLists.txt") From ad94e4ae22f8ce9f13bbd83d5e1e8a618b832234 Mon Sep 17 00:00:00 2001 From: myrrc Date: Wed, 23 Sep 2020 14:47:55 +0300 Subject: [PATCH 2/5] fixed default values links --- docs/tools/cmake_in_clickhouse_generator.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/tools/cmake_in_clickhouse_generator.py b/docs/tools/cmake_in_clickhouse_generator.py index 066ffe08df1..51940cf5104 100644 --- a/docs/tools/cmake_in_clickhouse_generator.py +++ b/docs/tools/cmake_in_clickhouse_generator.py @@ -42,10 +42,7 @@ def build_entity(path: str, entity: Entity, line_comment: Tuple[int, str]) -> No if len(default) == 0: formatted_default: str = "`OFF`" elif default[0] == "$": - formatted_default: str = default[2:-1] - formatted_default: str = default_anchor_str.format( - name=formatted_default, - anchor=make_anchor(formatted_default)) + formatted_default: str = "`{}`".format(default[2:-1]) else: formatted_default: str = "`" + default + "`" @@ -91,10 +88,10 @@ def process_file(root_path: str, input_name: str) -> None: build_entity(input_name, entity, get_line_and_comment(entity[0])) def process_folder(root_path:str, name: str) -> None: - for root, _, files in os.walk(name): + for root, _, files in os.walk(os.path.join(root_path, name)): for f in files: if f == "CMakeLists.txt" or ".cmake" in f: - process_file(root_path, os.path.join(root, f)) + process_file(root, f) def generate_cmake_flags_files(root_path: str) -> None: output_file_name: str = os.path.join(root_path, "docs/en/development/cmake-in-clickhouse.md") @@ -122,11 +119,11 @@ def generate_cmake_flags_files(root_path: str) -> None: f.write(entities[k][1] + "\n") ignored_keys.append(k) - f.write("### External libraries\nNote that ClickHouse uses forks of these libraries, see https://github.com/ClickHouse-Extras.\n" + + f.write("\n### External libraries\nNote that ClickHouse uses forks of these libraries, see https://github.com/ClickHouse-Extras.\n" + table_header) for k in sorted_keys: - if k.startswith("ENABLE_") and entities[k][0].startswith("cmake"): + if k.startswith("ENABLE_") and ".cmake" in entities[k][0]: f.write(entities[k][1] + "\n") ignored_keys.append(k) From fef9e0d06d5b6a850b876a90180d097e59c1a528 Mon Sep 17 00:00:00 2001 From: myrrc Date: Wed, 23 Sep 2020 16:53:54 +0300 Subject: [PATCH 3/5] fixed the invalid AMP generation --- docs/tools/cmake_in_clickhouse_generator.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/tools/cmake_in_clickhouse_generator.py b/docs/tools/cmake_in_clickhouse_generator.py index 51940cf5104..62672532cdf 100644 --- a/docs/tools/cmake_in_clickhouse_generator.py +++ b/docs/tools/cmake_in_clickhouse_generator.py @@ -39,6 +39,10 @@ def build_entity(path: str, entity: Entity, line_comment: Tuple[int, str]) -> No if name in entities: return + # cannot escape the { in macro option description -> invalid AMP html + if name == "USE_INTERNAL_${LIB_NAME_UC}_LIBRARY ": + return + if len(default) == 0: formatted_default: str = "`OFF`" elif default[0] == "$": @@ -85,7 +89,7 @@ def process_file(root_path: str, input_name: str) -> None: if matches: for entity in matches: - build_entity(input_name, entity, get_line_and_comment(entity[0])) + build_entity(os.path.join(root_path, input_name), entity, get_line_and_comment(entity[0])) def process_folder(root_path:str, name: str) -> None: for root, _, files in os.walk(os.path.join(root_path, name)): From af50f9d52dd4c12ea4c641940a40563faf69dac0 Mon Sep 17 00:00:00 2001 From: myrrc Date: Wed, 23 Sep 2020 16:58:16 +0300 Subject: [PATCH 4/5] another fix --- docs/tools/cmake_in_clickhouse_generator.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tools/cmake_in_clickhouse_generator.py b/docs/tools/cmake_in_clickhouse_generator.py index 62672532cdf..81851098dc8 100644 --- a/docs/tools/cmake_in_clickhouse_generator.py +++ b/docs/tools/cmake_in_clickhouse_generator.py @@ -40,7 +40,8 @@ def build_entity(path: str, entity: Entity, line_comment: Tuple[int, str]) -> No return # cannot escape the { in macro option description -> invalid AMP html - if name == "USE_INTERNAL_${LIB_NAME_UC}_LIBRARY ": + # Skipping "USE_INTERNAL_${LIB_NAME_UC}_LIBRARY" + if "LIB_NAME_UC" in name: return if len(default) == 0: From df5db10e016563d5508de2585db76b711660e118 Mon Sep 17 00:00:00 2001 From: myrrc Date: Wed, 23 Sep 2020 17:09:34 +0300 Subject: [PATCH 5/5] another better-or-worse fix --- docs/tools/cmake_in_clickhouse_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tools/cmake_in_clickhouse_generator.py b/docs/tools/cmake_in_clickhouse_generator.py index 81851098dc8..bc58a68c409 100644 --- a/docs/tools/cmake_in_clickhouse_generator.py +++ b/docs/tools/cmake_in_clickhouse_generator.py @@ -90,7 +90,7 @@ def process_file(root_path: str, input_name: str) -> None: if matches: for entity in matches: - build_entity(os.path.join(root_path, input_name), entity, get_line_and_comment(entity[0])) + build_entity(os.path.join(root_path[6:], input_name), entity, get_line_and_comment(entity[0])) def process_folder(root_path:str, name: str) -> None: for root, _, files in os.walk(os.path.join(root_path, name)):