Skip to content

Commit 8e26167

Browse files
committed
Merge branch 'next'
2 parents 473c8bf + 5e9e3ec commit 8e26167

23 files changed

+1816
-798
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# github helper pieces to make some files not show up in diffs automatically
2+
installer_specs/*.lock linguist-generated=true

.github/workflows/build_radioconda.yml

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ on:
1010

1111
env:
1212
DISTNAME: radioconda
13-
SOURCE: github.com/ryanvolz/radioconda
13+
LICENSE_ID: BSD-3-Clause
14+
METAPACKAGE_LABEL: main
15+
METAPACKAGE_SUMMARY: Metapackage to install the radioconda package set.
1416

1517
jobs:
1618
build:
@@ -46,31 +48,31 @@ jobs:
4648
with:
4749
environment-file: buildenv.yaml
4850

49-
- name: Build installer (bash)
50-
if: runner.os != 'Windows'
51+
- name: Build installer
5152
shell: bash -l {0}
5253
env:
5354
PLATFORM: ${{ matrix.PLATFORM }}
55+
OS_NAME: ${{ matrix.OS_NAME }}
5456
run: |
57+
if [ "$OS_NAME" == "Windows" ]; then
58+
PATH=$CONDA_PREFIX/NSIS:$PATH
59+
fi
5560
python build_installer.py -v
5661
57-
- name: Build installer (cmd.exe)
58-
if: runner.os == 'Windows'
59-
shell: powershell
62+
- name: Build metapackage
63+
shell: bash -l {0}
6064
env:
6165
PLATFORM: ${{ matrix.PLATFORM }}
6266
run: |
63-
$Env:Path = "$Env:CONDA_PREFIX\NSIS;$Env:Path"
64-
echo $Env:Path
65-
python build_installer.py -v
67+
python build_metapackage.py
6668
67-
- name: Copy spec and list built installers
69+
- name: Copy lock file and list built installers and packages
6870
shell: bash
6971
env:
7072
PLATFORM: ${{ matrix.PLATFORM }}
7173
run: |
72-
cp installer_specs/$DISTNAME-$PLATFORM/$DISTNAME-$PLATFORM.txt dist/
73-
ls -lh dist
74+
cp installer_specs/$DISTNAME-$PLATFORM.lock dist/
75+
ls -lhR dist
7476
7577
- name: Test installer (sh)
7678
if: contains(matrix.OS_NAME, 'Linux') || contains(matrix.OS_NAME, 'MacOSX')
@@ -87,15 +89,30 @@ jobs:
8789
8890
- name: Test installer (pkg)
8991
if: contains(matrix.OS_NAME, 'MacOSX')
90-
continue-on-error: true # this test doesn't work yet
9192
shell: bash
9293
env:
9394
OS_NAME: ${{ matrix.OS_NAME }}
9495
ARCH: ${{ matrix.ARCH }}
9596
TARGET_VOLUME: CurrentUserHomeDirectory
96-
INSTALL_PATH: ~/Applications/${{ env.DISTNAME }}
97+
INSTALL_PATH: ${{ github.workspace }}/../../../${{ env.DISTNAME }}
9798
run: |
98-
installer -verbose -pkg dist/$DISTNAME-*-$OS_NAME-$ARCH.pkg -target $TARGET_VOLUME
99+
cat >pkg-choices.xml <<EOF
100+
<?xml version="1.0" encoding="UTF-8"?>
101+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
102+
<plist version="1.0">
103+
<array>
104+
<dict>
105+
<key>attributeSetting</key>
106+
<integer>0</integer>
107+
<key>choiceAttribute</key>
108+
<string>selected</string>
109+
<key>choiceIdentifier</key>
110+
<string>io.continuum.pkg.pathupdate</string>
111+
</dict>
112+
</array>
113+
</plist>
114+
EOF
115+
installer -verbose -dumplog -applyChoiceChangesXML pkg-choices.xml -pkg dist/$DISTNAME-*-$OS_NAME-$ARCH.pkg -target $TARGET_VOLUME
99116
eval "$($INSTALL_PATH/bin/conda shell.bash hook)"
100117
conda info
101118
conda list
@@ -146,3 +163,12 @@ jobs:
146163
tag: ${{ github.ref }}
147164
overwrite: true
148165
file_glob: true
166+
167+
- name: Upload metapackage to Anaconda.org
168+
if: startsWith(github.ref, 'refs/tags/')
169+
shell: bash -l {0}
170+
env:
171+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
172+
run: |
173+
micromamba --help
174+
anaconda upload -l $METAPACKAGE_LABEL --skip-existing dist/conda-bld/**/*

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,23 +94,25 @@ Once you have radioconda installed, you can stay up to date for all packages wit
9494

9595
### Upgrade to latest release
9696

97-
To install the latest release in particular, run (on Windows):
97+
To install the latest release in particular, run
9898

99-
mamba install --file https://github.com/ryanvolz/radioconda/releases/latest/download/radioconda-win-64.txt
99+
mamba upgrade -c ryanvolz radioconda
100100

101-
(on Linux/macOS):
101+
### Install a particular release
102102

103-
mamba install --file https://github.com/ryanvolz/radioconda/releases/latest/download/radioconda-$(conda info | sed -n -e 's/^.*platform : //p').txt
103+
To install a particular release version, substitute the desired version number and run
104104

105-
### Install a particular release
105+
mamba install -c ryanvolz radioconda=20NN.NN.NN
106+
107+
### Install from environment lock file
106108

107-
To install the package versions associated with a particular release, substitute the release number and run the following (on Windows):
109+
You can also install from the released environment lock file (on Windows):
108110

109-
mamba install --file https://github.com/ryanvolz/radioconda/releases/download/20NN.NN.NN/radioconda-win-64.txt
111+
mamba install --file https://github.com/ryanvolz/radioconda/releases/latest/download/radioconda-win-64.lock
110112

