Commit 9d4eda06 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

MNT: Remove old things destined for separate manifest project

parent 9fb257bb
boost-cpp=1.74.*
fsl-avwutils
fsl-eddy
numpy=1.20.*
openblas=0.3.*
python=3.9.*
tk=8.6.*
zlib=1.2.*
#!/usr/bin/env python
"""Generate conda YAML environment specifications for specific platforms.
This script reads the fsl-environment-yml.template template file, and generates
a new file from it for a specific platform and, optionally, CUDA version.
"""
import os.path as op
import re
import sys
USAGE = """Usage: generate_environment_spec.py outfile platform [cudaver]
Generates a conda YAML environment specification file for a specific platform
(and, optionally, CUDA version).
Arguments:
- outfile: File to write generated specification to
- platform: Platform to generate specification for (linux, macOS)
- cudaver: (Optional) CUDA version to generate specification for
(9.2 10.2 11.1 11.2).
"""
CHANNELS = [
'http://18.133.213.73/production/',
'conda-forge',
'defaults'
]
def parse_selector(selector):
"""Parses a selector specification. A selector specification is a
sequence of key-value pairs which are appended to lines in the
fsl-environment.yml template file. For example:
platform:linux, cudaver:9.2
Returns a dictionary containing the key-value pairs.
"""
selector = selector.lower()
kvps = selector.split(',')
kvps = selector.split(',')
kvps = [kvp.strip().split(':') for kvp in kvps]
return dict((k.strip(), v.strip()) for k, v in kvps)
def filter_packages(packages, selectors):
"""Filters the given package list according to the given selectors. """
pat = r'^(.+) *# *\[(.+)\]$'
include = []
for pkg in packages:
match = re.fullmatch(pat, pkg)
if match is None:
include.append(pkg)
continue
pkg = match.group(1)
pkg_selector = match.group(2)
pkg_selector = parse_selector(pkg_selector)
selected = all(selectors.get(k, None) == v
for k, v in pkg_selector.items())
if selected:
include.append(pkg)
return include
def load_packages(pkgfile):
"""Load the fsl-packages.txt file, returning a list of package entries. """
with open(pkgfile) as f:
packages = f.readlines()
packages = [p.strip() for p in packages]
packages = [p for p in packages if p != '' and not p.startswith('#')]
return packages
def generate_environment_spec(outfile, channels, packages):
"""Writes a conda YAML environment speciifcation to the given file,
containing the given channels and packages.
"""
with open(outfile, 'wt') as f:
f.write('channels:\n')
for channel in channels:
f.write(f' - {channel}\n')
f.write('dependencies:\n')
for pkg in packages:
f.write(f' - {pkg}\n')
def main():
"""Generates a conda YAML environment specification file. """
if len(sys.argv) not in (3, 4):
print(USAGE)
return 1
thisdir = op.abspath(op.dirname(__file__))
pkgfile = op.join(thisdir, 'fsl-packages.txt')
outfile = sys.argv[1]
selectors = {}
selectors['platform'] = sys.argv[2].lower()
if len(sys.argv) == 4:
selectors['cudaver'] = sys.argv[3].lower()
packages = load_packages(pkgfile)
packages = filter_packages(packages, selectors)
generate_environment_spec(outfile, CHANNELS, packages)
if __name__ == '__main__':
sys.exit(main())
// The FSL installer manifest file contains information
// about the fslinstaller script, and about versions of
// FSL that are available for download.
//
// This file is an example, and is used for testing. The
// official installer manifest.json file is automatically
// generated/updated by the generate_manifest.py script,
// which is run when a new version of FSL is released.
//
// Lines beginning with // are treated as comments and
// ignored. Trailing comments are not supported.
{
// The "installer" section contains information about the
// latest available version of the fslinstaller script
"installer" : {
// Latest version of fslinstaller script
"version" : "1.2.3",
// URL to download fslinstaller script
"url" : "http://localhost:8888/fslinstaller.py",
// SHA256 checksum of installer script
"sha256" : "f6b234c11ccabd6454b0c5b2bdf1a2a69e521c596187d887d69938a3c344af3e"
},
// URLs to download miniconda/miniforge
"miniconda" : {
"linux-64" : {
"url" : "https://github.com/conda-forge/miniforge/releases/download/4.10.3-1/Miniforge3-4.10.3-1-Linux-x86_64.sh",
"sha256" : "303d65289f600fa4c85fe2b0fef9bb0848ec544a75a9c3079607d847918f7023",
// Number of lines of output to expect
// when running the miniconda installer
// script - used to report progress to
// the user.
"output" : "194"
},
"macos-64" : {
"url" : "https://github.com/conda-forge/miniforge/releases/download/4.10.3-1/Miniforge3-4.10.3-1-MacOSX-x86_64.sh",
"sha256" : "8ed6871bbd0b24f66b2d87fd88cbcd0854142e5cf1447de5f5f246884ef9c846",
"output" : "87"
}
},
// The "versions" section contains information
// about all available versions of FSL. FSL version
// are distributed as conda environment.yml files.
"versions" : {
// Reference to latest available
// version - must be present
"latest" : "6.1.0",
// Builds available for this version. A build
// entry contains the following fields:
//
// - "platform" Architecture/platform - currently one of
// "linux-64" or "macos-64"
// - "cuda" Version of CUDA that this build was built
// against. MUST NOT be present for non-CUDA
// builds.
// - "environment" Conda environment.yml file
// - "sha256" SHA256 checksum of environment.yml file
// - "output" Dictionary containing number of lines of
// output to expect when installing the FSL
// environment ("install" : "100"), or when
// updating from an older FSL installation
// (e.g. "6.1.0" : "50") - used to report
// progress to the user.
"6.1.0" : [
{
"platform" : "linux-64",
"environment" : "http://localhost:8888/fsl-6.1.0-linux-64.yml",
"sha256" : "952a0101fc19948e785572f8c06436c59f19c4ef92df9425f2e2033d4b986918",
"output" : {
"install" : "92",
"6.0.6" : "11"
}
},
{
"platform" : "macos-64",
"environment" : "http://localhost:8888/fsl-6.1.0-macos-64.yml",
"sha256" : "952a0101fc19948e785572f8c06436c59f19c4ef92df9425f2e2033d4b986918",
"output" : {
"install" : "92",
"6.0.6" : "11"
}
},
{
"platform" : "linux-64",
"cuda" : "9.2",
"environment" : "http://localhost:8888/fsl-6.1.0-linux-64-cuda9.2.yml",
"sha256" : "952a0101fc19948e785572f8c06436c59f19c4ef92df9425f2e2033d4b986918",
"output" : {
"install" : "92",
"6.0.6" : "11"
}
},
{
"platform" : "linux-64",
"cuda" : "10.2",
"environment" : "http://localhost:8888/fsl-6.1.0-linux-64-cuda10.2.yml",
"sha256" : "85ef650586c1d7f3475fe7d16108bb94b737decbfc7506ad4deff2917365d05f",
"output" : {
"install" : "92",
"6.0.6" : "11"
}
}
],
"6.2.0" : [
{
"platform" : "linux-64",
"environment" : "http://localhost:8888/fsl-6.2.0-linux-64.yml",
"sha256" : "952a0101fc19948e785572f8c06436c59f19c4ef92df9425f2e2033d4b986918",
"output" : {
"install" : "92",
"6.0.6" : "11",
"6.1.0" : "11"
}
},
{
"platform" : "macos-64",
"environment" : "http://localhost:8888/fsl-6.2.0-macos-64.yml",
"sha256" : "952a0101fc19948e785572f8c06436c59f19c4ef92df9425f2e2033d4b986918",
"output" : {
"install" : "92",
"6.0.6" : "11",
"6.1.0" : "11"
}
},
{
"platform" : "linux-64",
"cuda" : "9.2",
"environment" : "http://localhost:8888/fsl-6.2.0-linux-64-cuda9.2.yml",
"sha256" : "952a0101fc19948e785572f8c06436c59f19c4ef92df9425f2e2033d4b986918",
"output" : {
"install" : "92",
"6.0.6" : "11",
"6.1.0" : "11"
}
},
{
"platform" : "linux-64",
"cuda" : "10.2",
"environment" : "http://localhost:8888/fsl-6.2.0-linux-64-cuda10.2.yml",
"sha256" : "6499385a2f5d2da48f4a44c95e090a5156319b0acbbd47029d4270abc691a290",
"output" : {
"install" : "92",
"6.0.6" : "11",
"6.1.0" : "11"
}
}
]
}
}
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