Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bioconda_utils/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess as sp
from collections import defaultdict, namedtuple
import os
import sys
import logging
import itertools

Expand Down Expand Up @@ -116,6 +117,16 @@ def build(recipe: str, pkg_paths: List[str] = None,
env=whitelisted_env,
noarch=is_noarch)
# Use presence of expected packages to check for success
if (docker_builder.pkg_dir is not None):
platform = os.environ.get('OSTYPE', sys.platform)
if platform.startswith("darwin"):
platform = 'osx'
elif platform == "linux-gnu":
platform = "linux"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The platform can be inferred from RepoData().native_platform().

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, make sure that you indent only with 4 spaces.


config = utils.load_conda_build_config(platform=platform)
pkg_paths = [p.replace(config.output_folder, docker_builder.pkg_dir) for p in pkg_paths]

for pkg_path in pkg_paths:
if not os.path.exists(pkg_path):
logger.error(
Expand Down
31 changes: 30 additions & 1 deletion test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,31 @@ def single_build(request, recipes_fixture):
yield recipes_fixture.pkgs['one']
for pkg in recipes_fixture.pkgs['one']:
ensure_missing(pkg)


@pytest.fixture(scope='module', ids=IDS)
def single_build_pkg_dir(request, recipes_fixture):
"""
Builds the "one" recipe with pkg_dir.
"""
logger.error("Making recipe builder")
docker_builder = docker_utils.RecipeBuilder(
use_host_conda_bld=True,
pkg_dir=os.getcwd() + "/output",
docker_base_image=DOCKER_BASE_IMAGE)
mulled_test = True
logger.error("DONE")
logger.error("Fixture: Building 'one' within docker with pkg_dir")
build.build(
recipe=recipes_fixture.recipe_dirs['one'],
pkg_paths=recipes_fixture.pkgs['one'],
docker_builder=docker_builder,
mulled_test=mulled_test,
)
logger.error("Fixture: Building 'one' within docker and pkg_dir -- DONE")
yield recipes_fixture.pkgs['one']
for pkg in recipes_fixture.pkgs['one']:
ensure_missing(pkg)


@pytest.fixture(scope='module', params=PARAMS, ids=IDS)
Expand Down Expand Up @@ -216,7 +241,11 @@ def test_upload(single_upload):
def test_single_build_only(single_build):
for pkg in single_build:
assert os.path.exists(pkg)


@pytest.mark.long_running_2
def test_single_build_pkg_dir(single_build):
for pkg in single_build:
assert os.path.exists(pkg)

@pytest.mark.skipif(SKIP_DOCKER_TESTS, reason='skipping on osx')
def test_single_build_with_post_test(single_build):
Expand Down