From 1c641ea6620d1c69831b59acea7ba141630881be Mon Sep 17 00:00:00 2001 From: jaimergp Date: Sat, 24 Feb 2024 13:32:17 +0100 Subject: [PATCH 1/4] check up-to-date with not broken versions only --- conda_smithy/configure_feedstock.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 74c6a2e3d..2730bfe8f 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -2188,17 +2188,17 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): return config -def get_most_recent_version(name): +def get_most_recent_version(name, only_not_broken=False): from conda_build.conda_interface import VersionOrder request = requests.get( "https://api.anaconda.org/package/conda-forge/" + name ) request.raise_for_status() - - pkg = max( - request.json()["files"], key=lambda x: VersionOrder(x["version"]) - ) + files = request.json()["files"] + if only_not_broken: + files = [f for f in files if "broken" not in f.get("labels", ())] + pkg = max(files, key=lambda x: VersionOrder(x['version'])) PackageRecord = namedtuple("PackageRecord", ["name", "version", "url"]) return PackageRecord(name, pkg["version"], "https:" + pkg["download_url"]) @@ -2207,7 +2207,7 @@ def get_most_recent_version(name): def check_version_uptodate(name, installed_version, error_on_warn): from conda_build.conda_interface import VersionOrder - most_recent_version = get_most_recent_version(name).version + most_recent_version = get_most_recent_version(name, only_not_broken=True).version if installed_version is None: msg = "{} is not installed in conda-smithy's environment.".format(name) elif VersionOrder(installed_version) < VersionOrder(most_recent_version): From 268aa8df41302b8e09ba24a1e805387498056da5 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Sat, 24 Feb 2024 13:33:46 +0100 Subject: [PATCH 2/4] add news --- news/1849-not-broken-up-to-date.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 news/1849-not-broken-up-to-date.rst diff --git a/news/1849-not-broken-up-to-date.rst b/news/1849-not-broken-up-to-date.rst new file mode 100644 index 000000000..5ed56530f --- /dev/null +++ b/news/1849-not-broken-up-to-date.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* Do not consider broken releases when checking if local version is up to date. (#1848 via #1849) + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* From a1945d3fef9d6b9cf4ab04a29558c4595d49d23b Mon Sep 17 00:00:00 2001 From: jaimergp Date: Sat, 24 Feb 2024 13:36:08 +0100 Subject: [PATCH 3/4] pre-commit --- conda_smithy/configure_feedstock.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 2730bfe8f..475a33f4a 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -2198,7 +2198,7 @@ def get_most_recent_version(name, only_not_broken=False): files = request.json()["files"] if only_not_broken: files = [f for f in files if "broken" not in f.get("labels", ())] - pkg = max(files, key=lambda x: VersionOrder(x['version'])) + pkg = max(files, key=lambda x: VersionOrder(x["version"])) PackageRecord = namedtuple("PackageRecord", ["name", "version", "url"]) return PackageRecord(name, pkg["version"], "https:" + pkg["download_url"]) @@ -2207,7 +2207,9 @@ def get_most_recent_version(name, only_not_broken=False): def check_version_uptodate(name, installed_version, error_on_warn): from conda_build.conda_interface import VersionOrder - most_recent_version = get_most_recent_version(name, only_not_broken=True).version + most_recent_version = get_most_recent_version( + name, only_not_broken=True + ).version if installed_version is None: msg = "{} is not installed in conda-smithy's environment.".format(name) elif VersionOrder(installed_version) < VersionOrder(most_recent_version): From d68a6851b4adc5e12a2daa55c16b853412bce332 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Sun, 25 Feb 2024 17:51:29 +0100 Subject: [PATCH 4/4] do not include broken by default --- conda_smithy/configure_feedstock.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/conda_smithy/configure_feedstock.py b/conda_smithy/configure_feedstock.py index 475a33f4a..92fbeb727 100644 --- a/conda_smithy/configure_feedstock.py +++ b/conda_smithy/configure_feedstock.py @@ -2188,7 +2188,7 @@ def _load_forge_config(forge_dir, exclusive_config_file, forge_yml=None): return config -def get_most_recent_version(name, only_not_broken=False): +def get_most_recent_version(name, include_broken=False): from conda_build.conda_interface import VersionOrder request = requests.get( @@ -2196,7 +2196,7 @@ def get_most_recent_version(name, only_not_broken=False): ) request.raise_for_status() files = request.json()["files"] - if only_not_broken: + if not include_broken: files = [f for f in files if "broken" not in f.get("labels", ())] pkg = max(files, key=lambda x: VersionOrder(x["version"])) @@ -2207,9 +2207,7 @@ def get_most_recent_version(name, only_not_broken=False): def check_version_uptodate(name, installed_version, error_on_warn): from conda_build.conda_interface import VersionOrder - most_recent_version = get_most_recent_version( - name, only_not_broken=True - ).version + most_recent_version = get_most_recent_version(name).version if installed_version is None: msg = "{} is not installed in conda-smithy's environment.".format(name) elif VersionOrder(installed_version) < VersionOrder(most_recent_version):