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
8ddc1f89
Commit
8ddc1f89
authored
8 years ago
by
Brett Viren
Browse files
Options
Downloads
Patches
Plain Diff
Move from str.format() to string.Template.
parent
f1900f6a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/spack/spack/cmd/view.py
+6
-3
6 additions, 3 deletions
lib/spack/spack/cmd/view.py
with
6 additions
and
3 deletions
lib/spack/spack/cmd/view.py
+
6
−
3
View file @
8ddc1f89
...
...
@@ -317,16 +317,19 @@ def visitor_statlink(specs, args):
def
visitor_print
(
specs
,
args
):
'
Print a string for each spec using args.format.
'
fmt
=
args
.
format
[
0
]
from
string
import
Template
t
=
Template
(
fmt
)
for
spec
in
specs
:
kwds
=
spec2dict
(
spec
)
try
:
string
=
fmt
.
format
(
**
kwds
)
text
=
t
.
substitute
(
kwds
)
except
KeyError
:
tty
.
error
(
"
Format error, use keywords: %s
"
%
(
'
,
'
.
join
(
kwds
.
keys
()),
))
raise
# argparser escapes these
string
=
string
.
replace
(
r
'
\n
'
,
'
\n
'
).
replace
(
r
'
\t
'
,
'
\t
'
)
sys
.
stdout
.
write
(
string
)
text
=
text
.
replace
(
r
'
\n
'
,
'
\n
'
).
replace
(
r
'
\t
'
,
'
\t
'
)
sys
.
stdout
.
write
(
text
)
# Finally, the actual "view" command. There should be no need to
...
...
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