Fix order of deserialization in subprocess context (#45229)

Since the the MetaPathFinder now owns a lazily constructed RepoPath object, we need to deserialize environments before the package that needs to be restored. Before we were relying on globals to be inconsistent in a way that let the entire process go.
This commit is contained in:
Massimiliano Culpo 2024-07-16 18:15:29 +02:00 committed by GitHub
parent b539eb5aab
commit ce1b569b69
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -79,9 +79,11 @@ def restore(self):
self.test_state.restore()
spack.main.spack_working_dir = self.spack_working_dir
env = pickle.load(self.serialized_env) if _SERIALIZE else self.env
pkg = pickle.load(self.serialized_pkg) if _SERIALIZE else self.pkg
if env:
spack.environment.activate(env)
# Order of operation is important, since the package might be retrieved
# from a repo defined within the environment configuration
pkg = pickle.load(self.serialized_pkg) if _SERIALIZE else self.pkg
return pkg