summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-08-27 11:10:03 +0200
committerGitHub <noreply@github.com>2021-08-27 09:10:03 +0000
commitc152e558e948a53d5c206835a027194386c5eb8c (patch)
tree6033ca5a82a86c20b2b5b2b3fb0c97d28a8479a5
parent12e87ebf140ea936b2d2711a09e557ac6d2179b9 (diff)
downloadspack-c152e558e948a53d5c206835a027194386c5eb8c.tar.gz
spack-c152e558e948a53d5c206835a027194386c5eb8c.tar.bz2
spack-c152e558e948a53d5c206835a027194386c5eb8c.tar.xz
spack-c152e558e948a53d5c206835a027194386c5eb8c.zip
Make `SpecBuildInterface` pickleable (#25628)
* Add a __reduce__ method to SpecBuildInterface This class was confusing pickle when being serialized, due to its scary nature of being an object that disguise as another type. * Add more MacOS tests, switch them to clingo * Fix condition syntax * Remove Python v3.6 and v3.9 with macOS
-rw-r--r--.github/workflows/unit_tests.yaml4
-rw-r--r--lib/spack/spack/spec.py7
2 files changed, 10 insertions, 1 deletions
diff --git a/.github/workflows/unit_tests.yaml b/.github/workflows/unit_tests.yaml
index 6436b6f6ad..29c251503c 100644
--- a/.github/workflows/unit_tests.yaml
+++ b/.github/workflows/unit_tests.yaml
@@ -337,10 +337,14 @@ jobs:
run: |
brew install dash fish gcc gnupg2 kcov
- name: Run unit tests
+ env:
+ SPACK_TEST_SOLVER: clingo
run: |
git --version
. .github/workflows/setup_git.sh
. share/spack/setup-env.sh
+ $(which spack) bootstrap untrust spack-install
+ $(which spack) solve zlib
if [ "${{ needs.changes.outputs.with_coverage }}" == "true" ]
then
coverage run $(which spack) unit-test -x
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index af282e4425..7ab0ffa5fd 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1019,7 +1019,9 @@ class SpecBuildInterface(lang.ObjectWrapper):
def __init__(self, spec, name, query_parameters):
super(SpecBuildInterface, self).__init__(spec)
-
+ # Adding new attributes goes after super() call since the ObjectWrapper
+ # resets __dict__ to behave like the passed object
+ self.token = spec, name, query_parameters
is_virtual = spack.repo.path.is_virtual(name)
self.last_query = QueryState(
name=name,
@@ -1027,6 +1029,9 @@ class SpecBuildInterface(lang.ObjectWrapper):
isvirtual=is_virtual
)
+ def __reduce__(self):
+ return SpecBuildInterface, self.token
+
@lang.lazy_lexicographic_ordering(set_hash=False)
class Spec(object):