New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add module load time env var to user module path #2395
Add module load time env var to user module path #2395
Conversation
On systems with multiple architectures sharing a single home directory for the users there need to be a way to install architecture specific builds when using the subdir-user-modules extension.
Change from using a specific subdir_arch_env to expanding "{RUNTIME_ENV::SOME_ENV_VAR}" into module runtime equivalences of os.getenv("SOME_ENV_VAR")
easybuild/tools/module_generator.py
Outdated
expanded_user_modpath.extend([path]) | ||
sub_paths = [] | ||
expanded_user_modpath.extend(['os.getenv(%s)' % quote_str(matched_re.group(1))]) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains mixed spaces and tabs
easybuild/tools/module_generator.py
Outdated
path = quote_str(os.path.join(*sub_paths)) | ||
expanded_user_modpath.extend([path]) | ||
sub_paths = [] | ||
expanded_user_modpath.extend(['os.getenv(%s)' % quote_str(matched_re.group(1))]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
easybuild/tools/module_generator.py
Outdated
if sub_paths: | ||
path = quote_str(os.path.join(*sub_paths)) | ||
expanded_user_modpath.extend([path]) | ||
sub_paths = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
easybuild/tools/module_generator.py
Outdated
if matched_re: | ||
if sub_paths: | ||
path = quote_str(os.path.join(*sub_paths)) | ||
expanded_user_modpath.extend([path]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains mixed spaces and tabs
easybuild/tools/module_generator.py
Outdated
matched_re = runtime_env_re.match(sub_path) | ||
if matched_re: | ||
if sub_paths: | ||
path = quote_str(os.path.join(*sub_paths)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
easybuild/tools/module_generator.py
Outdated
for sub_path in re.split(os.path.sep, user_modpath): | ||
matched_re = runtime_env_re.match(sub_path) | ||
if matched_re: | ||
if sub_paths: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
easybuild/framework/easyblock.py
Outdated
self.log.debug("Including user module path extensions returned by naming scheme: %s", user_modpath_exts) | ||
txt += self.module_generator.use(user_modpath_exts, prefix=self.module_generator.getenv_cmd('HOME'), | ||
guarded=True) | ||
guarded=True, user_modpath=user_modpath, mod_path_suffix=mod_path_suffix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line under-indented for visual indent
easybuild/tools/module_generator.py
Outdated
expanded_user_modpath.extend([path]) | ||
sub_paths = [] | ||
expanded_user_modpath.extend(['os.getenv(%s)' % quote_str(matched_re.group(1))]) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains mixed spaces and tabs
easybuild/tools/module_generator.py
Outdated
path = quote_str(os.path.join(*sub_paths)) | ||
expanded_user_modpath.extend([path]) | ||
sub_paths = [] | ||
expanded_user_modpath.extend(['os.getenv(%s)' % quote_str(matched_re.group(1))]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
easybuild/tools/module_generator.py
Outdated
if sub_paths: | ||
path = quote_str(os.path.join(*sub_paths)) | ||
expanded_user_modpath.extend([path]) | ||
sub_paths = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
easybuild/tools/module_generator.py
Outdated
if matched_re: | ||
if sub_paths: | ||
path = quote_str(os.path.join(*sub_paths)) | ||
expanded_user_modpath.extend([path]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains mixed spaces and tabs
easybuild/tools/module_generator.py
Outdated
matched_re = runtime_env_re.match(sub_path) | ||
if matched_re: | ||
if sub_paths: | ||
path = quote_str(os.path.join(*sub_paths)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
easybuild/tools/module_generator.py
Outdated
for sub_path in re.split(os.path.sep, user_modpath): | ||
matched_re = runtime_env_re.match(sub_path) | ||
if matched_re: | ||
if sub_paths: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
easybuild/framework/easyblock.py
Outdated
self.log.debug("Including user module path extensions returned by naming scheme: %s", user_modpath_exts) | ||
txt += self.module_generator.use(user_modpath_exts, prefix=self.module_generator.getenv_cmd('HOME'), | ||
guarded=True) | ||
guarded=True, user_modpath=user_modpath, mod_path_suffix=mod_path_suffix) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line under-indented for visual indent
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s", "funky", "Compiler/pi/3.14"\)\)' % (home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (124 > 120 characters)
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s", "funky", "Compiler/pi/3.14"\)\)' % (home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (124 > 120 characters)
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s", "funky", "Compiler/pi/3.14"\)\)' % | ||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line unaligned for hanging indent
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s", "funky", "Compiler/pi/3.14"\)\)' % | ||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line unaligned for hanging indent
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s", "funky", "Compiler/pi/3.14"\)\)' % | ||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
continuation line unaligned for hanging indent
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s", "funky", "Compiler/pi/3.14"\)\)' % | ||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation contains tabs
indentation contains mixed spaces and tabs
continuation line unaligned for hanging indent
…or adds when using subdir-user-modules.
easybuild/tools/module_generator.py
Outdated
for path in paths: | ||
quoted_path = quote_str(path) | ||
if user_modpath: | ||
quoted_path = '[ file join %s %s' ] % (user_modpath, quoted_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespace before ']'
…ir-user-modules" changes.
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, pathJoin\("%s", "funky", "Compiler/pi/3.14"\)\)\)' % | ||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line unaligned for hanging indent
test/framework/easyblock.py
Outdated
@@ -274,18 +274,19 @@ def test_make_module_extend_modpath(self): | |||
home = r'\$env\(HOME\)' | |||
regexs.extend([ | |||
# extension for user modules is guarded | |||
r'if { \[ file isdirectory \[ file join %s "%s/funky/Compiler/pi/3.14" \] \] } {$' % (home, usermodsdir), | |||
r'if { \[ file isdirectory \[ file join %s \[ file join "%s" "funky" "Compiler/pi/3.14" \] \] \] } {$' % (home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (141 > 120 characters)
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, pathJoin\("%s", "funky", "Compiler/pi/3.14"\)\)\)' % | ||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line unaligned for hanging indent
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'^\s+module use \[ file join %s "%s/funky/Compiler/pi/3.14"\ ]$' % (home, usermodsdir), | ||
r'^\s+module use \[ file join %s \[ file join "%s" "funky" "Compiler/pi/3.14" \] \]$' % (home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (124 > 120 characters)
test/framework/easyblock.py
Outdated
@@ -274,18 +274,20 @@ def test_make_module_extend_modpath(self): | |||
home = r'\$env\(HOME\)' | |||
regexs.extend([ | |||
# extension for user modules is guarded | |||
r'if { \[ file isdirectory \[ file join %s "%s/funky/Compiler/pi/3.14" \] \] } {$' % (home, usermodsdir), | |||
r'if { \[ file isdirectory \[ file join %s \[ file join "%s" "funky" "Compiler/pi/3.14" \] \] \] } {$' % | |||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line unaligned for hanging indent
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, "%s/funky/Compiler/pi/3.14"\)\)' % (home, usermodsdir), | ||
r'\s+prepend_path\("MODULEPATH", pathJoin\(%s, pathJoin\("%s", "funky", "Compiler/pi/3.14"\)\)\)' % | ||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line unaligned for hanging indent
test/framework/easyblock.py
Outdated
# no per-moduleclass extension for user modules | ||
r'^\s+module use \[ file join %s "%s/funky/Compiler/pi/3.14"\ ]$' % (home, usermodsdir), | ||
r'^\s+module use \[ file join %s \[ file join "%s" "funky" "Compiler/pi/3.14" \] \]$' % (home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (124 > 120 characters)
test/framework/easyblock.py
Outdated
@@ -274,18 +274,20 @@ def test_make_module_extend_modpath(self): | |||
home = r'\$env\(HOME\)' | |||
regexs.extend([ | |||
# extension for user modules is guarded | |||
r'if { \[ file isdirectory \[ file join %s "%s/funky/Compiler/pi/3.14" \] \] } {$' % (home, usermodsdir), | |||
r'if { \[ file isdirectory \[ file join %s \[ file join "%s" "funky" "Compiler/pi/3.14" \] \] \] } {$' % | |||
(home, usermodsdir), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuation line unaligned for hanging indent
…enerator.py (& leverage existing getenv_cmd method)
…r-module-path clean up duplicate code
file join/pathjoin, so add a join_str to det_user_modpath.
As i suspecterd, the Tcl code gets wrong. I'll fix that. |
…odpath. Removes the need for an extra argument to det_user_modpath.
…r-module-path flesh out common part of det_user_modpath into _det_user_modpath_common method
…er-module-path fix check for $env(HOME) in test_make_module_extend_modpath, should be $::env(HOME)
On systems with multiple architectures sharing a single home directory
for the users there need to be a way to install architecture specific
builds when using the subdir-user-modules extension.
This is a remake of PR #2330 which I messed up by doing an bad pull.