Skip to content

Commit 431861d

Browse files
Fix filtering for conda-build with our fixes.
1 parent c768178 commit 431861d

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

bioconda_utils/example_config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
env_matrix: ../scripts/env_matrix.yml
22
blacklists:
3-
- r-blacklist
3+
- r-blacklist
4+
upload_channel: bioconda
5+
channels:
6+
- anaconda
7+
- r
8+
- bioconda
49
#setup:
510
# - pip install git+https://github.com/bioconda/conda-build.git@reintroduce-skip-existing

bioconda_utils/utils.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import logging
1212
import pkg_resources
1313
import networkx as nx
14+
import requests
1415

1516
from conda_build.metadata import MetaData
1617
import yaml
@@ -203,34 +204,37 @@ def filter_recipes(recipes, env_matrix, config):
203204
env_matrix : EnvMatrix
204205
"""
205206

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+
206215
channel_args = []
207216
for c in config['channels']:
208217
channel_args.extend(['--channel', c])
209218

210-
# Given the startup time of conda-build, provide all recipes at once.
211-
def msgs(env):
219+
def pkgnames(env):
212220
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
214222
p = sp.run(
215-
cmds,
223+
cmd,
216224
check=True,
217225
stdout=sp.PIPE,
218226
stderr=sp.PIPE,
219227
universal_newlines=True,
220228
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]
227231

228232
try:
229-
for item in zip(recipes, *map(msgs, env_matrix)):
233+
for item in zip(recipes, *map(pkgnames, env_matrix)):
230234
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):
234238
yield recipe
235239
except sp.CalledProcessError as e:
236240
logger.error("%s" % e.stderr)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
],
2222
)
2323
],
24-
install_requires=["argh", "networkx", "pydotplus", "pyyaml", "conda_build", "docker-py"],
24+
install_requires=["argh", "networkx", "pydotplus", "pyyaml", "conda_build", "docker-py", "requests"],
2525
entry_points={"console_scripts": [
2626
"bioconda-utils = bioconda_utils.cli:main",
2727
"bioconductor_skeleton = bioconda_utils.bioconductor_skeleton:main"

0 commit comments

Comments
 (0)