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
37dc719d
Commit
37dc719d
authored
8 years ago
by
Massimiliano Culpo
Committed by
Todd Gamblin
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ProcessError : now the exception is correctly pickled and passed across processes. (#2143)
parent
00078779
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/spack/spack/__init__.py
+3
-2
3 additions, 2 deletions
lib/spack/spack/__init__.py
lib/spack/spack/util/executable.py
+29
-9
29 additions, 9 deletions
lib/spack/spack/util/executable.py
with
32 additions
and
11 deletions
lib/spack/spack/__init__.py
+
3
−
2
View file @
37dc719d
...
...
@@ -186,7 +186,8 @@
# packages should live. This file is overloaded for spack core vs.
# for packages.
#
__all__
=
[
'
Package
'
,
__all__
=
[
'
PackageBase
'
,
'
Package
'
,
'
CMakePackage
'
,
'
AutotoolsPackage
'
,
'
MakefilePackage
'
,
...
...
@@ -195,7 +196,7 @@
'
ver
'
,
'
alldeps
'
,
'
nolink
'
]
from
spack.package
import
Package
,
ExtensionConflictError
from
spack.package
import
Package
,
PackageBase
,
ExtensionConflictError
from
spack.build_systems.makefile
import
MakefilePackage
from
spack.build_systems.autotools
import
AutotoolsPackage
from
spack.build_systems.cmake
import
CMakePackage
...
...
This diff is collapsed.
Click to expand it.
lib/spack/spack/util/executable.py
+
29
−
9
View file @
37dc719d
...
...
@@ -184,11 +184,11 @@ def streamify(arg, mode):
result
+=
err
return
result
except
OSError
,
e
:
except
OSError
as
e
:
raise
ProcessError
(
"
%s: %s
"
%
(
self
.
exe
[
0
],
e
.
strerror
),
"
Command:
"
+
cmd_line
)
except
subprocess
.
CalledProcessError
,
e
:
except
subprocess
.
CalledProcessError
as
e
:
if
fail_on_error
:
raise
ProcessError
(
str
(
e
),
"
\n
Exit status %d when invoking command: %s
"
%
...
...
@@ -249,21 +249,41 @@ def __init__(self, msg, long_message=None):
@property
def
long_message
(
self
):
msg
=
self
.
_long_message
if
msg
:
msg
+=
"
\n\n
"
if
self
.
build_log
:
msg
+=
"
See build log for details:
\n
"
msg
+=
"
%s
"
%
self
.
build_log
msg
=
self
.
_long_message
if
self
.
_long_message
else
''
if
self
.
package_context
:
if
msg
:
msg
+=
"
\n\n
"
msg
+=
'
\n
'
.
join
(
self
.
package_context
)
if
msg
:
msg
+=
"
\n\n
"
if
self
.
build_log
:
msg
+=
"
See build log for details:
\n
"
msg
+=
"
%s
"
%
self
.
build_log
return
msg
def
__reduce__
(
self
):
# We need this constructor because we are trying to move a ProcessError
# across processes. This means that we have to preserve the original
# package context and build log
return
_make_process_error
,
(
self
.
message
,
self
.
_long_message
,
self
.
package_context
,
self
.
build_log
)
def
_make_process_error
(
msg
,
long_message
,
pkg_context
,
build_log
):
a
=
ProcessError
(
msg
,
long_message
)
a
.
package_context
=
pkg_context
a
.
build_log
=
build_log
return
a
def
_get_package_context
():
"""
Return some context for an error message when the build fails.
...
...
@@ -291,7 +311,7 @@ def _get_package_context():
# Look only at a frame in a subclass of spack.Package
obj
=
frame
.
f_locals
[
'
self
'
]
if
type
(
obj
)
!=
spack
.
Package
and
isinstance
(
obj
,
spack
.
Package
):
if
type
(
obj
)
!=
spack
.
Package
Base
and
isinstance
(
obj
,
spack
.
Package
Base
):
# NOQA: ignore=E501
break
else
:
# Didn't find anything
...
...
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