|
75 | 75 | from easybuild.tools.filetools import diff_files, download_file, encode_class_name, extract_file |
76 | 76 | from easybuild.tools.filetools import find_backup_name_candidate, get_source_tarball_from_git, is_alt_pypi_url |
77 | 77 | from easybuild.tools.filetools import is_sha256_checksum, mkdir, move_file, move_logs, read_file, remove_dir |
78 | | -from easybuild.tools.filetools import remove_file, rmtree2, verify_checksum, weld_paths, write_file |
| 78 | +from easybuild.tools.filetools import remove_file, rmtree2, verify_checksum, weld_paths, write_file, dir_contains_files |
79 | 79 | from easybuild.tools.hooks import BUILD_STEP, CLEANUP_STEP, CONFIGURE_STEP, EXTENSIONS_STEP, FETCH_STEP, INSTALL_STEP |
80 | 80 | from easybuild.tools.hooks import MODULE_STEP, PACKAGE_STEP, PATCH_STEP, PERMISSIONS_STEP, POSTITER_STEP, POSTPROC_STEP |
81 | 81 | from easybuild.tools.hooks import PREPARE_STEP, READY_STEP, SANITYCHECK_STEP, SOURCE_STEP, TEST_STEP, TESTCASES_STEP |
@@ -1305,15 +1305,14 @@ def make_module_req(self): |
1305 | 1305 | if path and not self.dry_run: |
1306 | 1306 | paths = sorted(glob.glob(path)) |
1307 | 1307 | if paths and key in keys_requiring_files: |
1308 | | - self.log.info("Only retaining paths for %s that include at least one file: %s", key, paths) |
1309 | | - # only retain paths that include at least one file |
1310 | | - retained_paths = [] |
1311 | | - for path in paths: |
1312 | | - full_path = os.path.join(self.installdir, path) |
1313 | | - if os.path.isdir(full_path): |
1314 | | - if any(os.path.isfile(os.path.join(full_path, x)) for x in os.listdir(full_path)): |
1315 | | - retained_paths.append(path) |
1316 | | - self.log.info("Retained paths for %s: %s", key, retained_paths) |
| 1308 | + # only retain paths that contain at least one file |
| 1309 | + retained_paths = [ |
| 1310 | + path for path in paths |
| 1311 | + if os.path.isdir(os.path.join(self.installdir, path)) |
| 1312 | + and dir_contains_files(os.path.join(self.installdir, path)) |
| 1313 | + ] |
| 1314 | + self.log.info("Only retaining paths for %s that contain at least one file: %s -> %s", |
| 1315 | + key, paths, retained_paths) |
1317 | 1316 | paths = retained_paths |
1318 | 1317 | else: |
1319 | 1318 | # empty string is a valid value here (i.e. to prepend the installation prefix, cfr $CUDA_HOME) |
|
0 commit comments