Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Yikun committed Oct 13, 2023
1 parent db803d3 commit 56ecf17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
13 changes: 7 additions & 6 deletions bioconda_utils/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,21 +260,21 @@ def get_subdags(dag, n_workers, worker_offset):
return subdags


def do_not_consider_for_additional_platform(recipe_folder: str, recipe: str):
def do_not_consider_for_additional_platform(recipe_folder: str, recipe: str, platform: str):
"""
Given a recipe, check this recipe should skip in current platform or not.
Arguments:
recipe_folder: Directory containing possibly many, and possibly nested, recipes.
recipe: recipe name
recipe: Relative path to recipe
platform: current native platform
Returns:
Return True if current native platform are not included in recipe's additional platforms (no need to build).
"""
recipe_obj = _recipe.Recipe.from_file(recipe_folder, recipe)
native_platform = utils.RepoData().native_platform()
# On linux-aarch64 env, only build recipe with linux-aarch64 extra_additional_platforms
if native_platform == "linux-aarch64":
if platform == "linux-aarch64":
if "linux-aarch64" not in recipe_obj.extra_additional_platforms:
return True
return False
Expand Down Expand Up @@ -377,8 +377,9 @@ def build_recipes(recipe_folder: str, config_path: str, recipes: List[str],
failed_uploads = []

for recipe, name in recipes:
if not force and do_not_consider_for_additional_platform(recipe_folder, recipe):
logger.info("BUILD SKIP: skipping %s for additional platform", recipe)
platform = utils.RepoData().native_platform()
if not force and do_not_consider_for_additional_platform(recipe_folder, recipe, platform):
logger.info("BUILD SKIP: skipping %s for additional platform %s", recipe, platform)
continue

if name in skip_dependent:
Expand Down
11 changes: 5 additions & 6 deletions test/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import tempfile
import requests
import uuid
import unittest.mock
import contextlib
import tarfile
import logging
Expand Down Expand Up @@ -890,8 +889,7 @@ def test_load_meta_skipping():
assert utils.load_all_meta(recipe) == []


@unittest.mock.patch('bioconda_utils.utils.RepoData.native_platform')
def test_native_platform_skipping(func_mock):
def test_native_platform_skipping():
expections = [
# Don't skip linux-x86 for any recipes
["one", "linux", False],
Expand Down Expand Up @@ -920,10 +918,11 @@ def test_native_platform_skipping(func_mock):
r.write_recipes()
# Make sure RepoData singleton init
utils.RepoData.register_config(config_fixture)
for recipe_name, native_platform, result in expections:
for recipe_name, platform, result in expections:
recipe_folder = os.path.dirname(r.recipe_dirs[recipe_name])
func_mock.return_value = native_platform
assert build.do_not_consider_for_additional_platform(recipe_folder, r.recipe_dirs[recipe_name]) == result
assert build.do_not_consider_for_additional_platform(recipe_folder,
r.recipe_dirs[recipe_name],
platform) == result


def test_variants():
Expand Down

0 comments on commit 56ecf17

Please sign in to comment.