From cd87a5b61a1601aee9319f355380fef846b7ccbf Mon Sep 17 00:00:00 2001 From: LT Date: Wed, 5 Jan 2022 23:59:10 +0800 Subject: [PATCH 1/2] Fix the get_xtext_path() function in compiler_config.py --- src/quingo/core/compiler_config.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/quingo/core/compiler_config.py b/src/quingo/core/compiler_config.py index c917380..c9a7292 100644 --- a/src/quingo/core/compiler_config.py +++ b/src/quingo/core/compiler_config.py @@ -47,7 +47,8 @@ def download_latest_quingoc(): quingo_err("failed to download quingoc from gitee.") return False - quingoc_url = quingoc_asset['browser_download_url'] + '/' + quingoc_asset['name'] + quingoc_url = quingoc_asset['browser_download_url'] + \ + '/' + quingoc_asset['name'] quingoc_response = requests.get(quingoc_url) except Exception as e: @@ -67,33 +68,36 @@ def retrieve_compiler_path_from_file(config_file): with config_file.open('r') as f: compiler_path = f.read() if not Path(compiler_path).exists(): - quingo_err("The compiler path is incorrect: {}".format(compiler_path)) + quingo_err( + "The compiler path is incorrect: {}".format(compiler_path)) return None return compiler_path def get_mlir_path(): if gc.mlir_compiler_config_path.exists(): - read_path = retrieve_compiler_path_from_file(gc.mlir_compiler_config_path) + read_path = retrieve_compiler_path_from_file( + gc.mlir_compiler_config_path) if read_path is not None: return read_path # failed to read the path from the file, find the compiler executable from default path - quingoc_path = distutils.spawn.find_executable('quingoc', str(gc.default_mlir_compiler_path.parent)) + quingoc_path = distutils.spawn.find_executable( + 'quingoc', str(gc.default_mlir_compiler_path.parent)) if quingoc_path is not None: return quingoc_path - #find the compiler executable from the system directly + # find the compiler executable from the system directly quingoc_path = distutils.spawn.find_executable('quingoc') return quingoc_path -def get_xtext_path(self): +def get_xtext_path(): if not gc.xtext_compiler_config_path.exists(): quingo_err('cannot find the file specifying the xtext compiler path.') return None - - return self.retrieve_compiler_path_from_file(gc.xtext_compiler_config_path) + read_path = retrieve_compiler_path_from_file(gc.xtext_compiler_config_path) + return read_path def set_xtext_compiler_path(xtext_path_str): -- Gitee From e967eb43f0f5362f27b38304d7cf9f6a93ddbe92 Mon Sep 17 00:00:00 2001 From: LT Date: Thu, 6 Jan 2022 10:22:48 +0800 Subject: [PATCH 2/2] Update the get_xtext_path function in the compiler_config.py . --- src/quingo/core/compiler_config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/quingo/core/compiler_config.py b/src/quingo/core/compiler_config.py index c9a7292..f0a66d8 100644 --- a/src/quingo/core/compiler_config.py +++ b/src/quingo/core/compiler_config.py @@ -96,8 +96,7 @@ def get_xtext_path(): if not gc.xtext_compiler_config_path.exists(): quingo_err('cannot find the file specifying the xtext compiler path.') return None - read_path = retrieve_compiler_path_from_file(gc.xtext_compiler_config_path) - return read_path + return retrieve_compiler_path_from_file(gc.xtext_compiler_config_path) def set_xtext_compiler_path(xtext_path_str): -- Gitee