From 594474690b522b96f6063ab0a0cda751542a9c00 Mon Sep 17 00:00:00 2001 From: aliciaaevans Date: Thu, 21 Mar 2024 16:51:12 -0400 Subject: [PATCH 1/4] feat: add osx-arm64 to platform checks --- bioconda_utils/build.py | 5 ++++- bioconda_utils/utils.py | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/bioconda_utils/build.py b/bioconda_utils/build.py index 92f7b0ae3e..ec17e963cf 100644 --- a/bioconda_utils/build.py +++ b/bioconda_utils/build.py @@ -277,10 +277,13 @@ def do_not_consider_for_additional_platform(recipe_folder: str, recipe: str, pla 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) - # On linux-aarch64 env, only build recipe with linux-aarch64 extra_additional_platforms + # On linux-aarch64 or osx-arm64 env, only build recipe with matching extra_additional_platforms if platform == "linux-aarch64": if "linux-aarch64" not in recipe_obj.extra_additional_platforms: return True + if platform == "osx-arm64": + if "osx-arm64" not in recipe_obj.extra_additional_platforms: + return True return False diff --git a/bioconda_utils/utils.py b/bioconda_utils/utils.py index 2e3277ecb7..cc6be6ec09 100644 --- a/bioconda_utils/utils.py +++ b/bioconda_utils/utils.py @@ -1520,6 +1520,8 @@ def native_platform(): return "linux-aarch64" if sys.platform.startswith("linux"): return "linux" + if sys.platform.startswith("darwin") and arch == "arm64": + return "osx-arm64" if sys.platform.startswith("darwin"): return "osx" raise ValueError("Running on unsupported platform") @@ -1532,11 +1534,13 @@ def platform2subdir(platform): return 'linux-aarch64' elif platform == 'osx': return 'osx-64' + elif platform == 'osx-arm64': + return 'osx-arm64' elif platform == 'noarch': return 'noarch' else: raise ValueError( - 'Unsupported platform: bioconda only supports linux, linux-aarch64, osx and noarch.') + 'Unsupported platform: bioconda only supports linux, linux-aarch64, osx, osx-arm64 and noarch.') def get_versions(self, name): From 25c7f3d695d4a2389f740d16d328c6f9f17d3725 Mon Sep 17 00:00:00 2001 From: aliciaaevans Date: Fri, 22 Mar 2024 16:47:14 -0400 Subject: [PATCH 2/4] tests for osx-arm64 platform checking --- test/test_recipe.py | 23 +++++++++++++++++++++++ test/test_utils.py | 9 +++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/test/test_recipe.py b/test/test_recipe.py index 5e1b84559c..e3822ce7a9 100644 --- a/test/test_recipe.py +++ b/test/test_recipe.py @@ -260,6 +260,29 @@ def test_recipe_package_names(recipe): @with_recipes def test_recipe_extra_additional_platforms(recipe): + assert recipe.extra_additional_platforms == [] + recipe.meta_yaml += [ + 'extra:', + ' additional-platforms:', + ' - linux-aarch64', + ' - osx-arm64' + ] + recipe.render() + assert recipe.extra_additional_platforms == ["linux-aarch64", "osx-arm64"] + +@with_recipes +def test_recipe_extra_additional_platform_osx(recipe): + assert recipe.extra_additional_platforms == [] + recipe.meta_yaml += [ + 'extra:', + ' additional-platforms:', + ' - osx-arm64' + ] + recipe.render() + assert recipe.extra_additional_platforms == ["osx-arm64"] + +@with_recipes +def test_recipe_extra_additional_platform_linux(recipe): assert recipe.extra_additional_platforms == [] recipe.meta_yaml += [ 'extra:', diff --git a/test/test_utils.py b/test/test_utils.py index 855252f0d5..63bd9318cc 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -939,10 +939,14 @@ def test_native_platform_skipping(): # Don't skip linux-x86 for any recipes ["one", "linux", False], ["two", "linux", False], - # Skip recipe without linux aarch64 enable on linux-aarch64 platform + # Skip recipe without linux aarch64 enabled on linux-aarch64 platform ["one", "linux-aarch64", True], - # Don't skip recipe with linux aarch64 enable on linux-aarch64 platform + # Don't skip recipe with linux aarch64 enabled on linux-aarch64 platform ["two", "linux-aarch64", False], + # Skip recipe without osx-arm64 enabled on osx-arm64 platform + ["one", "osx-arm64", True], + # Don't skip recipe with osx-arm64 enabled on osx-arm64 platform + ["two", "osx-arm64", False], ] r = Recipes( """ @@ -959,6 +963,7 @@ def test_native_platform_skipping(): extra: additional-platforms: - linux-aarch64 + - osx-arm64 """, from_string=True) r.write_recipes() # Make sure RepoData singleton init From b143c5920d8175e0b3682bba98c6d5683c1ef7cb Mon Sep 17 00:00:00 2001 From: aliciaaevans Date: Fri, 22 Mar 2024 16:50:31 -0400 Subject: [PATCH 3/4] tests for osx-arm64 platform checking --- test/test_utils.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/test/test_utils.py b/test/test_utils.py index 63bd9318cc..a1a8fb3a6a 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -939,14 +939,18 @@ def test_native_platform_skipping(): # Don't skip linux-x86 for any recipes ["one", "linux", False], ["two", "linux", False], - # Skip recipe without linux aarch64 enabled on linux-aarch64 platform + ["three", "linux", False], + ["four", "linux", False], + # Skip recipes without linux aarch64 enable on linux-aarch64 platform ["one", "linux-aarch64", True], - # Don't skip recipe with linux aarch64 enabled on linux-aarch64 platform + ["three", "linux-aarch64", True], + # Don't skip recipes with linux aarch64 enable on linux-aarch64 platform ["two", "linux-aarch64", False], - # Skip recipe without osx-arm64 enabled on osx-arm64 platform + ["four", "linux-aarch64", False], ["one", "osx-arm64", True], - # Don't skip recipe with osx-arm64 enabled on osx-arm64 platform - ["two", "osx-arm64", False], + ["two", "osx-arm64", True], + ["three", "osx-arm64", False], + ["four", "osx-arm64", False], ] r = Recipes( """ @@ -956,6 +960,22 @@ def test_native_platform_skipping(): name: one version: "0.1" two: + meta.yaml: | + package: + name: one + version: "0.1" + extra: + additional-platforms: + - linux-aarch64 + three: + meta.yaml: | + package: + name: one + version: "0.1" + extra: + additional-platforms: + - osx-arm64 + four: meta.yaml: | package: name: one From 82cd7eb2bd16e933b78e90aef4de381c3a965a94 Mon Sep 17 00:00:00 2001 From: aliciaaevans Date: Fri, 22 Mar 2024 16:51:32 -0400 Subject: [PATCH 4/4] fix name --- test/test_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_utils.py b/test/test_utils.py index a1a8fb3a6a..12524ee3d8 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -962,7 +962,7 @@ def test_native_platform_skipping(): two: meta.yaml: | package: - name: one + name: two version: "0.1" extra: additional-platforms: @@ -970,7 +970,7 @@ def test_native_platform_skipping(): three: meta.yaml: | package: - name: one + name: three version: "0.1" extra: additional-platforms: @@ -978,7 +978,7 @@ def test_native_platform_skipping(): four: meta.yaml: | package: - name: one + name: four version: "0.1" extra: additional-platforms: