Skip to content

Commit

Permalink
Update build requirement
Browse files Browse the repository at this point in the history
Add debug messages for checking environment
Fix regex for GNU ar
  • Loading branch information
langmm committed May 24, 2024
1 parent fa4640a commit ab8648e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 14 deletions.
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ build:

requirements:
build:
- build
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- hatch-fancy-pypi-readme
- numpy >=1.13.0
- python # [build_platform != target_platform]
- python-build
- scikit-build-core
- setuptools_scm
- {{ compiler('c') }}
Expand Down
14 changes: 12 additions & 2 deletions utils/requirements/requirements.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
{
"general": [
{
"build": {
"python-build": {
"flags": {
"build": true,
"build_only": true
}
},
"options": [
{
"name": "build",
"method": "pip"
},
{
"name": "python-build",
"method": "conda"
}
]
}
},
"chevron",
Expand Down
7 changes: 6 additions & 1 deletion utils/requirements/requirements.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
general:
- build:
- python-build:
flags:
build: True
build_only: True
options:
- name: build
method: pip
- name: python-build
method: conda
- chevron
- "cross-python_{{ target_platform }}":
method: conda_recipe
Expand Down
3 changes: 2 additions & 1 deletion yggdrasil/drivers/CModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ class ARArchiver(ArchiverBase):
output_first_library = True
toolset = 'gnu'
version_regex = [
r'(?P<version>GNU ar version \d+\.\d+\.\d+(?:\-[\.0-9a-zA-Z]+)?)']
r'(?P<version>GNU ar \(.+\) \d+\.\d+(?:\.\d+)?'
r'(?:\-[\.0-9a-zA-Z]+)?)']
compatible_toolsets = ['llvm']
search_path_envvar = ['LIBRARY_PATH']

Expand Down
43 changes: 34 additions & 9 deletions yggdrasil/drivers/CompiledModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -4032,10 +4032,10 @@ def before_registration(cls):
setattr(cls, k, copy.deepcopy(getattr(cls, k, [])))
# Set attributes based on environment variables or sysconfig
if cls.default_executable is None:
cls.default_executable = cls.env_matches_tool()
cls.default_executable = cls.env_matches_tool(verbose=True)
if cls.default_executable is None:
cls.default_executable = cls.env_matches_tool(
use_sysconfig=True)
use_sysconfig=True, verbose=True)
# Set default_executable to name
if cls.default_executable is None:
cls.default_executable = cls.toolname
Expand Down Expand Up @@ -4452,7 +4452,7 @@ def is_installed(cls):

@classmethod
def env_matches_tool(cls, use_sysconfig=False, env=None,
with_flags=False):
with_flags=False, verbose=False):
r"""Determine if the executable pointed to by any environment
variable matches this compilation tool.
Expand All @@ -4464,6 +4464,8 @@ def env_matches_tool(cls, use_sysconfig=False, env=None,
updated with variables. Defaults to None and is ignored.
with_flags (bool, optional): If True, preserve any flags
included in the environment variable. Defaults to False.
verbose (bool, optional): If True, print out information about
the tools that were compared and the result.
Returns:
bool: True if the environment variable matches, False otherwise.
Expand All @@ -4490,16 +4492,39 @@ def env_matches_tool(cls, use_sysconfig=False, env=None,
envi_version = CompilationToolBase.tool_version_static(
cls, envi_executable, require_match=True)
if this_version and this_version and this_version == envi_version:
if verbose:
logger.info(f"{cls.tooltype.title()} {cls.toolname} "
f"matches environment variable "
f"(use_sysconfig={use_sysconfig}) "
f"{cls.default_executable_env}:"
f"\n\t{envi_full}"
f"\n\ttool_exe = {this_executable}"
f"\n\tenvi_exe = {envi_executable}"
f"\n\ttool_ver = {this_version}"
f"\n\tenvi_ver = {envi_version}")
return out
if this_executable == cls.toolname and envi_version:
if verbose:
logger.info(f"{cls.tooltype.title()} {cls.toolname} "
f"overriden from environment variable "
f"(use_sysconfig={use_sysconfig}) "
f"{cls.default_executable_env}:"
f"\n\t{envi_full}"
f"\n\ttool_exe = {this_executable}"
f"\n\tenvi_exe = {envi_executable}"
f"\n\ttool_ver = {this_version}"
f"\n\tenvi_ver = {envi_version}")
return out
if this_version and envi_version:
logger.info(f"{cls.tooltype.title()} {cls.toolname} "
f"does not match environment:"
f"\n\ttool_exe = {this_executable}"
f"\n\tenvi_exe = {envi_executable}"
f"\n\ttool_ver = {this_version}"
f"\n\tenvi_ver = {envi_version}")
if verbose:
logger.info(f"{cls.tooltype.title()} {cls.toolname} "
f"does not match environment variable "
f"(use_sysconfig={use_sysconfig}) "
f"{cls.default_executable_env}:"
f"\n\ttool_exe = {this_executable}"
f"\n\tenvi_exe = {envi_executable}"
f"\n\ttool_ver = {this_version}"
f"\n\tenvi_ver = {envi_version}")
return None

@classmethod
Expand Down

0 comments on commit ab8648e

Please sign in to comment.