Commit 106c5877 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

RF: Move platform id gen code to function for reuse

parent 0094a837
...@@ -18,6 +18,7 @@ import sys ...@@ -18,6 +18,7 @@ import sys
from fsl_ci.conda import get_channel_packages from fsl_ci.conda import get_channel_packages
from manifest_rules.utils import (load_release_info, from manifest_rules.utils import (load_release_info,
get_platform_identifiers,
generate_environment_file_name, generate_environment_file_name,
generate_development_version_identifier) generate_development_version_identifier)
...@@ -88,12 +89,7 @@ def generate_variants(release_info): ...@@ -88,12 +89,7 @@ def generate_variants(release_info):
file should be generated. For non-CUDA environments, cudaver will be None. file should be generated. For non-CUDA environments, cudaver will be None.
""" """
cudas = [None] + list(release_info['cuda']) cudas = [None] + list(release_info['cuda'])
platforms = os.environ.get('FSLCONDA_PLATFORMS', None) platforms = get_platform_identifiers(release_info)
if platforms is None:
platforms = list(release_info['miniconda'].keys())
else:
platforms = platforms = platforms.split(',')
variants = list(it.product(platforms, cudas)) variants = list(it.product(platforms, cudas))
# CUDA builds are only supported # CUDA builds are only supported
......
...@@ -174,6 +174,18 @@ def load_release_info(fsl_release_file): ...@@ -174,6 +174,18 @@ def load_release_info(fsl_release_file):
return yaml.load(f.read(), Loader=yaml.Loader) return yaml.load(f.read(), Loader=yaml.Loader)
def get_platform_identifiers(release_info):
"""Returns a list of all platform identifiers for which FSL environment
files are being generated, e.g. ['linux-64', 'macos-64', 'macos-M1'].
"""
platforms = os.environ.get('FSLCONDA_PLATFORMS', None)
if platforms is None:
platforms = list(release_info['miniconda'].keys())
else:
platforms = platforms.split(',')
return platforms
@contextlib.contextmanager @contextlib.contextmanager
def tempdir(): def tempdir():
"""Returns a context manager which creates, changes into, and returns a """Returns a context manager which creates, changes into, and returns a
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment