Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions eb_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,23 @@ def pre_configure_hook_grass(self, *args, **kwargs):
raise EasyBuildError("GRASS-specific hook triggered for non-GRASS easyconfig?!")


def pre_configure_hook_python(self, *args, **kwargs):
"""
Pre-configure hook for Python:
- make sure that the timezone data from the compatibility layer is used
"""
if self.name == 'Python':
# determine path to Prefix installation in compat layer via $EPREFIX
eprefix = get_eessi_envvar('EPREFIX')
tzdata = os.path.join(eprefix, 'usr', 'share', 'zoneinfo')
self.cfg.update('configopts', '--with-tzpath=' + tzdata)
# also fix the datetime tester, which has a hardcoded path to /usr/share/zoneinfo
datetimetester_file = os.path.join('Lib', 'test', 'datetimetester.py')
apply_regex_substitutions(datetimetester_file, [("zoneroot = '/usr/share/zoneinfo'", f"zoneroot = '{tzdata}'")])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be done in upstream easybuild, in the EasyBlock (probably conditional on if a sysroot is configured)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Probably that would be better, though it would also require more checks (are these files really available etc). Shall I open an issue on the easyblocks repo, and meanwhile we use this hook?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already quite a bit of sysroot-related patching in https://github.com/easybuilders/easybuild-easyblocks/blob/develop/easybuild/easyblocks/p/python.py#L545. Let me try to add this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in easybuilders/easybuild-easyblocks#4280, so we can probably close this PR.

else:
raise EasyBuildError("Python-specific hook triggered for non-Python easyconfig?!")


def pre_configure_hook_score_p(self, *args, **kwargs):
"""
Pre-configure hook for Score-p
Expand Down Expand Up @@ -2769,6 +2786,7 @@ def post_easyblock_hook(self, *args, **kwargs):
'PETSc': pre_configure_hook_petsc,
'PMIx': pre_configure_hook_pmix_ipv6,
'PRRTE': pre_configure_hook_prrte_ipv6,
'Python': pre_configure_hook_python,
'ROCm-LLVM': pre_configure_hook_llvm,
'Score-P': pre_configure_hook_score_p,
'SymEngine': pre_configure_hook_symengine,
Expand Down
Loading