|
11 | 11 | import logging
|
12 | 12 | import pkg_resources
|
13 | 13 | import networkx as nx
|
| 14 | +import requests |
14 | 15 |
|
15 | 16 | from conda_build.metadata import MetaData
|
16 | 17 | import yaml
|
@@ -203,34 +204,37 @@ def filter_recipes(recipes, env_matrix, config):
|
203 | 204 | env_matrix : EnvMatrix
|
204 | 205 | """
|
205 | 206 |
|
| 207 | + if sys.platform == "linux": |
| 208 | + repodata = requests.get('https://conda.anaconda.org/bioconda/linux-64/repodata.json').json() |
| 209 | + elif sys.platform == "osx": |
| 210 | + repodata = requests.get('https://conda.anaconda.org/bioconda/osx-64/repodata.json').json() |
| 211 | + else: |
| 212 | + raise ValueError('Unsupported OS: bioconda only supports linux and osx.') |
| 213 | + channel_packages = set(repodata['packages'].keys()) |
| 214 | + |
206 | 215 | channel_args = []
|
207 | 216 | for c in config['channels']:
|
208 | 217 | channel_args.extend(['--channel', c])
|
209 | 218 |
|
210 |
| - # Given the startup time of conda-build, provide all recipes at once. |
211 |
| - def msgs(env): |
| 219 | + def pkgnames(env): |
212 | 220 | logger.debug(env)
|
213 |
| - cmds = ["conda", "build", "--skip-existing", "--override-channels", "--output", "--dirty"] + channel_args + recipes |
| 221 | + cmd = ["conda", "build", "--no-source", "--override-channels", "--output"] + channel_args + recipes |
214 | 222 | p = sp.run(
|
215 |
| - cmds, |
| 223 | + cmd, |
216 | 224 | check=True,
|
217 | 225 | stdout=sp.PIPE,
|
218 | 226 | stderr=sp.PIPE,
|
219 | 227 | universal_newlines=True,
|
220 | 228 | env=merged_env(env))
|
221 |
| - return [ |
222 |
| - msg |
223 |
| - for msg in p.stdout.strip().split("\n") if "Ignoring non-recipe" not in msg |
224 |
| - ] |
225 |
| - skip = lambda msg: \ |
226 |
| - "already built" in msg or "defines build/skip" in msg |
| 229 | + pkgpaths = p.stdout.strip().split("\n") |
| 230 | + return [os.path.basename(f) for f in pkgpaths] |
227 | 231 |
|
228 | 232 | try:
|
229 |
| - for item in zip(recipes, *map(msgs, env_matrix)): |
| 233 | + for item in zip(recipes, *map(pkgnames, env_matrix)): |
230 | 234 | recipe = item[0]
|
231 |
| - msg = item[1:] |
232 |
| - logger.debug("recipe %s: %s", recipe, '\n\t' + '\n\t'.join(msg)) |
233 |
| - if not all(map(skip, msg)): |
| 235 | + pkgs = [f for f in item[1:] if f != "skipped"] |
| 236 | + logger.debug("recipe %s: %s", recipe, '\n\t' + '\n\t'.join(pkgs)) |
| 237 | + if not channel_packages.issuperset(pkgs): |
234 | 238 | yield recipe
|
235 | 239 | except sp.CalledProcessError as e:
|
236 | 240 | logger.error("%s" % e.stderr)
|
|
0 commit comments