Commit a2388f22 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Merge branch 'rf/platform-packages' into 'master'

RF: Platform specific platforms

See merge request fsl/conda/manifest-rules!35
parents c65a35dd cada37ef
#!/usr/bin/env python #!/usr/bin/env python
__version__ = '0.6.2' __version__ = '0.6.3'
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
# removed. The DRY_RUN variable must be explicitly set to "false" for any # removed. The DRY_RUN variable must be explicitly set to "false" for any
# files to actually be deleted. # files to actually be deleted.
# #
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import os.path as op import os.path as op
......
#!/usr/bin/env python #!/usr/bin/env python
#
# Deploy environment/manifest files to the release directory.
#
import os import os
import sys import sys
......
...@@ -15,14 +15,17 @@ from manifest_rules.utils import (load_release_info, ...@@ -15,14 +15,17 @@ from manifest_rules.utils import (load_release_info,
generate_development_version_identifier) generate_development_version_identifier)
def filter_packages(release_info, platform, cudaver): def generate_package_list(release_info, platform, cudaver):
"""Return a list of packages that should be included in the environment """Return a list of packages that should be included in the environment
file for the platform and CUDA version. file for the platform and CUDA version.
""" """
packages = release_info['packages'] pkgs = release_info['packages']
platpkgs = release_info.get(f'{platform}-packages', [])
pkgs = pkgs + platpkgs
cudapat = r'cuda-[\d]+\.[\d]+' cudapat = r'cuda-[\d]+\.[\d]+'
cudapkgs = [p for p in packages if re.search(cudapat, p) is not None] cudapkgs = [p for p in pkgs if re.search(cudapat, p) is not None]
otherpkgs = [p for p in packages if p not in cudapkgs] otherpkgs = [p for p in pkgs if p not in cudapkgs]
if cudaver is None: if cudaver is None:
return otherpkgs return otherpkgs
...@@ -41,7 +44,7 @@ def need_internal_channel(release_info, packages): ...@@ -41,7 +44,7 @@ def need_internal_channel(release_info, packages):
username = os.environ['FSLCONDA_USERNAME'] username = os.environ['FSLCONDA_USERNAME']
password = os.environ['FSLCONDA_PASSWORD'] password = os.environ['FSLCONDA_PASSWORD']
channel_url = release_info['internal_channel'] channel_url = release_info['internal-channel']
channel_url = channel_url.replace('${FSLCONDA_USERNAME}:${FSLCONDA_PASSWORD}@', '') channel_url = channel_url.replace('${FSLCONDA_USERNAME}:${FSLCONDA_PASSWORD}@', '')
internal_packages = get_channel_packages(channel_url, internal_packages = get_channel_packages(channel_url,
username=username, username=username,
...@@ -56,12 +59,12 @@ def generate_environment(release_info, version, platform, cudaver, outfile): ...@@ -56,12 +59,12 @@ def generate_environment(release_info, version, platform, cudaver, outfile):
"""Genereate an environment file for the platform and CUDA version. """Genereate an environment file for the platform and CUDA version.
""" """
channels = list(release_info['channels']) channels = list(release_info['channels'])
packages = filter_packages(release_info, platform, cudaver) packages = generate_package_list(release_info, platform, cudaver)
# Internal/dev release - add internal # Internal/dev release - add internal
# channel to environment spec if necessary # channel to environment spec if necessary
if need_internal_channel(release_info, packages): if need_internal_channel(release_info, packages):
channels = [release_info['internal_channel']] + channels channels = [release_info['internal-channel']] + channels
with open(outfile, 'wt') as f: with open(outfile, 'wt') as f:
f.write('name: FSL\n') f.write('name: FSL\n')
......
...@@ -48,7 +48,7 @@ def load_previous_manifest(release_info): ...@@ -48,7 +48,7 @@ def load_previous_manifest(release_info):
"""Downloads the previous official FSL manifest, returning it """Downloads the previous official FSL manifest, returning it
as a dict. Returns None if the manifest cannot be downloaded. as a dict. Returns None if the manifest cannot be downloaded.
""" """
url = urlparse.urljoin(release_info['release_url'], 'manifest.json') url = urlparse.urljoin(release_info['release-url'], 'manifest.json')
with tempdir(): with tempdir():
try: try:
...@@ -98,7 +98,7 @@ def load_previous_manifest(release_info): ...@@ -98,7 +98,7 @@ def load_previous_manifest(release_info):
def generate_installer_section(release_info): def generate_installer_section(release_info):
"""Generates the "installer" manifest section, returning a dict. """ """Generates the "installer" manifest section, returning a dict. """
version = release_info['installer'] version = release_info['installer']
url = urlparse.urljoin(release_info['release_url'], 'fslinstaller.py') url = urlparse.urljoin(release_info['release-url'], 'fslinstaller.py')
try: try:
with tempdir(): with tempdir():
...@@ -163,14 +163,14 @@ def generate_version_section(version, ...@@ -163,14 +163,14 @@ def generate_version_section(version,
checksum = sha256(envfile) checksum = sha256(envfile)
envfile = op.basename(envfile) envfile = op.basename(envfile)
output = install_info.get(envfile, None) output = install_info.get(envfile, None)
url = urlparse.urljoin(release_info['release_url'], envfile) url = urlparse.urljoin(release_info['release-url'], envfile)
version, platform, cuda = parse_environment_file_name(envfile) version, platform, cuda = parse_environment_file_name(envfile)
build = { build = {
'platform' : platform, 'platform' : platform,
'environment' : url, 'environment' : url,
'sha256' : checksum, 'sha256' : checksum,
'base_packages' : release_info['base_packages'] 'base_packages' : release_info['base-packages']
} }
if cuda is not None: if cuda is not None:
build['cuda'] = cuda build['cuda'] = cuda
......
...@@ -77,7 +77,7 @@ def full_test(envfile, release_info): ...@@ -77,7 +77,7 @@ def full_test(envfile, release_info):
platform = parse_environment_file_name(envfile)[1] platform = parse_environment_file_name(envfile)[1]
miniconda_url = release_info['miniconda'][platform] miniconda_url = release_info['miniconda'][platform]
base_packages = release_info['base_packages'] base_packages = release_info['base-packages']
base_packages = sorted(base_packages, key=len, reverse=True) base_packages = sorted(base_packages, key=len, reverse=True)
download_file(miniconda_url, 'miniconda.sh') download_file(miniconda_url, 'miniconda.sh')
......
Markdown is supported
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