|
49 | 49 | from easybuild.framework.extensioneasyblock import ExtensionEasyBlock |
50 | 50 | from easybuild.tools.build_log import EasyBuildError, print_msg |
51 | 51 | from easybuild.tools.config import build_option, PYTHONPATH, EBPYTHONPREFIXES |
52 | | -from easybuild.tools.filetools import change_dir, mkdir, read_file, remove_dir, symlink, which, write_file |
53 | | -from easybuild.tools.filetools import find_glob_pattern |
| 52 | +from easybuild.tools.filetools import change_dir, mkdir, read_file, remove_dir, symlink, which, write_file, search_file |
54 | 53 | from easybuild.tools.modules import ModEnvVarType, get_software_root |
55 | 54 | from easybuild.tools.run import run_shell_cmd |
56 | 55 | from easybuild.tools.utilities import nub |
@@ -643,24 +642,14 @@ def using_ebpythonprefixes(self) -> bool: |
643 | 642 | # Our sitecustomize.py adds paths in $EBPYTHONPREFIXES to the sitedir path though, allowing |
644 | 643 | # these .pth files to work as expected. See: https://docs.python.org/3/library/site.html#module-site |
645 | 644 | # .pth files always should be in the site folder, so most of the path is fixed. |
646 | | - try: |
647 | | - glob_pattern = "%s/lib/python*/site-packages/*.pth" |
648 | | - # Try the installation directory first |
649 | | - if find_glob_pattern(glob_pattern % self.installdir, |
650 | | - fail_on_no_match=False): |
651 | | - self.log.info("Found path configuration file in installation directory." |
652 | | - "Enabling $EBPYTHONPREFIXES...") |
653 | | - use_ebpythonprefixes = True |
654 | | - # If we did a test installation, check that one as well |
655 | | - if self.testinstall and find_glob_pattern(glob_pattern % self.pypkg_test_installdir, |
656 | | - fail_on_no_match=False): |
657 | | - self.log.info("Found path configuration file in test installation directory." |
658 | | - "Enabling $EBPYTHONPREFIXES...") |
659 | | - use_ebpythonprefixes = True |
660 | | - except EasyBuildError: |
661 | | - # find_glob_pattern found more than one match. This is still sufficient for us to assume |
662 | | - # that we need $EBPYTHONPREFIXES. |
663 | | - self.log.info("Found more than one match while searching for path configuration files." |
| 645 | + # Try the installation directory first |
| 646 | + if search_file([self.installdir], r".*\.pth$", silent=True): |
| 647 | + self.log.info("Found path configuration file in installation directory." |
| 648 | + "Enabling $EBPYTHONPREFIXES...") |
| 649 | + use_ebpythonprefixes = True |
| 650 | + # If we did a test installation, check that one as well |
| 651 | + if self.testinstall and search_file([self.pypkg_test_installdir], r".*\.pth$", silent=True): |
| 652 | + self.log.info("Found path configuration file in test installation directory." |
664 | 653 | "Enabling $EBPYTHONPREFIXES...") |
665 | 654 | use_ebpythonprefixes = True |
666 | 655 |
|
@@ -899,7 +888,7 @@ def test_step(self, return_output_ec=False): |
899 | 888 | abs_pylibdirs = [os.path.join(actual_installdir, pylibdir) for pylibdir in self.all_pylibdirs] |
900 | 889 | extrapath = "export PYTHONPATH=%s && " % os.pathsep.join(abs_pylibdirs + ['$PYTHONPATH']) |
901 | 890 | if self.using_ebpythonprefixes(): |
902 | | - extrapath += "export EBPYTHONPREFIXES=%s && " % os.pathsep.join(abs_pylibdirs + |
| 891 | + extrapath += "export EBPYTHONPREFIXES=%s && " % os.pathsep.join([self.pypkg_test_installdir] + |
903 | 892 | ['$EBPYTHONPREFIXES']) |
904 | 893 | extrapath += "export PATH=%s:$PATH && " % os.path.join(actual_installdir, 'bin') |
905 | 894 |
|
|
0 commit comments