Skip to content

Commit

Permalink
Merge pull request #1888 from h-vetinari/stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr authored Mar 23, 2024
2 parents aeed60c + 98fccae commit cac8e1b
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
2 changes: 2 additions & 0 deletions conda_smithy/configure_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@ def _collapse_subpackage_variants(
"macos_machine",
"channel_sources",
"channel_targets",
"c_stdlib",
"c_stdlib_version",
"docker_image",
"build_number_decrement",
# The following keys are required for some of our aarch64 builds
Expand Down
23 changes: 23 additions & 0 deletions news/1888-ensure-stdlib-renders-correctly.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* Ensure new ``{{ stdlib("c") }}`` correctly populates CI config. (#1840 via #1888)

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
45 changes: 45 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,51 @@ def py_recipe(config_yaml, request):
)


@pytest.fixture(scope="function")
def stdlib_recipe(config_yaml, request):
with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
fh.write(
"""
package:
name: stdlib-test
version: 1.0.0
requirements:
build:
- {{ compiler("c") }}
- {{ stdlib("c") }}
host:
- zlib
about:
home: home
"""
)
with open(
os.path.join(config_yaml, "recipe", "stdlib_config.yaml"), "w"
) as f:
f.write(
"""\
c_stdlib:
- sysroot # [linux]
- macosx_deployment_target # [osx]
- vs # [win]
c_stdlib_version: # [unix]
- 2.12 # [linux64]
- 2.17 # [aarch64 or ppc64le]
- 10.9 # [osx and x86_64]
- 11.0 # [osx and arm64]
"""
)
return RecipeConfigPair(
str(config_yaml),
_load_forge_config(
config_yaml,
exclusive_config_file=os.path.join(
config_yaml, "recipe", "stdlib_config.yaml"
),
),
)


@pytest.fixture(scope="function")
def upload_on_branch_recipe(config_yaml, request):
with open(os.path.join(config_yaml, "recipe", "meta.yaml"), "w") as fh:
Expand Down
36 changes: 36 additions & 0 deletions tests/test_configure_feedstock.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import logging
import os
import re
import textwrap

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


def test_stdlib_on_azure(stdlib_recipe, jinja_env):
configure_feedstock.render_azure(
jinja_env=jinja_env,
forge_config=stdlib_recipe.config,
forge_dir=stdlib_recipe.recipe,
)
# this configuration should be run
assert stdlib_recipe.config["azure"]["enabled"]
matrix_dir = os.path.join(stdlib_recipe.recipe, ".ci_support")
assert os.path.isdir(matrix_dir)
# find stdlib-config in generated yaml files (plus version, on unix)
with open(os.path.join(matrix_dir, "linux_64_.yaml")) as f:
linux_lines = f.readlines()
linux_content = "".join(linux_lines)
# multiline pattern to ensure we don't match other stuff accidentally
assert bool(re.match(r"(?s).*c_stdlib:\s*- sysroot", linux_content))
assert bool(
re.match(r"(?s).*c_stdlib_version:\s*- ['\"]?2\.\d+", linux_content)
)
with open(os.path.join(matrix_dir, "osx_64_.yaml")) as f:
osx_lines = f.readlines()
osx_content = "".join(osx_lines)
assert bool(
re.match(r"(?s).*c_stdlib:\s*- macosx_deployment_target", osx_content)
)
assert bool(
re.match(r"(?s).*c_stdlib_version:\s*- ['\"]?1\d\.\d+", osx_content)
)
with open(os.path.join(matrix_dir, "win_64_.yaml")) as f:
win_lines = f.readlines()
win_content = "".join(win_lines)
assert bool(re.match(r"(?s).*c_stdlib:\s*- vs", win_content))
# no stdlib-version expected on windows


def test_upload_on_branch_azure(upload_on_branch_recipe, jinja_env):
configure_feedstock.render_azure(
jinja_env=jinja_env,
Expand Down

0 comments on commit cac8e1b

Please sign in to comment.