Skip to content

Commit eab3785

Browse files
committed
fix: strip special keys from variants before feeding to conda_build
1 parent 2dfdb3e commit eab3785

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

conda_forge_tick/provide_source_code.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import glob
22
import logging
33
import os
4+
import pprint
45
import shutil
56
import sys
67
import tempfile
@@ -16,6 +17,14 @@
1617

1718
logger = logging.getLogger(__name__)
1819

20+
CONDA_BUILD_SPECIAL_KEYS = (
21+
"pin_run_as_build",
22+
"ignore_version",
23+
"ignore_build_only_deps",
24+
"extend_keys",
25+
"zip_keys",
26+
)
27+
1928

2029
@contextmanager
2130
def provide_source_code(recipe_dir, use_container=None):
@@ -144,6 +153,13 @@ def _print_out():
144153
]
145154
variants = get_package_variants(recipe_dir, config=config)[0]
146155
variants = list_of_dicts_to_dict_of_lists([variants])
156+
for key in CONDA_BUILD_SPECIAL_KEYS:
157+
if key in variants:
158+
del variants[key]
159+
logger.debug(
160+
"conda build src input variants:\n%s", pprint.pformat(variants)
161+
)
162+
147163
md = render(
148164
recipe_dir,
149165
finalize=False,
@@ -158,6 +174,7 @@ def _print_out():
158174
yield provide(md)
159175
except (SystemExit, Exception) as e:
160176
_print_out()
177+
logger.error("Error in getting conda build src!", exc_info=e)
161178
raise RuntimeError("conda build src exception: " + str(e))
162179

163180
_print_out()

tests/test_container_tasks.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
from conda_forge_tick.migration_runner import run_migration_containerized
3232
from conda_forge_tick.migrators import MigrationYaml, Version
3333
from conda_forge_tick.os_utils import pushd
34-
from conda_forge_tick.provide_source_code import provide_source_code_containerized
34+
from conda_forge_tick.provide_source_code import (
35+
provide_source_code_containerized,
36+
provide_source_code_local,
37+
)
3538
from conda_forge_tick.rerender_feedstock import rerender_feedstock
3639
from conda_forge_tick.solver_checks import is_recipe_solvable
3740
from conda_forge_tick.update_recipe.version import update_version_feedstock_dir
@@ -776,3 +779,23 @@ def test_container_tasks_update_version_feedstock_dir():
776779
output = fp.read()
777780

778781
assert actual_output == output
782+
783+
784+
@flaky
785+
def test_container_tasks_provide_source_code_local(use_containers):
786+
with (
787+
tempfile.TemporaryDirectory() as tmpdir,
788+
pushd(tmpdir),
789+
):
790+
subprocess.run(
791+
[
792+
"git",
793+
"clone",
794+
"https://github.com/conda-forge/git-remote-s3-feedstock.git",
795+
]
796+
)
797+
798+
with provide_source_code_local("git-remote-s3-feedstock/recipe") as source_dir:
799+
assert os.path.exists(source_dir)
800+
assert os.path.isdir(source_dir)
801+
assert "pyproject.toml" in os.listdir(source_dir)

0 commit comments

Comments
 (0)