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
346f1022
Commit
346f1022
authored
9 years ago
by
Brett Viren
Browse files
Options
Downloads
Patches
Plain Diff
Bug fixes, tty tweaks.
parent
8c140f47
Branches
Branches containing commit
Tags
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
+10
-9
10 additions, 9 deletions
lib/spack/spack/cmd/view.py
with
10 additions
and
9 deletions
lib/spack/spack/cmd/view.py
+
10
−
9
View file @
346f1022
...
...
@@ -46,7 +46,7 @@ def setup_parser(subparser):
# The action parameterizes the command but in keeping with Spack
# patterns we make it a subcommand.
sps
=
[
sp
.
add_parser
(
'
link
'
,
aliases
=
[
'
add
'
],
sp
.
add_parser
(
'
add
'
,
aliases
=
[
'
link
'
],
help
=
'
Add packages to the view, create view if needed.
'
),
sp
.
add_parser
(
'
remove
'
,
aliases
=
[
'
rm
'
],
help
=
'
Remove packages from the view, and view if empty.
'
),
...
...
@@ -112,6 +112,7 @@ def action_remove(spec, prefix):
tty
.
info
(
"
Skipping nonexistent package %s
"
%
spec
.
name
)
return
tty
.
info
(
"
remove %s
"
%
spec
.
name
)
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
spec
.
prefix
):
if
not
filenames
:
continue
...
...
@@ -125,7 +126,6 @@ def action_remove(spec, prefix):
continue
os
.
unlink
(
dst
)
def
action_link
(
spec
,
prefix
):
'
Symlink all files in `spec` into directory `prefix`.
'
...
...
@@ -134,6 +134,7 @@ def action_link(spec, prefix):
tty
.
warn
(
"
Skipping previously added package %s
"
%
spec
.
name
)
return
tty
.
info
(
"
link %s
"
%
spec
.
name
)
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
spec
.
prefix
):
if
not
filenames
:
continue
# avoid explicitly making empty dirs
...
...
@@ -151,8 +152,6 @@ def action_link(spec, prefix):
continue
os
.
symlink
(
src
,
dst
)
def
purge_empty_directories
(
path
):
'
Ascend up from the leaves accessible from `path` and remove empty directories.
'
for
dirpath
,
subdirs
,
files
in
os
.
walk
(
path
,
topdown
=
False
):
...
...
@@ -161,13 +160,14 @@ def purge_empty_directories(path):
try
:
os
.
rmdir
(
sdp
)
except
OSError
:
tty
.
warn
(
"
Not removing directory with contents: %s
"
%
sdp
)
#tty.warn("Not removing directory with contents: %s" % sdp)
pass
def
view_action
(
action
,
parser
,
args
):
'
The view command.
'
'
The view command
parameterized by the action
.
'
to_exclude
=
[
re
.
compile
(
e
)
for
e
in
args
.
exclude
]
def
exclude
(
spec
):
for
e
in
to_exclude
:
...
...
@@ -180,7 +180,7 @@ def exclude(spec):
parser
.
print_help
()
return
1
prefix
=
args
.
prefix
prefix
=
args
.
prefix
[
0
]
assuredir
(
prefix
)
flat
=
set
()
...
...
@@ -197,14 +197,15 @@ def exclude(spec):
if
not
os
.
path
.
exists
(
spec
.
prefix
):
tty
.
warn
(
'
Skipping unknown package: %s in %s
'
%
(
spec
.
name
,
spec
.
prefix
))
continue
tty
.
info
(
"
%s %s
"
%
(
action
,
spec
.
name
))
action
(
spec
,
prefix
)
if
action
in
[
'
remove
'
]:
if
args
.
action
in
[
'
remove
'
,
'
rm
'
]:
purge_empty_directories
(
prefix
)
def
view
(
parser
,
args
):
'
The view command.
'
action
=
{
'
add
'
:
action_link
,
'
link
'
:
action_link
,
...
...
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