Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 0 additions & 3 deletions conda_forge_tick/make_migrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
)
from conda_forge_tick.migrators import (
ArchRebuild,
Build2HostMigrator,
CondaForgeYAMLCleanup,
CrossCompilationForARMAndPower,
CrossPythonMigrator,
Expand Down Expand Up @@ -111,7 +110,6 @@
LicenseMigrator,
CondaForgeYAMLCleanup,
ExtraJinja2KeysCleanup,
Build2HostMigrator,
NoCondaInspectMigrator,
MPIPinRunAsBuildCleanup,
PyPIOrgMigrator,
Expand Down Expand Up @@ -284,7 +282,6 @@ def add_arch_migrate(migrators: MutableSequence[Migrator], gx: nx.DiGraph) -> No
pr_limit=PR_LIMIT,
name="arm osx addition",
piggy_back_migrations=[
Build2HostMigrator(),
UpdateConfigSubGuessMigrator(),
CondaForgeYAMLCleanup(),
UpdateCMakeArgsMigrator(),
Expand Down
11 changes: 7 additions & 4 deletions conda_forge_tick/migrators/cross_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,13 +240,16 @@


class Build2HostMigrator(MiniMigrator):
allowed_schema_versions = {0, 1}
post_migration = False

def filter(self, attrs: "AttrsTypedDict", not_bad_str_start: str = "") -> bool:
if super().filter(attrs, not_bad_str_start):
return True

Check warning on line 248 in conda_forge_tick/migrators/cross_compile.py

View check run for this annotation

Codecov / codecov/patch

conda_forge_tick/migrators/cross_compile.py#L248

Added line #L248 was not covered by tests

build_reqs = attrs.get("requirements", {}).get("build", set())
host_reqs = attrs.get("requirements", {}).get("host", set())
run_reqs = attrs.get("requirements", {}).get("run", set())
skip_schema = skip_migrator_due_to_schema(attrs, self.allowed_schema_versions)
if (
len(attrs.get("outputs_names", [])) <= 1
and "python" in build_reqs
Expand All @@ -261,15 +264,15 @@
"cxx_compiler_stub",
]
)
and not skip_schema
):
return False
else:
return True

def migrate(self, recipe_dir: str, attrs: "AttrsTypedDict", **kwargs: Any) -> None:
with pushd(recipe_dir):
with open("meta.yaml") as fp:
recipe_file = next(filter(os.path.exists, ("recipe.yaml", "meta.yaml")))
with open(recipe_file) as fp:
meta_yaml = fp.readlines()

new_lines = []
Expand All @@ -283,7 +286,7 @@
in_req = False
new_lines.append(line)

with open("meta.yaml", "w") as f:
with open(recipe_file, "w") as f:
f.write("".join(new_lines))


Expand Down
41 changes: 31 additions & 10 deletions tests/test_cross_compile.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path

import pytest
from flaky import flaky
from test_migrators import run_test_migration

Expand All @@ -14,7 +15,11 @@
Version,
)

YAML_PATH = Path(__file__).parent / "test_yaml/cross_compile"
YAML_PATHS = [
Path(__file__).parent / "test_yaml/cross_compile",
Path(__file__).parent / "test_v1_yaml/cross_compile",
]
YAML_PATH = YAML_PATHS[0]

config_migrator = UpdateConfigSubGuessMigrator()
guard_testing_migrator = GuardTestingMigrator()
Expand Down Expand Up @@ -220,12 +225,15 @@ def test_cross_python_no_build(tmp_path):
)


@pytest.mark.parametrize("recipe_version", [0, 1])
@flaky
def test_build2host(tmp_path):
def test_build2host(recipe_version, tmp_path):
run_test_migration(
m=version_migrator_b2h,
inp=YAML_PATH.joinpath("python_recipe_b2h.yaml").read_text(),
output=YAML_PATH.joinpath("python_recipe_b2h_correct.yaml").read_text(),
inp=YAML_PATHS[recipe_version].joinpath("python_recipe_b2h.yaml").read_text(),
output=YAML_PATHS[recipe_version]
.joinpath("python_recipe_b2h_correct.yaml")
.read_text(),
prb="Dependencies have been updated if changed",
kwargs={"new_version": "1.19.1"},
mr_out={
Expand All @@ -234,15 +242,21 @@ def test_build2host(tmp_path):
"version": "1.19.1",
},
tmp_path=tmp_path,
recipe_version=recipe_version,
)


@pytest.mark.parametrize("recipe_version", [0, 1])
@flaky
def test_build2host_buildok(tmp_path):
def test_build2host_buildok(recipe_version, tmp_path):
run_test_migration(
m=version_migrator_b2h,
inp=YAML_PATH.joinpath("python_recipe_b2h_buildok.yaml").read_text(),
output=YAML_PATH.joinpath("python_recipe_b2h_buildok_correct.yaml").read_text(),
inp=YAML_PATHS[recipe_version]
.joinpath("python_recipe_b2h_buildok.yaml")
.read_text(),
output=YAML_PATHS[recipe_version]
.joinpath("python_recipe_b2h_buildok_correct.yaml")
.read_text(),
prb="Dependencies have been updated if changed",
kwargs={"new_version": "1.19.1"},
mr_out={
Expand All @@ -251,15 +265,21 @@ def test_build2host_buildok(tmp_path):
"version": "1.19.1",
},
tmp_path=tmp_path,
recipe_version=recipe_version,
)


