[core] DirTreeProcessEnv: add internal site-packages first

Ensures that the packages installed in a local virtualenv is taken
before the propagation of the global Meshroom environment to avoid
version conflicts.

Note: We tried to avoid checking files/folders on disk at startup for
performance reasons, but here we are forced to use glob as there is no
way to know the python version of the plugin in advance.
This commit is contained in:
Fabien Castan 2025-06-18 16:23:50 +02:00
parent 923be8dc11
commit d027bf8a7f

View file

@ -8,6 +8,7 @@ import sys
from enum import Enum
from inspect import getfile
from pathlib import Path
import glob
from meshroom.common import BaseObject
from meshroom.core import desc
@ -91,7 +92,7 @@ class DirTreeProcessEnv(ProcessEnv):
self.binPaths: list = [str(Path(folder, "bin"))]
self.libPaths: list = [str(Path(folder, "lib")), str(Path(folder, "lib64"))]
self.pythonPaths: list = [str(Path(folder))] + self.binPaths
self.pythonPaths: list = [str(Path(folder))] + self.binPaths + glob.glob(f'{folder}/lib*/python[0-9].[0-9]*/site-packages', recursive=False)
def getEnvDict(self) -> dict:
env = os.environ.copy()