Skip to content

Commit

Permalink
Deprecate noarch_python_build_age (#5298)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard authored Apr 19, 2024
1 parent 9870f9b commit 5d8444b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 34 deletions.
8 changes: 1 addition & 7 deletions conda_build/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def set_invocation_time():
_src_cache_root_default = None
error_overlinking_default = "false"
error_overdepending_default = "false"
noarch_python_build_age_default = 0
deprecated.constant("24.5", "24.7", "noarch_python_build_age_default", 0)
enable_static_default = "false"
no_rewrite_stdout_env_default = "false"
ignore_verify_codes_default = []
Expand Down Expand Up @@ -157,12 +157,6 @@ def _get_default_settings():
).lower()
== "true",
),
Setting(
"noarch_python_build_age",
context.conda_build.get(
"noarch_python_build_age", noarch_python_build_age_default
),
),
Setting(
"enable_static",
context.conda_build.get("enable_static", enable_static_default).lower()
Expand Down
34 changes: 10 additions & 24 deletions conda_build/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,11 +795,11 @@ def reparse(metadata):


def distribute_variants(
metadata,
metadata: MetaData,
variants,
permit_unsatisfiable_variants=False,
allow_no_other_outputs=False,
bypass_env_check=False,
permit_unsatisfiable_variants: bool = False,
allow_no_other_outputs: bool = False,
bypass_env_check: bool = False,
) -> list[MetaDataTuple]:
rendered_metadata: dict[
tuple[str, str, tuple[tuple[str, str], ...]], MetaDataTuple
Expand All @@ -810,27 +810,13 @@ def distribute_variants(
# which python version we prefer. `python_age` can use used to tweak which
# python gets used here.
if metadata.noarch or metadata.noarch_python:
age = int(
metadata.get_value(
"build/noarch_python_build_age", metadata.config.noarch_python_build_age
)
)
versions = []
for variant in variants:
if "python" in variant:
vo = variant["python"]
if vo not in versions:
versions.append(vo)
version_indices = sorted(
range(len(versions)), key=lambda k: VersionOrder(versions[k].split(" ")[0])
)
if age < 0:
age = 0
elif age > len(versions) - 1:
age = len(versions) - 1
build_ver = versions[version_indices[len(versions) - 1 - age]]
# filter variants by the newest Python version
version = sorted(
{version for variant in variants if (version := variant.get("python"))},
key=lambda key: VersionOrder(key.split(" ")[0]),
)[-1]
variants = filter_by_key_value(
variants, "python", build_ver, "noarch_python_reduction"
variants, "python", version, "noarch_python_reduction"
)

# store these for reference later
Expand Down
3 changes: 0 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
filename_hashing_default,
ignore_verify_codes_default,
no_rewrite_stdout_env_default,
noarch_python_build_age_default,
)
from conda_build.metadata import MetaData
from conda_build.utils import check_call_env, copy_into, prepend_bin_path
Expand Down Expand Up @@ -100,7 +99,6 @@ def boolify(v):
_src_cache_root=_src_cache_root_default,
error_overlinking=boolify(error_overlinking_default),
error_overdepending=boolify(error_overdepending_default),
noarch_python_build_age=noarch_python_build_age_default,
enable_static=boolify(enable_static_default),
no_rewrite_stdout_env=boolify(no_rewrite_stdout_env_default),
ignore_verify_codes=ignore_verify_codes_default,
Expand All @@ -112,7 +110,6 @@ def boolify(v):
assert result.no_rewrite_stdout_env is False
assert result._src_cache_root is None
assert result.src_cache_root == testing_workdir
assert result.noarch_python_build_age == 0
return result


Expand Down

0 comments on commit 5d8444b

Please sign in to comment.