Skip to content

Commit cac8e1b

Browse files
authored
Merge pull request #1888 from h-vetinari/stdlib
2 parents aeed60c + 98fccae commit cac8e1b

4 files changed

Lines changed: 106 additions & 0 deletions

File tree

conda_smithy/configure_feedstock.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,8 @@ def _collapse_subpackage_variants(
509509
"macos_machine",
510510
"channel_sources",
511511
"channel_targets",
512+
"c_stdlib",
513+
"c_stdlib_version",
512514
"docker_image",
513515
"build_number_decrement",
514516
# The following keys are required for some of our aarch64 builds
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* Ensure new ``{{ stdlib("c") }}`` correctly populates CI config. (#1840 via #1888)
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

tests/conftest.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,51 @@ def py_recipe(config_yaml, request):
196196
)
197197

198198

199+
@pytest.fixture(scope="function")
200+
def stdlib_recipe(config_yaml, request):
201+
with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
202+
fh.write(
203+
"""
204+
package:
205+
name: stdlib-test
206+
version: 1.0.0
207+
requirements:
208+
build:
209+
- {{ compiler("c") }}
210+
- {{ stdlib("c") }}
211+
host:
212+
- zlib
213+
about:
214+
home: home
215+
"""
216+
)
217+
with open(
218+
os.path.join(config_yaml, "recipe", "stdlib_config.yaml"), "w"
219+
) as f:
220+
f.write(
221+
"""\
222+
c_stdlib:
223+
- sysroot # [linux]
224+
- macosx_deployment_target # [osx]
225+
- vs # [win]
226+
c_stdlib_version: # [unix]
227+
- 2.12 # [linux64]
228+
- 2.17 # [aarch64 or ppc64le]
229+
- 10.9 # [osx and x86_64]
230+
- 11.0 # [osx and arm64]
231+
"""
232+
)
233+
return RecipeConfigPair(
234+
str(config_yaml),
235+
_load_forge_config(
236+
config_yaml,
237+
exclusive_config_file=os.path.join(
238+
config_yaml, "recipe", "stdlib_config.yaml"
239+
),
240+
),
241+
)
242+
243+
199244
@pytest.fixture(scope="function")
200245
def upload_on_branch_recipe(config_yaml, request):
201246
with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:

tests/test_configure_feedstock.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import copy
22
import logging
33
import os
4+
import re
45
import textwrap
56

67
import pytest
@@ -210,6 +211,41 @@ def test_py_matrix_on_azure(py_recipe, jinja_env):
210211
assert len(os.listdir(matrix_dir)) == 6
211212

212213

214+
def test_stdlib_on_azure(stdlib_recipe, jinja_env):
215+
configure_feedstock.render_azure(
216+
jinja_env=jinja_env,
217+
forge_config=stdlib_recipe.config,
218+
forge_dir=stdlib_recipe.recipe,
219+
)
220+
# this configuration should be run
221+
assert stdlib_recipe.config["azure"]["enabled"]
222+
matrix_dir = os.path.join(stdlib_recipe.recipe, ".ci_support")
223+
assert os.path.isdir(matrix_dir)
224+
# find stdlib-config in generated yaml files (plus version, on unix)
225+
with open(os.path.join(matrix_dir, "linux_64_.yaml")) as f:
226+
linux_lines = f.readlines()
227+
linux_content = "".join(linux_lines)
228+
# multiline pattern to ensure we don't match other stuff accidentally
229+
assert bool(re.match(r"(?s).*c_stdlib:\s*- sysroot", linux_content))
230+
assert bool(
231+
re.match(r"(?s).*c_stdlib_version:\s*- ['\"]?2\.\d+", linux_content)
232+
)
233+
with open(os.path.join(matrix_dir, "osx_64_.yaml")) as f:
234+
osx_lines = f.readlines()
235+
osx_content = "".join(osx_lines)
236+
assert bool(
237+
re.match(r"(?s).*c_stdlib:\s*- macosx_deployment_target", osx_content)
238+
)
239+
assert bool(
240+
re.match(r"(?s).*c_stdlib_version:\s*- ['\"]?1\d\.\d+", osx_content)
241+
)
242+
with open(os.path.join(matrix_dir, "win_64_.yaml")) as f:
243+
win_lines = f.readlines()
244+
win_content = "".join(win_lines)
245+
assert bool(re.match(r"(?s).*c_stdlib:\s*- vs", win_content))
246+
# no stdlib-version expected on windows
247+
248+
213249
def test_upload_on_branch_azure(upload_on_branch_recipe, jinja_env):
214250
configure_feedstock.render_azure(
215251
jinja_env=jinja_env,

0 commit comments

Comments
 (0)