Skip to content

Commit

Permalink
Fix bug in generation of windows_import
Browse files Browse the repository at this point in the history
Fix addition of empty path to environment variable
  • Loading branch information
langmm committed Jun 7, 2024
1 parent 0a72f15 commit 2409be8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions yggdrasil/drivers/CompiledModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2667,7 +2667,8 @@ def generate(self, filetype=None, overwrite=False, **kwargs):
if filetype in self.always_generated:
overwrite = True
key = self.key(filetype)
if key in self.generated and not os.path.isfile(self.files[key]):
if ((key in self.generated and key in self.files
and not os.path.isfile(self.files[key]))):
kwargs['previous'] = self.files.pop(key)
if key in self.files and not overwrite:
return self.files[key]
Expand Down Expand Up @@ -2949,7 +2950,7 @@ def _result(self, **kwargs):

def _generated_windows_import(self, previous=None, **kwargs):
out = None
dll = self.get('shared', **kwargs)
dll = self.get('shared', default=None, **kwargs)
# TODO: temp
logger.info(f"GENERATED_WINDOWS_IMPORT [{self.name}]: {dll} "
f"(previous = {previous}")
Expand Down Expand Up @@ -3546,8 +3547,9 @@ def _shared_path_env(self, to_update=None, out=None,
if env_var and paths_to_add:
path_list = []
prev_path = to_update.get(env_var, '')
prev_path_list = prev_path.split(os.pathsep)
prev_path_list = []
if prev_path:
prev_path_list += prev_path.split(os.pathsep)
path_list.append(prev_path)
for x in paths_to_add:
if x not in prev_path_list:
Expand Down Expand Up @@ -4851,7 +4853,8 @@ def get_search_path(cls, env_only=False, libtype=None, cfg=None,
if (cls.search_path_envvar is not None) and (not env_only):
assert isinstance(cls.search_path_envvar, list)
for ienv in cls.search_path_envvar:
paths += os.environ.get(ienv, '').split(os.pathsep)
if os.environ.get(ienv, ''):
paths += os.environ[ienv].split(os.pathsep)
# Get flags based on path
if (cls.search_path_flags is not None) and (not env_only):
output = cls.call(cls.search_path_flags, for_version=True)[0]
Expand Down

0 comments on commit 2409be8

Please sign in to comment.