Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
c6e301df
Commit
c6e301df
authored
4 years ago
by
Gregory Becker
Browse files
Options
Downloads
Patches
Plain Diff
spack clean: option to clean test stage (-t)
parent
5b417b9e
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
lib/spack/spack/cmd/clean.py
+22
-3
22 additions, 3 deletions
lib/spack/spack/cmd/clean.py
with
22 additions
and
3 deletions
lib/spack/spack/cmd/clean.py
+
22
−
3
View file @
c6e301df
...
...
@@ -14,6 +14,8 @@
import
spack.cmd.common.arguments
as
arguments
import
spack.repo
import
spack.stage
import
spack.util.path
as
sup
import
spack.config
from
spack.paths
import
lib_path
,
var_path
...
...
@@ -25,7 +27,7 @@
class
AllClean
(
argparse
.
Action
):
"""
Activates flags -s -d -f -m and -p simultaneously
"""
def
__call__
(
self
,
parser
,
namespace
,
values
,
option_string
=
None
):
parser
.
parse_args
([
'
-sdfmp
'
],
namespace
=
namespace
)
parser
.
parse_args
([
'
-sdfmp
t
'
],
namespace
=
namespace
)
def
setup_parser
(
subparser
):
...
...
@@ -45,7 +47,10 @@ def setup_parser(subparser):
'
-p
'
,
'
--python-cache
'
,
action
=
'
store_true
'
,
help
=
"
remove .pyc, .pyo files and __pycache__ folders
"
)
subparser
.
add_argument
(
'
-a
'
,
'
--all
'
,
action
=
AllClean
,
help
=
"
equivalent to -sdfmp
"
,
nargs
=
0
'
-t
'
,
'
--test-stage
'
,
action
=
'
store_true
'
,
help
=
"
remove all files in Spack test stage
"
)
subparser
.
add_argument
(
'
-a
'
,
'
--all
'
,
action
=
AllClean
,
help
=
"
equivalent to -sdfmpt
"
,
nargs
=
0
)
arguments
.
add_common_arguments
(
subparser
,
[
'
specs
'
])
...
...
@@ -53,7 +58,7 @@ def setup_parser(subparser):
def
clean
(
parser
,
args
):
# If nothing was set, activate the default
if
not
any
([
args
.
specs
,
args
.
stage
,
args
.
downloads
,
args
.
failures
,
args
.
misc_cache
,
args
.
python_cache
]):
args
.
misc_cache
,
args
.
test_stage
,
args
.
python_cache
]):
args
.
stage
=
True
# Then do the cleaning falling through the cases
...
...
@@ -81,6 +86,20 @@ def clean(parser, args):
tty
.
msg
(
'
Removing cached information on repositories
'
)
spack
.
caches
.
misc_cache
.
destroy
()
if
args
.
test_stage
:
tty
.
msg
(
"
Removing files in test stage
"
)
# get stage
test_stage_root
=
sup
.
canonicalize_path
(
spack
.
config
.
get
(
'
config:test_stage
'
,
''
))
# delete any subdirectories
if
os
.
path
.
exists
(
test_stage_root
):
contents
=
[
os
.
path
.
join
(
test_stage_root
,
entry
)
for
entry
in
os
.
listdir
(
test_stage_root
)]
for
entry
in
contents
:
shutil
.
rmtree
(
entry
)
if
args
.
python_cache
:
tty
.
msg
(
'
Removing python cache files
'
)
for
directory
in
[
lib_path
,
var_path
]:
...
...
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