From 0c977565ef0462676a070daddda2bae8a9f8e15a Mon Sep 17 00:00:00 2001 From: chunlin Date: Thu, 15 May 2025 11:44:49 +0800 Subject: [PATCH] add install service. --- src/installService.py | 6 ++++++ src/moduleController.py | 13 +------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/installService.py b/src/installService.py index 5ba955e..3e2ede5 100644 --- a/src/installService.py +++ b/src/installService.py @@ -284,7 +284,13 @@ chmod +x {install_script} self.tool.mkdirs(attach_module_path) return attach_module_path + def is_dir_empty(self, directory): + return not os.listdir(directory) + def gen_module_file(self, install_path, software_info, env_info): + if self.is_dir_empty(install_path): + print(f"install path {install_path} is empty, module file not generated") + return stype = software_info.software_type # 构建配置对象 deps = self.dependencies.split() if self.dependencies else [] diff --git a/src/moduleController.py b/src/moduleController.py index a4610b4..e40f3b8 100644 --- a/src/moduleController.py +++ b/src/moduleController.py @@ -32,19 +32,8 @@ class ModulefileEngine: ] return "\n".join(filter(None, sections)) - def _generate_paths2(self, config: ModuleConfig) -> str: - if config.software_name == "hpckit": - return "" - path_config = PathOrganizer.auto_discover(config.install_root) - return f""" -prepend-path PATH {PathOrganizer.format_paths(path_config['bins'])} -prepend-path LD_LIBRARY_PATH {PathOrganizer.format_paths(path_config['libs'])} -prepend-path C_INCLUDE_PATH {PathOrganizer.format_paths(path_config['includes'])} -prepend-path INCLUDE {PathOrganizer.format_paths(path_config['includes'])} -""" - def _generate_paths(self, config: ModuleConfig) -> str: - if config.software_name == "hpckit": + if config.software_name == "hpckit" or "anaconda" in config.software_name: return "" path_config = PathOrganizer.auto_discover(config.install_root) -- Gitee