diff --git a/src/installService.py b/src/installService.py index 5ba955ec557412938d31f8497fd9afb7efd6dd5f..3e2ede512e72950d3c90d1acd6ae5171d72f9d57 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 a4610b47062306e00ab4c85f2b4fdf3e136d4b16..e40f3b8c6120f8ca1c28d0e1f97f9ef4863c65e1 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)