@@ -97,25 +97,36 @@ class DirTreeProcessEnv(ProcessEnv):
9797 def __init__ (self , folder : str , configEnv : dict [str : str ]):
9898 super ().__init__ (folder , configEnv , envType = ProcessEnvType .DIRTREE )
9999
100- venvLibPaths = glob .glob (f'{ folder } /lib*/python[0-9].[0-9]*/site-packages' , recursive = False )
101-
102- self .binPaths : list = [str (Path (folder , "bin" ))]
103- self .libPaths : list = [str (Path (folder , "lib" )), str (Path (folder , "lib64" ))]
104- self .pythonPaths : list = [str (Path (folder ))] + self .binPaths + venvLibPaths
100+ # If there is a virtual environment, it is expected to be named "venv".
101+ # Beside the virtual environment, a standard "bin"/"lib"/"lib64" hierarchy at
102+ # the top level of the plugin folder is expected.
103+ venvFolder = Path (folder , "venv" )
104+
105+ # Find all the libs that are not directly at the "lib*"-level
106+ envLibPaths = glob .glob (f'{ folder } /lib*/python[0-9].[0-9]*/site-packages' ,
107+ recursive = False )
108+ venvLibPaths = glob .glob (f'{ venvFolder } /lib*/python[0-9].[0-9]*/site-packages' ,
109+ recursive = False )
110+
111+ self .binPaths : list = [str (Path (folder , "bin" )), str (Path (venvFolder , "bin" ))]
112+ self .libPaths : list = [str (Path (folder , "lib" )), str (Path (folder , "lib64" )),
113+ str (Path (venvFolder , "lib" )), str (Path (venvFolder , "lib64" ))]
114+ self .pythonPaths : list = [str (Path (folder )), str (Path (venvFolder ))] + \
115+ self .binPaths + envLibPaths + venvLibPaths
105116
106117 if sys .platform == "win32" :
107118 # For Windows platforms, try and include the content of the virtual env if it exists
108119 # The virtual env is expected to be named "venv"
109- venvPath = Path (folder , "venv" , "Lib" , "site-packages" )
110- if venvPath .exists ():
111- self .pythonPaths .append (venvPath .as_posix ())
120+ venvLibPath = Path (venvFolder , "Lib" , "site-packages" )
121+ if venvLibPath .exists ():
122+ self .pythonPaths .append (venvLibPath .as_posix ())
112123 else :
113124 # For Linux platforms, lib paths may need to be discovered recursively to be properly
114125 # added to LD_LIBRARY_PATH
115126 extraLibPaths = []
116127 regex = re .compile (r"^lib(\d{2})?$" )
117- for venvPath in venvLibPaths :
118- for path , directories , _ in os .walk (venvPath ):
128+ for envPath in envLibPaths + venvLibPaths :
129+ for path , directories , _ in os .walk (envPath ):
119130 for directory in directories :
120131 if re .match (regex , directory ):
121132 extraLibPaths .append (os .path .join (path , directory ))
@@ -137,7 +148,6 @@ def __init__(self, folder: str, configEnv: dict[str: str]):
137148 self ._env [k ] = val
138149
139150
140-
141151class RezProcessEnv (ProcessEnv ):
142152 """
143153 """
0 commit comments