Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate noarch_python_build_age #5298

Merged
merged 3 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions conda_build/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from conda.base.context import context
from conda.utils import url_path

from .deprecations import deprecated
from .utils import (
get_build_folders,
get_conda_operation_locks,
Expand Down Expand Up @@ -52,7 +53,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 @@ -156,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,
):
rendered_metadata = {}
need_source_download = True
Expand All @@ -808,27 +808,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 @@ -26,7 +26,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 @@ -99,7 +98,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 @@ -111,7 +109,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
Loading