Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eic_tools
Spack
Commits
298a55b2
Commit
298a55b2
authored
6 years ago
by
Mario Melara
Committed by
Todd Gamblin
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Replace previous bash command to new one (#7005)
Prevents infinite recursion caused by sourcing `setup-env.sh` in bashrc
parent
8a4e762b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/spack/spack/platforms/cray.py
+5
-16
5 additions, 16 deletions
lib/spack/spack/platforms/cray.py
with
5 additions
and
16 deletions
lib/spack/spack/platforms/cray.py
+
5
−
16
View file @
298a55b2
...
@@ -115,24 +115,13 @@ def _default_target_from_env(self):
...
@@ -115,24 +115,13 @@ def _default_target_from_env(self):
A bash subshell is launched with a wiped environment and the list of
A bash subshell is launched with a wiped environment and the list of
loaded modules is parsed for the first acceptable CrayPE target.
loaded modules is parsed for the first acceptable CrayPE target.
'''
'''
# Based on the incantation:
# env -i /bin/bash -lc echo $CRAY_CPU_TARGET 2> /dev/null
# echo "$(env - USER=$USER /bin/bash -l -c 'module list -lt')"
if
getattr
(
self
,
'
default
'
,
None
)
is
None
:
if
getattr
(
self
,
'
default
'
,
None
)
is
None
:
env
=
which
(
'
env
'
)
env
=
which
(
'
env
'
)
env
.
add_default_arg
(
'
-
'
)
output
=
env
(
"
-i
"
,
"
/bin/bash
"
,
"
-lc
"
,
"
echo $CRAY_CPU_TARGET
"
,
# CAUTION - $USER is generally needed in the sub-environment.
output
=
str
,
error
=
os
.
devnull
)
# There may be other variables needed for general success.
self
.
default
=
output
.
strip
()
output
=
env
(
'
USER=%s
'
%
os
.
environ
[
'
USER
'
],
tty
.
debug
(
"
Found default module:%s
"
%
self
.
default
)
'
HOME=%s
'
%
os
.
environ
[
'
HOME
'
],
'
/bin/bash
'
,
'
--noprofile
'
,
'
--norc
'
,
'
-c
'
,
'
. /etc/profile; module list -lt
'
,
output
=
str
,
error
=
str
)
self
.
_defmods
=
_get_modules_in_modulecmd_output
(
output
)
targets
=
[]
_fill_craype_targets_from_modules
(
targets
,
self
.
_defmods
)
self
.
default
=
targets
[
0
]
if
targets
else
None
tty
.
debug
(
"
Found default modules:
"
,
*
[
"
%s
"
%
mod
for
mod
in
self
.
_defmods
])
return
self
.
default
return
self
.
default
def
_avail_targets
(
self
):
def
_avail_targets
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment