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
93067d0d
Commit
93067d0d
authored
10 years ago
by
Todd Gamblin
Browse files
Options
Downloads
Patches
Plain Diff
Add profile option to spack script.
parent
457f2d1d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/spack
+49
-40
49 additions, 40 deletions
bin/spack
with
49 additions
and
40 deletions
bin/spack
+
49
−
40
View file @
93067d0d
...
@@ -58,14 +58,16 @@ parser = argparse.ArgumentParser(
...
@@ -58,14 +58,16 @@ parser = argparse.ArgumentParser(
description
=
'
Spack: the Supercomputing PACKage Manager.
'
)
description
=
'
Spack: the Supercomputing PACKage Manager.
'
)
parser
.
add_argument
(
'
-V
'
,
'
--version
'
,
action
=
'
version
'
,
parser
.
add_argument
(
'
-V
'
,
'
--version
'
,
action
=
'
version
'
,
version
=
"
%s
"
%
spack
.
spack_version
)
version
=
"
%s
"
%
spack
.
spack_version
)
parser
.
add_argument
(
'
-v
'
,
'
--verbose
'
,
action
=
'
store_true
'
,
dest
=
'
verbose
'
,
parser
.
add_argument
(
'
-v
'
,
'
--verbose
'
,
action
=
'
store_true
'
,
help
=
"
Print additional output during builds
"
)
help
=
"
Print additional output during builds
"
)
parser
.
add_argument
(
'
-d
'
,
'
--debug
'
,
action
=
'
store_true
'
,
dest
=
'
debug
'
,
parser
.
add_argument
(
'
-d
'
,
'
--debug
'
,
action
=
'
store_true
'
,
help
=
"
Write out debug logs during compile
"
)
help
=
"
Write out debug logs during compile
"
)
parser
.
add_argument
(
'
-k
'
,
'
--insecure
'
,
action
=
'
store_true
'
,
dest
=
'
insecure
'
,
parser
.
add_argument
(
'
-k
'
,
'
--insecure
'
,
action
=
'
store_true
'
,
help
=
"
Do not check ssl certificates when downloading archives.
"
)
help
=
"
Do not check ssl certificates when downloading archives.
"
)
parser
.
add_argument
(
'
-m
'
,
'
--mock
'
,
action
=
'
store_true
'
,
dest
=
'
mock
'
,
parser
.
add_argument
(
'
-m
'
,
'
--mock
'
,
action
=
'
store_true
'
,
help
=
"
Use mock packages instead of real ones.
"
)
help
=
"
Use mock packages instead of real ones.
"
)
parser
.
add_argument
(
'
-p
'
,
'
--profile
'
,
action
=
'
store_true
'
,
help
=
"
Profile execution using cProfile.
"
)
# each command module implements a parser() function, to which we pass its
# each command module implements a parser() function, to which we pass its
# subparser for setup.
# subparser for setup.
...
@@ -85,42 +87,49 @@ if len(sys.argv) == 1:
...
@@ -85,42 +87,49 @@ if len(sys.argv) == 1:
# actually parse the args.
# actually parse the args.
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
# Set up environment based on args.
def
main
():
tty
.
set_verbose
(
args
.
verbose
)
# Set up environment based on args.
tty
.
set_debug
(
args
.
debug
)
tty
.
set_verbose
(
args
.
verbose
)
spack
.
debug
=
args
.
debug
tty
.
set_debug
(
args
.
debug
)
spack
.
debug
=
args
.
debug
spack
.
spack_working_dir
=
working_dir
if
args
.
mock
:
spack
.
spack_working_dir
=
working_dir
from
spack.packages
import
PackageDB
if
args
.
mock
:
spack
.
db
=
PackageDB
(
spack
.
mock_packages_path
)
from
spack.packages
import
PackageDB
spack
.
db
=
PackageDB
(
spack
.
mock_packages_path
)
# If the user asked for it, don't check ssl certs.
if
args
.
insecure
:
# If the user asked for it, don't check ssl certs.
tty
.
warn
(
"
You asked for --insecure, which does not check SSL certificates or checksums.
"
)
if
args
.
insecure
:
spack
.
curl
.
add_default_arg
(
'
-k
'
)
tty
.
warn
(
"
You asked for --insecure, which does not check SSL certificates or checksums.
"
)
spack
.
curl
.
add_default_arg
(
'
-k
'
)
# Try to load the particular command asked for and run it
command
=
spack
.
cmd
.
get_command
(
args
.
command
)
# Try to load the particular command asked for and run it
try
:
command
=
spack
.
cmd
.
get_command
(
args
.
command
)
return_val
=
command
(
parser
,
args
)
try
:
except
SpackError
,
e
:
return_val
=
command
(
parser
,
args
)
if
spack
.
debug
:
except
SpackError
,
e
:
# In debug mode, raise with a full stack trace.
if
spack
.
debug
:
raise
# In debug mode, raise with a full stack trace.
elif
e
.
long_message
:
raise
tty
.
die
(
e
.
message
,
e
.
long_message
)
elif
e
.
long_message
:
tty
.
die
(
e
.
message
,
e
.
long_message
)
else
:
tty
.
die
(
e
.
message
)
except
KeyboardInterrupt
:
sys
.
stderr
.
write
(
'
\n
'
)
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
:
else
:
tty
.
die
(
e
.
message
)
tty
.
die
(
"
Bad return value from command %s: %s
"
%
(
args
.
command
,
return_val
))
except
KeyboardInterrupt
:
sys
.
stderr
.
write
(
'
\n
'
)
tty
.
die
(
"
Keyboard interrupt.
"
)
# Allow commands to return values if they want to exit with some ohter code.
if
args
.
profile
:
if
return_val
is
None
:
import
cProfile
sys
.
exit
(
0
)
cProfile
.
run
(
'
main()
'
,
sort
=
'
tottime
'
)
elif
isinstance
(
return_val
,
int
):
sys
.
exit
(
return_val
)
else
:
else
:
tty
.
die
(
"
Bad return value from command %s: %s
"
%
(
args
.
command
,
return_val
)
)
main
(
)
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