111113
(on Linux/macOS):
112114

113-
mamba install --file https://github.com/ryanvolz/radioconda/releases/download/20NN.NN.NN/radioconda-$(conda info | sed -n -e 's/^.*platform : //p').txt
115+
mamba install --file https://github.com/ryanvolz/radioconda/releases/latest/download/radioconda-$(conda info | sed -n -e 's/^.*platform : //p').lock
114116

115117
## Additional Installation for Device Support
116118

build_metapackage.py

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
#!/usr/bin/env python3
2+
import pathlib
3+
from typing import List
4+
5+
import yaml
6+
7+
8+
def read_env_file(
9+
env_file: pathlib.Path,
10+
fallback_name: str,
11+
fallback_version: str,
12+
fallback_platform: str,
13+
fallback_channels: List[str],
14+
) -> dict:
15+
with env_file.open("r") as f:
16+
env_dict = yaml.safe_load(f)
17+
18+
env_dict.setdefault("name", fallback_name)
19+
env_dict.setdefault("version", fallback_version)
20+
env_dict.setdefault("platform", fallback_platform)
21+
env_dict.setdefault("channels", fallback_channels)
22+
23+
return env_dict
24+
25+
26+
def get_conda_metapackage_cmdline(
27+
env_dict: dict, home: str, license_id: str, summary: str
28+
):
29+
cmdline = [
30+
"conda",
31+
"metapackage",
32+
env_dict["name"],
33+
env_dict["version"],
34+
"--no-anaconda-upload",
35+
"--home",
36+
home,
37+
"--license",
38+
license_id,
39+
"--summary",
40+
summary,
41+
]
42+
for channel in env_dict["channels"]:
43+
cmdline.extend(["--channel", channel])
44+
cmdline.extend(["--dependencies"] + env_dict["dependencies"])
45+
46+
return cmdline
47+
48+
49+
if __name__ == "__main__":
50+
import argparse
51+
import os
52+
import subprocess
53+
import shutil
54+
import sys
55+
56+
import conda_build.config
57+
58+
conda_build_config = conda_build.config.Config()
59+
60+
cwd = pathlib.Path(".").absolute()
61+
here = pathlib.Path(__file__).parent.absolute().relative_to(cwd)
62+
distname = os.getenv("DISTNAME", "radioconda")
63+
platform = os.getenv("PLATFORM", conda_build_config.subdir)
64+
source = "/".join(
65+
(
66+
os.getenv("GITHUB_SERVER_URL", "https://github.com"),
67+
os.getenv("GITHUB_REPOSITORY", "ryanvolz/radioconda"),
68+
)
69+
)
70+
license_id = os.getenv("LICENSE_ID", "BSD-3-Clause")
71+
summary = os.getenv("METAPACKAGE_SUMMARY", f"Metapackage for {distname}.")
72+
73+
parser = argparse.ArgumentParser(
74+
description=(
75+
"Build environment metapackage using conda-build."
76+
" Additional command-line options will be passed to conda metapackage."
77+
)
78+
)
79+
parser.add_argument(
80+
"env_file",
81+
type=pathlib.Path,
82+
nargs="?",
83+
default=here / "installer_specs" / f"{distname}-{platform}.yml",
84+
help=(
85+
"Environment yaml file for a particular platform"
86+
" (name ends in the platform identifier)."
87+
" (default: %(default)s)"
88+
),
89+
)
90+
parser.add_argument(
91+
"-o",
92+
"--output_dir",
93+
type=pathlib.Path,
94+
default=here / "dist" / "conda-bld",
95+
help=(
96+
"Output directory in which the metapackage will be placed."
97+
" (default: %(default)s)"
98+
),
99+
)
100+
parser.add_argument(
101+
"--home",
102+
default=source,
103+
help="The homepage for the metapackage. (default: %(default)s)",
104+
)
105+
parser.add_argument(
106+
"--license",
107+
default=license_id,
108+
help="The SPDX license identifier for the metapackage. (default: %(default)s)",
109+
)
110+
parser.add_argument(
111+
"--summary",
112+
default=summary,
113+
help="Summary of the package. (default: %(default)s)",
114+
)
115+
116+
args, metapackage_args = parser.parse_known_args()
117+
118+
env_dict = read_env_file(
119+
args.env_file,
120+
fallback_name=distname,
121+
fallback_version="0",
122+
fallback_platform=platform,
123+
fallback_channels=["conda-forge"],
124+
)
125+
126+
cmdline = get_conda_metapackage_cmdline(
127+
env_dict=env_dict, home=args.home, license_id=args.license, summary=args.summary
128+
)
129+
cmdline.extend(metapackage_args)
130+
131+
env = os.environ.copy()
132+
env["CONDA_SUBDIR"] = env_dict["platform"]
133+
134+
proc = subprocess.run(cmdline, env=env)
135+
136+
try:
137+
proc.check_returncode()
138+
except subprocess.CalledProcessError:
139+
sys.exit(1)
140+
141+
bldpkgs_dir = pathlib.Path(conda_build_config.croot) / env_dict["platform"]
142+
pkg_paths = list(bldpkgs_dir.glob(f"{env_dict['name']}-{env_dict['version']}*.bz2"))
143+
pkg_out_dir = args.output_dir / env_dict["platform"]
144+
pkg_out_dir.mkdir(parents=True, exist_ok=True)
145+
146+
for pkg in pkg_paths:
147+
shutil.copy(pkg, pkg_out_dir)

buildenv.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ name: buildenv
22
channels:
33
- conda-forge
44
dependencies:
5+
- anaconda-client
6+
- conda-build
57
- constructor

0 commit comments

Comments
 (0)