Skip to content
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

Conversation

akesandgren
Copy link
Contributor

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.

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")
expanded_user_modpath.extend([path])
sub_paths = []
expanded_user_modpath.extend(['os.getenv(%s)' % quote_str(matched_re.group(1))])
else:

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

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))])

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

if sub_paths:
path = quote_str(os.path.join(*sub_paths))
expanded_user_modpath.extend([path])
sub_paths = []

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

if matched_re:
if sub_paths:
path = quote_str(os.path.join(*sub_paths))
expanded_user_modpath.extend([path])

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

matched_re = runtime_env_re.match(sub_path)
if matched_re:
if sub_paths:
path = quote_str(os.path.join(*sub_paths))

Choose a reason for hiding this comment

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

indentation contains tabs

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:

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

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)

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

expanded_user_modpath.extend([path])
sub_paths = []
expanded_user_modpath.extend(['os.getenv(%s)' % quote_str(matched_re.group(1))])
else:

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

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))])

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

if sub_paths:
path = quote_str(os.path.join(*sub_paths))
expanded_user_modpath.extend([path])
sub_paths = []

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

if matched_re:
if sub_paths:
path = quote_str(os.path.join(*sub_paths))
expanded_user_modpath.extend([path])

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

matched_re = runtime_env_re.match(sub_path)
if matched_re:
if sub_paths:
path = quote_str(os.path.join(*sub_paths))

Choose a reason for hiding this comment

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

indentation contains tabs

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:

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

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)

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

# 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),

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)

# 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),

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)

# 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),

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

# 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),

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

# 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),

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

# 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),

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

for path in paths:
quoted_path = quote_str(path)
if user_modpath:
quoted_path = '[ file join %s %s' ] % (user_modpath, quoted_path)

Choose a reason for hiding this comment

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

whitespace before ']'

# 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),

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

@@ -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),

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)

# 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),

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

# 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),

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)

@@ -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),

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

# 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),

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

# 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),

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)

@@ -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),

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

@easybuilders easybuilders deleted a comment from boegelbot Jul 5, 2018
@easybuilders easybuilders deleted a comment from boegelbot Jul 5, 2018
@easybuilders easybuilders deleted a comment from boegelbot Jul 5, 2018
file join/pathjoin, so add a join_str to det_user_modpath.
@akesandgren
Copy link
Contributor Author

As i suspecterd, the Tcl code gets wrong. I'll fix that.

@easybuilders easybuilders deleted a comment from houndci-bot Jul 6, 2018
@easybuilders easybuilders deleted a comment from houndci-bot Jul 6, 2018
@easybuilders easybuilders deleted a comment from houndci-bot Jul 6, 2018
@easybuilders easybuilders deleted a comment from houndci-bot Jul 6, 2018
@easybuilders easybuilders deleted a comment from houndci-bot Jul 6, 2018
@easybuilders easybuilders deleted a comment from boegelbot Jul 6, 2018
@easybuilders easybuilders deleted a comment from boegelbot Jul 6, 2018
akesandgren and others added 3 commits July 6, 2018 07:37
…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)
@easybuilders easybuilders deleted a comment from boegelbot Jul 6, 2018
@boegel boegel merged commit caf30a4 into easybuilders:develop Jul 6, 2018
@akesandgren akesandgren deleted the add-module-load-time-env-var-to-user-module-path branch July 6, 2018 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants