Skip to content

Commit

Permalink
Revert non-24.11.x changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Nov 26, 2024
1 parent 18edc99 commit 8f3f22c
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 165 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check CLA
uses: conda/actions/check-cla@6e72e0db87e72f0020e493aeb02f864363bd9258 # v24.11.1
uses: conda/actions/check-cla@15f883f14f4232f83658e3609c3316d58905138f # v24.8.0
with:
# [required]
# A token with ability to comment, label, and modify the commit status
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
days-before-issue-stale: 90
days-before-issue-close: 21
steps:
- uses: conda/actions/read-yaml@6e72e0db87e72f0020e493aeb02f864363bd9258 # v24.11.1
- uses: conda/actions/read-yaml@15f883f14f4232f83658e3609c3316d58905138f # v24.8.0
id: read_yaml
with:
path: https://raw.githubusercontent.com/conda/infra/main/.github/messages.yml
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ jobs:
git config --global user.name 'Conda Bot'
git config --global user.email '[email protected]'
- uses: conda/actions/combine-durations@6e72e0db87e72f0020e493aeb02f864363bd9258 # v24.11.1
- uses: conda/actions/combine-durations@15f883f14f4232f83658e3609c3316d58905138f # v24.8.0
id: durations
continue-on-error: true

- uses: conda/actions/template-files@6e72e0db87e72f0020e493aeb02f864363bd9258 # v24.11.1
- uses: conda/actions/template-files@15f883f14f4232f83658e3609c3316d58905138f # v24.8.0
id: templates
continue-on-error: true

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repos:
# auto format Python codes within docstrings
- id: blacken-docs
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.4
rev: v0.7.3
hooks:
# lint & attempt to correct failures (e.g. pyupgrade)
- id: ruff
Expand Down
27 changes: 7 additions & 20 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1597,34 +1597,21 @@ def ms_depends(self, typ="run"):
try:
ms = MatchSpec(spec)
except AssertionError:
if len(self.undefined_jinja_vars) == 0:
raise RuntimeError(f"Invalid package specification: {spec!r}")
else:
continue
raise RuntimeError(f"Invalid package specification: {spec!r}")
except (AttributeError, ValueError) as e:
if len(self.undefined_jinja_vars) == 0:
raise RuntimeError(
"Received dictionary as spec. Note that pip requirements are "
"not supported in conda-build meta.yaml. Error message: "
+ str(e)
)
else:
continue

raise RuntimeError(
"Received dictionary as spec. Note that pip requirements are "
"not supported in conda-build meta.yaml. Error message: " + str(e)
)
if ms.name == self.name() and not (
typ == "build" and self.config.host_subdir != self.config.build_subdir
):
raise RuntimeError(f"{self.name()} cannot depend on itself")

# TODO: IDK what this does since AFAIK the inner continue applies only
# to the inner loop
for name, ver in name_ver_list:
if ms.name == name:
if self.noarch:
continue

# TODO: the validation here appears to be a waste of time since MatchSpec
# appears to validate?
for c in "=!@#$%^&*:;\"'\\|<>?/":
if c in ms.name:
sys.exit(
Expand Down Expand Up @@ -2592,7 +2579,7 @@ def get_output_metadata_set(
ref_metadata.parse_until_resolved(
allow_no_other_outputs=True, bypass_env_check=True
)
except (SystemExit, CondaBuildUserError):
except SystemExit:
pass
outputs = get_output_dicts_from_metadata(ref_metadata)

Expand Down Expand Up @@ -2624,7 +2611,7 @@ def get_output_metadata_set(
ref_metadata.other_outputs = out_metadata.other_outputs = (
all_output_metadata
)
except (SystemExit, CondaBuildUserError):
except SystemExit:
if not permit_undefined_jinja:
raise
output_tuples = []
Expand Down
4 changes: 2 additions & 2 deletions conda_build/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

from . import environ, exceptions, source, utils
from .config import CondaPkgFormat
from .exceptions import CondaBuildUserError, DependencyNeedsBuildingError
from .exceptions import DependencyNeedsBuildingError
from .index import get_build_index
from .metadata import MetaData, MetaDataTuple, combine_top_level_metadata_with_output
from .utils import (
Expand Down Expand Up @@ -894,7 +894,7 @@ def distribute_variants(
allow_no_other_outputs=allow_no_other_outputs,
bypass_env_check=bypass_env_check,
)
except (SystemExit, CondaBuildUserError):
except SystemExit:
pass
need_source_download = not mv.needs_source_for_render or not mv.source_provided

Expand Down
20 changes: 0 additions & 20 deletions news/5538-sysexit-vs-cdusererror

This file was deleted.

19 changes: 0 additions & 19 deletions news/5555-skip-bad-specs-while-still-parsing.rst

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ def test_conda_build_script_errors_without_conda_info_handlers(tmp_path, recipe,

def test_api_build_inject_jinja2_vars_on_first_pass(testing_config):
recipe_dir = os.path.join(metadata_dir, "_inject_jinja2_vars_on_first_pass")
with pytest.raises((RuntimeError, CondaBuildUserError)):
with pytest.raises(RuntimeError):
api.build(recipe_dir, config=testing_config)

testing_config.variant = {"python_min": "3.12"}
Expand Down
45 changes: 0 additions & 45 deletions tests/test_api_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import os
import re
import textwrap
from itertools import count, islice

import pytest
Expand All @@ -16,7 +15,6 @@
from conda.common.compat import on_win

from conda_build import api, render
from conda_build.exceptions import CondaBuildUserError
from conda_build.variants import validate_spec

from .utils import metadata_dir, variants_dir
Expand Down Expand Up @@ -343,46 +341,3 @@ def create_variants():
recipe, config=testing_config, channels=[], variants=create_variants()
)
assert len(metadata_tuples) == 11 - 3 # omits libarrow-all, pyarrow, pyarrow-tests


def test_api_render_missing_jinja2(testing_config, testing_workdir):
with open(os.path.join(testing_workdir, "meta.yaml"), "w") as f:
f.write(
textwrap.dedent(
"""
package:
name: blah-{{ foo }}
version: 0.1
build:
number: 0
requirements:
host:
- python {{ python_min }}
run:
- python
"""
)
)

meta = api.render(
testing_workdir,
finalize=False,
bypass_env_check=True,
trim_skip=False,
)
assert meta is not None
assert any("python" in val for val in meta[0][0].get_value("requirements/host"))
assert not any(
"{{ python_min }}" in val for val in meta[0][0].get_value("requirements/run")
)
assert meta[0][0].get_value("package/name") == "blah-"

with pytest.raises(CondaBuildUserError):
api.render(
testing_workdir,
finalize=True,
bypass_env_check=True,
trim_skip=False,
)
53 changes: 0 additions & 53 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,56 +655,3 @@ def test_parse_until_resolved_skip_avoids_undefined_jinja(
pytest.fail(
"Undefined variable caused error, even though this build is skipped"
)


@pytest.mark.parametrize("have_variant", [True, False])
def test_parse_until_resolved_missing_jinja_in_spec(
testing_metadata: MetaData,
tmp_path: Path,
have_variant: bool,
) -> None:
(recipe := tmp_path / (name := "meta.yaml")).write_text(
"""
package:
name: dummy
version: 1.0.0
build:
noarch: python
number: 0
requirements:
host:
- python ={{ python_min }}
run:
- python >={{ python_min }}
"""
)
(tmp_path / "conda_build_config.yaml").write_text(
"""
python_min:
- 3.6
"""
)
testing_metadata._meta_path = recipe
testing_metadata._meta_name = name
if have_variant:
testing_metadata.config.variant = {"python_min": "3.6"}
else:
delattr(testing_metadata.config, "variant")
delattr(testing_metadata.config, "variant_config_files")
delattr(testing_metadata.config, "variants")

try:
testing_metadata.parse_until_resolved()
if not have_variant:
pytest.fail("Undefined variable did NOT cause spec parsing error!")
else:
print("parsed OK!")
except (Exception, SystemExit):
if have_variant:
pytest.fail(
"Undefined variable caused spec parsing error even if we have the variant!"
)
else:
print("did not parse OK!")

0 comments on commit 8f3f22c

Please sign in to comment.