Skip to content

Commit

Permalink
Include homebrew prefix in search directories for libraries
Browse files Browse the repository at this point in the history
Don't require full path for language libraries
  • Loading branch information
langmm committed May 23, 2024
1 parent ba54193 commit c9cf1cd
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions yggdrasil/drivers/CompiledModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1989,7 +1989,7 @@ def mixed_toolset(self):
def requires_fullpath(self):
r"""bool: True if the full path is required."""
return (not (self.get('is_standard', False)
or self.origin in ['standard']))
or self.origin in ['standard', 'language']))

@property
def is_standard(self):
Expand Down Expand Up @@ -3445,7 +3445,7 @@ def _dep_libtool_kwargs(self, key, to_update=None, dep_libtype=None,
if self.is_rebuildable and not os.path.isfile(dep_lib):
dep_lib_result = self.build()[0]
assert dep_lib == dep_lib_result
if (not os.path.isfile(dep_lib)) and (self.origin != 'language'):
if not os.path.isfile(dep_lib):
raise RuntimeError(f"Library for {self.name} dependency "
f"does not exist: '{dep_lib}'.")
if ((self['libtype'] in self.library_files
Expand Down Expand Up @@ -4482,10 +4482,11 @@ def env_matches_tool(cls, use_sysconfig=False, env=None,
if not with_flags:
envi_full = envi_full.split(maxsplit=1)[0]
return envi_full
logger.info(f"{cls.tooltype.title()} {cls.toolname} does not "
f"match environment:"
f"\n\ttool_base = {tool_base}"
f"\n\tenvi_base = {envi_base}")
if tool_base and envi_base:
logger.info(f"{cls.tooltype.title()} {cls.toolname} does not "
f"match environment:"
f"\n\ttool_base = {tool_base}"
f"\n\tenvi_base = {envi_base}")
return out

@classmethod
Expand Down Expand Up @@ -4793,6 +4794,7 @@ def get_search_path(cls, env_only=False, libtype=None, cfg=None,
base_paths.append(os.environ['ChocolateyInstall'])
else:
base_paths = ['/usr', os.path.join('/usr', 'local')]
brew_prefix = None
if platform._is_mac:
macos_sdkroot = cfg.get('c', 'macos_sdkroot', None)
base_paths += [
Expand All @@ -4808,6 +4810,12 @@ def get_search_path(cls, env_only=False, libtype=None, cfg=None,
os.path.join(
macos_sdkroot.split('/Platforms', 1)[0],
'Toolchains/XcodeDefault.xctoolchain/usr'))
try:
brew_prefix = subprocess.check_output(
['brew', '--prefix']).decode('utf-8').strip()
base_paths.append(brew_prefix)
except (subprocess.CalledProcessError, OSError):
pass
for base in base_paths:
paths.append(os.path.join(base, suffix))
if platform._is_mac:
Expand All @@ -4819,6 +4827,11 @@ def get_search_path(cls, env_only=False, libtype=None, cfg=None,
if ((('AppleTV' not in x) and ('iPhoneOS' not in x)
and ('WatchOS' not in x))):
paths.append(x)
if brew_prefix:
paths += [
os.path.join(brew_prefix, 'llvm'),
os.path.join(brew_prefix, suffix, 'llvm'),
]
paths += [
"/usr/local/Cellar/llvm/"]
out = []
Expand Down

0 comments on commit c9cf1cd

Please sign in to comment.