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
935eba23
Commit
935eba23
authored
10 years ago
by
Todd Gamblin
Browse files
Options
Downloads
Patches
Plain Diff
Allow commands to return error codes.
parent
5d033fbd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bin/spack
+9
-1
9 additions, 1 deletion
bin/spack
lib/spack/spack/cmd/graph.py
+5
-0
5 additions, 0 deletions
lib/spack/spack/cmd/graph.py
lib/spack/spack/cmd/md5.py
+1
-0
1 addition, 0 deletions
lib/spack/spack/cmd/md5.py
with
15 additions
and
1 deletion
bin/spack
+
9
−
1
View file @
935eba23
...
@@ -103,7 +103,7 @@ if args.insecure:
...
@@ -103,7 +103,7 @@ if args.insecure:
# Try to load the particular command asked for and run it
# Try to load the particular command asked for and run it
command
=
spack
.
cmd
.
get_command
(
args
.
command
)
command
=
spack
.
cmd
.
get_command
(
args
.
command
)
try
:
try
:
command
(
parser
,
args
)
return_val
=
command
(
parser
,
args
)
except
SpackError
,
e
:
except
SpackError
,
e
:
if
spack
.
debug
:
if
spack
.
debug
:
# In debug mode, raise with a full stack trace.
# In debug mode, raise with a full stack trace.
...
@@ -116,3 +116,11 @@ except SpackError, e:
...
@@ -116,3 +116,11 @@ except SpackError, e:
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
sys
.
stderr
.
write
(
'
\n
'
)
sys
.
stderr
.
write
(
'
\n
'
)
tty
.
die
(
"
Keyboard interrupt.
"
)
tty
.
die
(
"
Keyboard interrupt.
"
)
# Allow commands to return values if they want to exit with some ohter code.
if
return_val
is
None
:
sys
.
exit
(
0
)
elif
isinstance
(
return_val
,
int
):
sys
.
exit
(
return_val
)
else
:
tty
.
die
(
"
Bad return value from command %s: %s
"
%
(
args
.
command
,
return_val
))
This diff is collapsed.
Click to expand it.
lib/spack/spack/cmd/graph.py
+
5
−
0
View file @
935eba23
...
@@ -31,6 +31,8 @@
...
@@ -31,6 +31,8 @@
description
=
"
Generate graphs of package dependency relationships.
"
description
=
"
Generate graphs of package dependency relationships.
"
def
setup_parser
(
subparser
):
def
setup_parser
(
subparser
):
setup_parser
.
parser
=
subparser
method
=
subparser
.
add_mutually_exclusive_group
()
method
=
subparser
.
add_mutually_exclusive_group
()
method
.
add_argument
(
method
.
add_argument
(
'
--ascii
'
,
action
=
'
store_true
'
,
'
--ascii
'
,
action
=
'
store_true
'
,
...
@@ -50,6 +52,9 @@ def graph(parser, args):
...
@@ -50,6 +52,9 @@ def graph(parser, args):
specs
=
spack
.
cmd
.
parse_specs
(
specs
=
spack
.
cmd
.
parse_specs
(
args
.
specs
,
normalize
=
True
,
concretize
=
args
.
concretize
)
args
.
specs
,
normalize
=
True
,
concretize
=
args
.
concretize
)
if
not
specs
:
setup_parser
.
parser
.
print_help
()
return
1
if
args
.
dot
:
# Dot graph only if asked for.
if
args
.
dot
:
# Dot graph only if asked for.
graph_dot
(
*
specs
)
graph_dot
(
*
specs
)
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/cmd/md5.py
+
1
−
0
View file @
935eba23
...
@@ -41,6 +41,7 @@ def setup_parser(subparser):
...
@@ -41,6 +41,7 @@ def setup_parser(subparser):
def
md5
(
parser
,
args
):
def
md5
(
parser
,
args
):
if
not
args
.
files
:
if
not
args
.
files
:
setup_parser
.
parser
.
print_help
()
setup_parser
.
parser
.
print_help
()
return
1
for
f
in
args
.
files
:
for
f
in
args
.
files
:
if
not
os
.
path
.
isfile
(
f
):
if
not
os
.
path
.
isfile
(
f
):
...
...
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