@pytest.mark.parametrize("recipe_version", [0, 1])
@flaky
def test_build2host_bhskip(tmp_path):
def test_build2host_bhskip(recipe_version, tmp_path):
run_test_migration(
m=version_migrator_b2h,
inp=YAML_PATH.joinpath("python_recipe_b2h_bhskip.yaml").read_text(),
output=YAML_PATH.joinpath("python_recipe_b2h_bhskip_correct.yaml").read_text(),
inp=YAML_PATHS[recipe_version]
.joinpath("python_recipe_b2h_bhskip.yaml")
.read_text(),
output=YAML_PATHS[recipe_version]
.joinpath("python_recipe_b2h_bhskip_correct.yaml")
.read_text(),
prb="Dependencies have been updated if changed",
kwargs={"new_version": "1.19.1"},
mr_out={
Expand All @@ -268,6 +288,7 @@ def test_build2host_bhskip(tmp_path):
"version": "1.19.1",
},
tmp_path=tmp_path,
recipe_version=recipe_version,
)


Expand Down
62 changes: 62 additions & 0 deletions tests/test_v1_yaml/cross_compile/python_recipe_b2h.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
schema_version: 1

context:
version: 1.19.0

package:
name: numpy
version: ${{ version }}

source:
url: https://github.com/numpy/numpy/releases/download/v${{ version }}/numpy-${{ version }}.tar.gz
sha256: 153cf8b0176e57a611931981acfe093d2f7fef623b48f91176efa199798a6b90

build:
number: 0
python:
entry_points:
- if: win
then: f2py = numpy.f2py.f2py2e:main

requirements:
build:
- python
- pip
- cython
- libblas
- libcblas
- liblapack
run:
- python

tests:
- python:
imports:
- numpy
- numpy.linalg.lapack_lite
- requirements:
run:
- pytest
- hypothesis
script:
- f2py -h
- if: unix
then: export OPENBLAS_NUM_THREADS=1
- if: win
then: set OPENBLAS_NUM_THREADS=1

about:
license: BSD-3-Clause
license_file: LICENSE.txt
summary: Array processing for numbers, strings, records, and objects.
homepage: http://numpy.scipy.org/
repository: https://github.com/numpy/numpy
documentation: https://docs.scipy.org/doc/numpy/reference/

extra:
recipe-maintainers:
- jakirkham
- msarahan
- pelson
- rgommers
- ocefpaf
58 changes: 58 additions & 0 deletions tests/test_v1_yaml/cross_compile/python_recipe_b2h_bhskip.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
schema_version: 1

context:
version: 1.19.0

package:
name: numpy
version: ${{ version }}

source:
url: https://github.com/numpy/numpy/releases/download/v${{ version }}/numpy-${{ version }}.tar.gz
sha256: 153cf8b0176e57a611931981acfe093d2f7fef623b48f91176efa199798a6b90

build:
number: 0
python:
entry_points:
- if: win
then: f2py = numpy.f2py.f2py2e:main

requirements:
build:
- ${{ compiler('c') }}
host:
run:
- python

tests:
- python:
imports:
- numpy
- numpy.linalg.lapack_lite
- requirements:
run:
- pytest
- hypothesis
script:
- f2py -h
- if: unix
then: export OPENBLAS_NUM_THREADS=1
- if: win
then: set OPENBLAS_NUM_THREADS=1

about:
license: BSD-3-Clause
license_file: LICENSE.txt
summary: Array processing for numbers, strings, records, and objects.
homepage: http://numpy.scipy.org/
repository: https://github.com/numpy/numpy
documentation: https://docs.scipy.org/doc/numpy/reference/

extra:
recipe-maintainers:
- jakirkham
- msarahan
- pelson
- rgommers
- ocefpaf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
schema_version: 1

context:
version: "1.19.1"

package:
name: numpy
version: ${{ version }}

source:
url: https://github.com/numpy/numpy/releases/download/v${{ version }}/numpy-${{ version }}.tar.gz
sha256: 1396e6c3d20cbfc119195303b0272e749610b7042cc498be4134f013e9a3215c

build:
number: 0
python:
entry_points:
- if: win
then: f2py = numpy.f2py.f2py2e:main

requirements:
build:
- ${{ compiler('c') }}
host:
run:
- python

tests:
- python:
imports:
- numpy
- numpy.linalg.lapack_lite
- requirements:
run:
- pytest
- hypothesis
script:
- f2py -h
- if: unix
then: export OPENBLAS_NUM_THREADS=1
- if: win
then: set OPENBLAS_NUM_THREADS=1

about:
license: BSD-3-Clause
license_file: LICENSE.txt
summary: Array processing for numbers, strings, records, and objects.
homepage: http://numpy.scipy.org/
repository: https://github.com/numpy/numpy
documentation: https://docs.scipy.org/doc/numpy/reference/

extra:
recipe-maintainers:
- jakirkham
- msarahan
- pelson
- rgommers
- ocefpaf
Loading