Skip to content

Commit ef3e5b7

Browse files
committed
make more tests pass
1 parent 9919a63 commit ef3e5b7

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

conda_forge_tick/feedstock_parser.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import zipfile
99
from collections import defaultdict
1010
from pathlib import Path
11-
from typing import Optional, Set, Union, Any
11+
from typing import Any, Optional, Set, Union
1212

1313
import requests
1414
import yaml
@@ -108,10 +108,14 @@ def _get_requirements(
108108
for output in outputs_:
109109
if schema_version == 0:
110110
if output.get("name") in outputs_to_keep:
111-
reqs |= _parse_requirements(output.get("requirements", {}) or {}, **kw)
111+
reqs |= _parse_requirements(
112+
output.get("requirements", {}) or {}, **kw
113+
)
112114
elif schema_version == 1:
113115
if output.get("package", {}).get("name") in outputs_to_keep:
114-
reqs |= _parse_requirements(output.get("requirements", {}) or {}, **kw)
116+
reqs |= _parse_requirements(
117+
output.get("requirements", {}) or {}, **kw
118+
)
115119
else:
116120
raise ValueError(f"Unknown schema version {schema_version}")
117121
else:
@@ -142,13 +146,13 @@ def _parse_requirements(
142146
reqlist = _build + _host + _run
143147

144148
# remove any pin expressions / dictionaries in the v1 schema
145-
print("\n\n\nSCHEMA VERSION", schema_version)
146149
if schema_version == 1:
147150
reqlist = [req for req in reqlist if not isinstance(req, dict)]
148151

149152
packages = (PIN_SEP_PAT.split(x)[0].lower() for x in reqlist if x is not None)
150153
return {typing.cast("PackageName", pkg) for pkg in packages}
151154

155+
152156
def _filter_v1_pins(reqs: list[str | dict[str, Any]]) -> list[str]:
153157
res = []
154158
for el in reqs:
@@ -164,7 +168,6 @@ def _filter_v1_pins(reqs: list[str | dict[str, Any]]) -> list[str]:
164168

165169

166170
def _extract_requirements(meta_yaml, outputs_to_keep=None, schema_version=0):
167-
print("EXTRACT REQUIREMENTS SCHEMA VERSION", schema_version)
168171
strong_exports = False
169172
requirements_dict = defaultdict(set)
170173

@@ -188,17 +191,14 @@ def _extract_requirements(meta_yaml, outputs_to_keep=None, schema_version=0):
188191
requirements_dict["run"].update(set(req))
189192
continue
190193
for section in ["build", "host", "run"]:
191-
print(section)
192-
print(requirements_dict[section])
193-
print(req.get(section, []))
194194
requirements_dict[section].update(
195195
list(as_iterable(_filter_v1_pins(req.get(section, []) or []))),
196196
)
197197

198198
test: "TestTypedDict" = block.get("test", {}) or {}
199199
requirements_dict["test"].update(test.get("requirements", []) or [])
200200
requirements_dict["test"].update(test.get("requires", []) or [])
201-
201+
# TODO improve code (wolf)
202202
if "tests" in block:
203203
for test in block.get("tests", []):
204204
# only script tests have requirements

conda_forge_tick/update_recipe/version.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,9 @@ def _render_jinja2(tmpl, context):
141141
def split_filter(value, sep):
142142
return value.split(sep)
143143

144-
filters = {"split": split_filter}
145-
filters["split"] = split_filter
144+
env.filters["split"] = split_filter
146145

147-
return (
148-
env
149-
.from_string(tmpl)
150-
.render(**context)
151-
)
146+
return env.from_string(tmpl).render(**context)
152147

153148

154149
def _try_pypi_api(url_tmpl: str, context: MutableMapping, hash_type: str, cmeta: Any):

tests/test_v1_yaml/version_libssh.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ requirements:
2828
- zlib
2929
- krb5
3030
run_exports:
31-
# We pin to a minor version due to an incompatibility
31+
# We pin to a minor version due to an incompatibility
3232
# between 0.8 and 0.10
3333
# https://abi-laboratory.pro/index.php?view=timeline&l=libssh
3434
- ${{ pin_subpackage('libssh', upper_bound='x.x') }}

tests/test_v1_yaml/version_libssh_correct.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ schema_version: 1
22

33
context:
44
name: libssh
5-
version: 0.11.1
5+
version: "0.11.1"
66

77
package:
88
name: ${{ name|lower }}
@@ -28,7 +28,7 @@ requirements:
2828
- zlib
2929
- krb5
3030
run_exports:
31-
# We pin to a minor version due to an incompatibility
31+
# We pin to a minor version due to an incompatibility
3232
# between 0.8 and 0.10
3333
# https://abi-laboratory.pro/index.php?view=timeline&l=libssh
3434
- ${{ pin_subpackage('libssh', upper_bound='x.x') }}

0 commit comments

Comments
 (0)