Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ebrains-spack-builds
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
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Klaus Noelp
ebrains-spack-builds
Commits
68dd0c5d
Commit
68dd0c5d
authored
1 year ago
by
Dennis Terhorst
Committed by
Eleni Mathioulaki
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
remove dead code
Co-Authored-By:
Eleni Mathioulaki
<
emathioulaki@athenarc.gr
>
parent
a2e19f97
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
operations/module2view.py
+8
-20
8 additions, 20 deletions
operations/module2view.py
with
8 additions
and
20 deletions
operations/module2view.py
+
8
−
20
View file @
68dd0c5d
...
...
@@ -32,11 +32,15 @@ logging.basicConfig(level=logging.DEBUG)
log
=
logging
.
getLogger
()
class
Rewriter
:
def
__init__
(
self
,
installpath
=
None
,
viewpath
=
None
):
self
.
_installpath
=
installpath
self
.
_viewpath
=
viewpath
def
__init__
(
self
,
installpath
:
Path
,
viewpath
:
Path
):
self
.
_installpath
=
Path
(
installpath
)
self
.
_viewpath
=
Path
(
viewpath
)
self
.
_export_re
=
re
.
compile
(
r
"
^export (?P<key>\w+)=[
'
\"]?(?P<value>.*?)[
'
\"]?;\n
"
)
self
.
_package_re
=
re
.
compile
(
r
"
(?P<package>\w[^/]+)-(?P<hash>[0-9a-z]{32})/(?P<relative>.*)
"
)
if
not
self
.
_installpath
.
is_dir
():
raise
ValueError
(
f
"
installpath
{
self
.
_installpath
}
is not a directory
"
)
if
not
self
.
_viewpath
.
is_dir
():
raise
ValueError
(
f
"
viewpath
{
self
.
_viewpath
}
is not a directory
"
)
@property
def
installpath
(
self
):
...
...
@@ -73,29 +77,13 @@ class Rewriter:
log
.
debug
(
"
REWRITE value split by
'
%s
'"
,
separator
)
log
.
debug
(
"
REWRITE value
'
%s
'"
,
value
)
# heuristically use the first path to the view as viewpath
if
self
.
_viewpath
is
None
:
possibles
=
[
inpath
for
inpath
in
value
.
split
(
separator
)
if
inpath
.
endswith
(
"
.spack-env/view
"
)]
log
.
debug
(
"
possible paths: %s
"
,
possibles
)
if
possibles
:
self
.
_viewpath
=
possibles
[
0
]
log
.
info
(
"
identifed viewpath: %s
"
,
self
.
_viewpath
)
if
separator
not
in
value
:
log
.
debug
(
"
value paste (no separator)
"
)
return
value
if
self
.
_viewpath
is
None
and
"
spack
"
in
value
:
log
.
warning
(
"
viewpath is still unknown
"
)
log
.
debug
(
"
value paste (no viewpath)
"
)
return
value
inpaths
=
value
.
split
(
separator
)
log
.
debug
(
"
inspecting %s paths
"
,
len
(
inpaths
))
if
self
.
_viewpath
is
None
:
raise
ValueError
(
"
Found export but view path is not known yet
"
)
outpaths
=
[]
for
path
in
value
.
split
(
separator
):
if
not
path
.
startswith
(
str
(
self
.
installpath
)):
...
...
@@ -109,7 +97,7 @@ class Rewriter:
log
.
debug
(
f
"
matching subpath=
{
subpath
}
"
)
toolpath
=
self
.
_package_re
.
match
(
subpath
)
if
toolpath
:
newpath
=
str
(
Path
(
self
.
_viewpath
)
/
toolpath
.
group
(
"
relative
"
))
newpath
=
str
(
self
.
_viewpath
/
toolpath
.
group
(
"
relative
"
))
if
newpath
not
in
outpaths
:
log
.
debug
(
"
append changed: %s
"
,
newpath
)
outpaths
.
append
(
newpath
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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