From 46be3ad091f00429d3121a2d09ad689dd9e0a802 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Thu, 24 Mar 2022 14:14:18 +0100 Subject: [PATCH 01/40] add menuinst JSON file validation --- conda_build/post.py | 25 ++++++++++++++++++ .../metadata/menu_json_validation/menu.json | 24 +++++++++++++++++ .../metadata/menu_json_validation/meta.yaml | 10 +++++++ tests/test_post.py | 26 +++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 tests/test-recipes/metadata/menu_json_validation/menu.json create mode 100644 tests/test-recipes/metadata/menu_json_validation/meta.yaml diff --git a/conda_build/post.py b/conda_build/post.py index 7f54b6fde1..9bc3b78f3d 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1285,6 +1285,30 @@ def fix_permissions(files, prefix): log.warn(str(e)) +def check_menuinst_json(files, prefix): + json_files = fnmatch_filter(files, "[Mm]enu[/\\]*.[Jj][Ss][Oo][Nn]") + if not json_files: + return + + try: + from json import JSONDecodeError + from menuinst.schema import validate + from pydantic import ValidationError + except ModuleNotFoundError: + print( + "Could not import menuinst and/or pydantic! " + "The following 'Menu/*.json' files were found but won't be validated!" + ", ".join(json_files) + ) + return + for f in json_files: + try: + validate(join(prefix, f)) + except (ValidationError, JSONDecodeError) as e: + log = utils.get_logger(__name__) + log.warning("! '%s' is not a valid menuinst JSON file! %s:\n%s", f, type(e), e) + + def post_build(m, files, build_python, host_prefix=None, is_already_linked=False): print('number of files:', len(files)) @@ -1312,6 +1336,7 @@ def post_build(m, files, build_python, host_prefix=None, is_already_linked=False f in binary_relocation): post_process_shared_lib(m, f, prefix_files, host_prefix) check_overlinking(m, files, host_prefix) + check_menuinst_json(files, host_prefix) def check_symlinks(files, prefix, croot): diff --git a/tests/test-recipes/metadata/menu_json_validation/menu.json b/tests/test-recipes/metadata/menu_json_validation/menu.json new file mode 100644 index 0000000000..dc5468d9f8 --- /dev/null +++ b/tests/test-recipes/metadata/menu_json_validation/menu.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://json-schema.org/draft-07/schema", + "$id": "https://schemas.conda.io/menuinst-1.schema.json", + "menu_name": "Example 1", + "menu_items": [ + { + "name": "Example", + "description": "This will install to Windows and Linux with default options. MacOS has a custom option.", + "icon": null, + "command": [ + "{{ PYTHON }}", + "-c", + "import sys; print(sys.executable)" + ], + "platforms": { + "win": {}, + "linux": {}, + "osx": { + "CFBundleName": "My Example" + } + } + } + ] +} \ No newline at end of file diff --git a/tests/test-recipes/metadata/menu_json_validation/meta.yaml b/tests/test-recipes/metadata/menu_json_validation/meta.yaml new file mode 100644 index 0000000000..e21453e871 --- /dev/null +++ b/tests/test-recipes/metadata/menu_json_validation/meta.yaml @@ -0,0 +1,10 @@ +package: + name: menu_json_validation + version: "1.0" + +build: + script: + - mkdir -p ${PREFIX}/Menu # [unix] + - cp menu.json ${PREFIX}/Menu/menu_json_validation.json # [unix] + - md %PREFIX%\Menu # [win] + - xcopy menu.json %PREFIX%\Menu\menu_json_validation.json # [win] diff --git a/tests/test_post.py b/tests/test_post.py index f7d47ac97d..d25ef7f992 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -1,6 +1,7 @@ import os import shutil import sys +import logging import pytest @@ -78,3 +79,28 @@ def test_pypi_installer_metadata(testing_config): pkg = api.build(recipe, config=testing_config, notest=True)[0] expected_installer = '{}/imagesize-1.1.0.dist-info/INSTALLER'.format(get_site_packages('', '3.9')) assert 'conda' == (package_has_file(pkg, expected_installer, refresh_mode='forced')) + + +def test_menuinst_validation_passes(testing_config): + recipe = os.path.join(metadata_dir, 'menu_json_validation') + pkg = api.build(recipe, config=testing_config, notest=True)[0] + assert package_has_file(pkg, 'Menu/menu_json_validation.json') + + +def test_menuinst_validation_fails(testing_config, caplog): + recipe = os.path.join(metadata_dir, 'menu_json_validation') + original_content = None + + try: + with open(os.path.join(recipe, "menu.json"), "r+") as f: + original_content = f.read() + f.write("Make this an invalid JSON") + + with caplog.at_level(logging.WARNING): + pkg = api.build(recipe, config=testing_config, notest=True)[0] + assert "not a valid menuinst JSON file" in caplog.text + + finally: + if original_content is not None: + with open(os.path.join(recipe, "menu.json"), "w") as f: + f.write(original_content) From 4750410faf70674773395923e85e32296b20e736 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 29 Mar 2022 12:12:46 +0200 Subject: [PATCH 02/40] use RECIPE_DIR --- .../test-recipes/metadata/menu_json_validation/meta.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test-recipes/metadata/menu_json_validation/meta.yaml b/tests/test-recipes/metadata/menu_json_validation/meta.yaml index e21453e871..792ed5cedd 100644 --- a/tests/test-recipes/metadata/menu_json_validation/meta.yaml +++ b/tests/test-recipes/metadata/menu_json_validation/meta.yaml @@ -4,7 +4,7 @@ package: build: script: - - mkdir -p ${PREFIX}/Menu # [unix] - - cp menu.json ${PREFIX}/Menu/menu_json_validation.json # [unix] - - md %PREFIX%\Menu # [win] - - xcopy menu.json %PREFIX%\Menu\menu_json_validation.json # [win] + - mkdir -p "${PREFIX}/Menu" # [unix] + - cp "${RECIPE_DIR}/menu.json" "${PREFIX}/Menu/menu_json_validation.json" # [unix] + - md "%PREFIX%\Menu" # [win] + - xcopy "%RECIPE_DIR%\menu.json" "%PREFIX%\Menu\menu_json_validation.json" # [win] From d252214361a9ebbf47589a3daa0d3167f9c465f9 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 29 Mar 2022 12:13:32 +0200 Subject: [PATCH 03/40] add deps --- ci/azurepipelines/install_conda_build_test_deps | 2 ++ conda.recipe/meta.yaml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ci/azurepipelines/install_conda_build_test_deps b/ci/azurepipelines/install_conda_build_test_deps index b23bc70d10..3d6df71dd2 100755 --- a/ci/azurepipelines/install_conda_build_test_deps +++ b/ci/azurepipelines/install_conda_build_test_deps @@ -17,6 +17,8 @@ function install_conda_build_test_deps_fn() _PKGS+=(${DEF_CHAN}::anaconda-client ${DEF_CHAN}::git ${DEF_CHAN}::requests ${DEF_CHAN}::filelock ${DEF_CHAN}::contextlib2 ${DEF_CHAN}::jinja2 ${DEF_CHAN}::flaky) _PKGS+=(${DEF_CHAN}::ripgrep ${DEF_CHAN}::pyflakes ${DEF_CHAN}::beautifulsoup4 ${DEF_CHAN}::chardet ${DEF_CHAN}::pycrypto ${DEF_CHAN}::glob2 ${DEF_CHAN}::psutil ${DEF_CHAN}::pytz ${DEF_CHAN}::tqdm) _PKGS+=(${DEF_CHAN}::conda-package-handling ${DEF_CHAN}::perl ${DEF_CHAN}::python-libarchive-c) + # TODO: Temporary, remove before merge + _PKGS+=(jaimergp/label/menuinst_dev::menuninst=2 ${DEF_CHAN}::pydantic) _PKGS+=(${DEF_CHAN}::pip ${DEF_CHAN}::numpy ${DEF_CHAN}::pkginfo ${DEF_CHAN}::python="${PYTHON_VERSION}") if [[ $(uname) =~ .*inux.* ]] && [[ ! ${MACOS_ARM64} == yes ]] ; then _PKGS+=(${DEF_CHAN}::patchelf) diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 3d5883e95c..7635c68f83 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -49,6 +49,9 @@ requirements: - tqdm - conda-package-handling >=1.3 - python-libarchive-c + # New for JSON validation + - menuinst >=2 + - pydantic test: files: From 1ac5588e806e2dc5014f90e5bbe8f00cf3a75fc0 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 29 Mar 2022 12:18:10 +0200 Subject: [PATCH 04/40] oopsie typo --- ci/azurepipelines/install_conda_build_test_deps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/azurepipelines/install_conda_build_test_deps b/ci/azurepipelines/install_conda_build_test_deps index 3d6df71dd2..66efdf9763 100755 --- a/ci/azurepipelines/install_conda_build_test_deps +++ b/ci/azurepipelines/install_conda_build_test_deps @@ -18,7 +18,7 @@ function install_conda_build_test_deps_fn() _PKGS+=(${DEF_CHAN}::ripgrep ${DEF_CHAN}::pyflakes ${DEF_CHAN}::beautifulsoup4 ${DEF_CHAN}::chardet ${DEF_CHAN}::pycrypto ${DEF_CHAN}::glob2 ${DEF_CHAN}::psutil ${DEF_CHAN}::pytz ${DEF_CHAN}::tqdm) _PKGS+=(${DEF_CHAN}::conda-package-handling ${DEF_CHAN}::perl ${DEF_CHAN}::python-libarchive-c) # TODO: Temporary, remove before merge - _PKGS+=(jaimergp/label/menuinst_dev::menuninst=2 ${DEF_CHAN}::pydantic) + _PKGS+=(jaimergp/label/menuinst_dev::menuinst=2 ${DEF_CHAN}::pydantic) _PKGS+=(${DEF_CHAN}::pip ${DEF_CHAN}::numpy ${DEF_CHAN}::pkginfo ${DEF_CHAN}::python="${PYTHON_VERSION}") if [[ $(uname) =~ .*inux.* ]] && [[ ! ${MACOS_ARM64} == yes ]] ; then _PKGS+=(${DEF_CHAN}::patchelf) From 33a607ad4c48ae0a7c9e42c2e110b70e548032c0 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 29 Mar 2022 12:28:36 +0200 Subject: [PATCH 05/40] use pip for now --- ci/azurepipelines/install_conda_build_test_deps | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci/azurepipelines/install_conda_build_test_deps b/ci/azurepipelines/install_conda_build_test_deps index 66efdf9763..88b982c7d8 100755 --- a/ci/azurepipelines/install_conda_build_test_deps +++ b/ci/azurepipelines/install_conda_build_test_deps @@ -18,7 +18,7 @@ function install_conda_build_test_deps_fn() _PKGS+=(${DEF_CHAN}::ripgrep ${DEF_CHAN}::pyflakes ${DEF_CHAN}::beautifulsoup4 ${DEF_CHAN}::chardet ${DEF_CHAN}::pycrypto ${DEF_CHAN}::glob2 ${DEF_CHAN}::psutil ${DEF_CHAN}::pytz ${DEF_CHAN}::tqdm) _PKGS+=(${DEF_CHAN}::conda-package-handling ${DEF_CHAN}::perl ${DEF_CHAN}::python-libarchive-c) # TODO: Temporary, remove before merge - _PKGS+=(jaimergp/label/menuinst_dev::menuinst=2 ${DEF_CHAN}::pydantic) + _PKGS+=(${DEF_CHAN}::pydantic) _PKGS+=(${DEF_CHAN}::pip ${DEF_CHAN}::numpy ${DEF_CHAN}::pkginfo ${DEF_CHAN}::python="${PYTHON_VERSION}") if [[ $(uname) =~ .*inux.* ]] && [[ ! ${MACOS_ARM64} == yes ]] ; then _PKGS+=(${DEF_CHAN}::patchelf) @@ -31,6 +31,10 @@ function install_conda_build_test_deps_fn() fi echo -e "Asking conda to install:\n${_PKGS[@]}" conda install -y --show-channel-urls "${_PKGS[@]}" "$@" + # TODO: Temporary, remove before merge + # This is needed for now because conda 4.12 pins menuinst<2 + pip install --no-deps https://github.com/jaimergp/menuinst/archive/refs/heads/cep.zip + # If we install shellcheck from conda-forge and packages from defaults at the same time (via channel::package) # then conda-forge used for other packages too. We could force it by forcing transitive deps to also be listed # with their channel, but, well, yuck. From 9d34d9d01f6495cc0d69951287be91ddeb7a8531 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 29 Mar 2022 13:39:37 +0200 Subject: [PATCH 06/40] add on windows too --- .github/workflows/tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ceabf11dc0..867e27c992 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -208,6 +208,10 @@ jobs: call conda update -q --all||exit 1 call conda install -q pip python-libarchive-c pytest git pytest-cov jinja2 m2-patch flake8 mock requests contextlib2 chardet glob2 perl pyflakes pycrypto posix m2-git anaconda-client numpy beautifulsoup4 pytest-xdist pytest-mock filelock pkginfo psutil pytz tqdm conda-package-handling pytest-azurepipelines||exit 1 call conda install pytest-replay pytest-rerunfailures -y||exit 1 + # TODO: Temporary, remove before merge + call conda install pydantic -y||exit 1 + # This is needed for now because conda 4.12 pins menuinst<2 + pip install --no-deps https://github.com/jaimergp/menuinst/archive/refs/heads/cep.zip echo safety_checks: disabled >> %UserProfile%\.condarc echo local_repodata_ttl: 1800 >> %UserProfile%\.condarc call conda install -q py-lief||exit 1 From 08642f1a9b9c2b4031c9d5d5f23d851e99473787 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 29 Mar 2022 13:45:00 +0200 Subject: [PATCH 07/40] make sure test can fail --- tests/test_post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_post.py b/tests/test_post.py index d25ef7f992..bb94050068 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -98,7 +98,7 @@ def test_menuinst_validation_fails(testing_config, caplog): with caplog.at_level(logging.WARNING): pkg = api.build(recipe, config=testing_config, notest=True)[0] - assert "not a valid menuinst JSON file" in caplog.text + assert "not a valid menuXXXXinst JSON file" in caplog.text finally: if original_content is not None: From 17867b47c87defb1a082bb145d0f29c112c5cfb8 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 29 Mar 2022 14:24:18 +0200 Subject: [PATCH 08/40] revert, it fails as expected! --- tests/test_post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_post.py b/tests/test_post.py index bb94050068..d25ef7f992 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -98,7 +98,7 @@ def test_menuinst_validation_fails(testing_config, caplog): with caplog.at_level(logging.WARNING): pkg = api.build(recipe, config=testing_config, notest=True)[0] - assert "not a valid menuXXXXinst JSON file" in caplog.text + assert "not a valid menuinst JSON file" in caplog.text finally: if original_content is not None: From cc30e6942111e960970c623ae7be027e47236678 Mon Sep 17 00:00:00 2001 From: Jaime RGP Date: Tue, 29 Mar 2022 16:41:40 +0200 Subject: [PATCH 09/40] why timeout=120 on windows? --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 867e27c992..b2953e351b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -123,7 +123,7 @@ jobs: - python-version: '3.9' conda-version: canary test-type: parallel - timeout-minutes: 120 + # timeout-minutes: 120 env: serial_or_parallel: '' From bca26043e541bbfb3a6e8e58622c0778d329d532 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 16 Aug 2023 11:46:35 +0200 Subject: [PATCH 10/40] pre-commit --- conda_build/post.py | 5 ++++- tests/test_post.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/conda_build/post.py b/conda_build/post.py index 2a298f4323..4a0af84f5c 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1693,6 +1693,7 @@ def check_menuinst_json(files, prefix): try: from json import JSONDecodeError + from menuinst.schema import validate from pydantic import ValidationError except ModuleNotFoundError: @@ -1707,7 +1708,9 @@ def check_menuinst_json(files, prefix): validate(join(prefix, f)) except (ValidationError, JSONDecodeError) as e: log = utils.get_logger(__name__) - log.warning("! '%s' is not a valid menuinst JSON file! %s:\n%s", f, type(e), e) + log.warning( + "! '%s' is not a valid menuinst JSON file! %s:\n%s", f, type(e), e + ) def post_build(m, files, build_python, host_prefix=None, is_already_linked=False): diff --git a/tests/test_post.py b/tests/test_post.py index f1647cf30a..3bfebbb86d 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -1,9 +1,9 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +import logging import os import shutil import sys -import logging import pytest @@ -95,13 +95,13 @@ def test_pypi_installer_metadata(testing_config): def test_menuinst_validation_passes(testing_config): - recipe = os.path.join(metadata_dir, 'menu_json_validation') + recipe = os.path.join(metadata_dir, "menu_json_validation") pkg = api.build(recipe, config=testing_config, notest=True)[0] - assert package_has_file(pkg, 'Menu/menu_json_validation.json') + assert package_has_file(pkg, "Menu/menu_json_validation.json") def test_menuinst_validation_fails(testing_config, caplog): - recipe = os.path.join(metadata_dir, 'menu_json_validation') + recipe = os.path.join(metadata_dir, "menu_json_validation") original_content = None try: From b668b00f275d9be573b9a3ea1148754a1a8dcdff Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 21 Aug 2023 20:05:10 +0200 Subject: [PATCH 11/40] take from canary channel --- tests/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/requirements.txt b/tests/requirements.txt index 99a500364b..915577ec5a 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -38,4 +38,4 @@ tomli tqdm # NEW for menuinst validation pydantic <2.0a0 -menuinst >=2.0a0 +conda-canary/label/dev::menuinst >=2.0.0a0 From 0466d52a840501c269dbaf604d3fc82f93c0c6ee Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 22 Aug 2023 12:46:53 +0200 Subject: [PATCH 12/40] --no-deps --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 47b744cdd9..8f9a98fd87 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -116,7 +116,7 @@ jobs: --file ./tests/requirements.txt \ --file ./tests/requirements-linux.txt \ ${{ env.CONDA_CHANNEL_LABEL }}::conda - pip install -e . + pip install -e . --no-deps - name: Show info run: | @@ -221,7 +221,7 @@ jobs: --file .\tests\requirements.txt ` --file .\tests\requirements-windows.txt ` ${{ env.CONDA_CHANNEL_LABEL }}::conda - pip install -e . + pip install -e . --no-deps - name: Show info run: | @@ -332,7 +332,7 @@ jobs: --file ./tests/requirements.txt \ --file ./tests/requirements-macos.txt \ ${{ env.CONDA_CHANNEL_LABEL }}::conda - pip install -e . + pip install -e . --no-deps - name: Show info run: | From 42cf63007517a4ca4400ae8b4f484fa9c5f13e95 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 22 Aug 2023 18:18:26 +0200 Subject: [PATCH 13/40] fix import error --- conda_build/post.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/conda_build/post.py b/conda_build/post.py index 4a0af84f5c..feb96a1322 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1691,28 +1691,30 @@ def check_menuinst_json(files, prefix): if not json_files: return + print("Validating Menu/*.json files") + log = utils.get_logger(__name__) try: from json import JSONDecodeError - from menuinst.schema import validate + from menuinst._schema import validate from pydantic import ValidationError - except ModuleNotFoundError: - print( - "Could not import menuinst and/or pydantic! " - "The following 'Menu/*.json' files were found but won't be validated!" - ", ".join(json_files) + except ModuleNotFoundError as exc: + log.warning( + "Found 'Menu/*.json' files but couldn't validate:%s", + ", ".join(json_files), + exc_info=exc, ) return - for f in json_files: + for json_file in json_files: try: - validate(join(prefix, f)) - except (ValidationError, JSONDecodeError) as e: - log = utils.get_logger(__name__) + validate(join(prefix, json_file)) + except (ValidationError, JSONDecodeError) as exc: log.warning( - "! '%s' is not a valid menuinst JSON file! %s:\n%s", f, type(e), e + "'%s' is not a valid menuinst JSON file!", + json_file, + exc_info=exc, ) - def post_build(m, files, build_python, host_prefix=None, is_already_linked=False): print("number of files:", len(files)) From 10db4d2a921cea0aa8190f0de621a095e55883be Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 22 Aug 2023 18:26:18 +0200 Subject: [PATCH 14/40] fix tests --- tests/test_post.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/test_post.py b/tests/test_post.py index 3bfebbb86d..8033cbe7c4 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -94,9 +94,12 @@ def test_pypi_installer_metadata(testing_config): assert "conda" == (package_has_file(pkg, expected_installer, refresh_mode="forced")) -def test_menuinst_validation_passes(testing_config): +def test_menuinst_validation_passes(testing_config, caplog): recipe = os.path.join(metadata_dir, "menu_json_validation") - pkg = api.build(recipe, config=testing_config, notest=True)[0] + with caplog.at_level(logging.WARNING): + pkg = api.build(recipe, config=testing_config, notest=True)[0] + + assert "not a valid menuinst JSON file" not in caplog.text assert package_has_file(pkg, "Menu/menu_json_validation.json") @@ -110,14 +113,10 @@ def test_menuinst_validation_fails(testing_config, caplog): f.write("Make this an invalid JSON") with caplog.at_level(logging.WARNING): - pkg = api.build(recipe, config=testing_config, notest=True)[0] + api.build(recipe, config=testing_config, notest=True)[0] assert "not a valid menuinst JSON file" in caplog.text finally: if original_content is not None: with open(os.path.join(recipe, "menu.json"), "w") as f: f.write(original_content) - expected_installer = "{}/imagesize-1.1.0.dist-info/INSTALLER".format( - get_site_packages("", "3.9") - ) - assert "conda" == (package_has_file(pkg, expected_installer, refresh_mode="forced")) From 5094c60ade8ae974bab16d30741e434a4616acda Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 22 Aug 2023 18:27:41 +0200 Subject: [PATCH 15/40] pre-commit --- conda_build/post.py | 1 + 1 file changed, 1 insertion(+) diff --git a/conda_build/post.py b/conda_build/post.py index feb96a1322..e83d2b9c08 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1715,6 +1715,7 @@ def check_menuinst_json(files, prefix): exc_info=exc, ) + def post_build(m, files, build_python, host_prefix=None, is_already_linked=False): print("number of files:", len(files)) From a3a75eee3d8c997e5f99cfaebfcf333af6b00740 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 15 Sep 2023 11:50:07 +0200 Subject: [PATCH 16/40] require menuinst v2 stable --- recipe/meta.yaml | 3 +-- tests/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 9e19acf231..42e6136f44 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -52,8 +52,7 @@ requirements: - six - tomli # [py<311] - tqdm - # New for JSON validation - - menuinst >=2.0a0 + - menuinst >=2 - pydantic <2.0a0 run_constrained: - conda-verify >=3.1.0 diff --git a/tests/requirements.txt b/tests/requirements.txt index 915577ec5a..11dcf76ab5 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -38,4 +38,4 @@ tomli tqdm # NEW for menuinst validation pydantic <2.0a0 -conda-canary/label/dev::menuinst >=2.0.0a0 +conda-forge::menuinst >=2 From 807e96ee1c6e37d41ee0379629675439a56ca85b Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 15 Sep 2023 11:51:04 +0200 Subject: [PATCH 17/40] fix backslashes --- tests/test-recipes/metadata/menu_json_validation/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-recipes/metadata/menu_json_validation/meta.yaml b/tests/test-recipes/metadata/menu_json_validation/meta.yaml index 792ed5cedd..fdd9924312 100644 --- a/tests/test-recipes/metadata/menu_json_validation/meta.yaml +++ b/tests/test-recipes/metadata/menu_json_validation/meta.yaml @@ -6,5 +6,5 @@ build: script: - mkdir -p "${PREFIX}/Menu" # [unix] - cp "${RECIPE_DIR}/menu.json" "${PREFIX}/Menu/menu_json_validation.json" # [unix] - - md "%PREFIX%\Menu" # [win] - - xcopy "%RECIPE_DIR%\menu.json" "%PREFIX%\Menu\menu_json_validation.json" # [win] + - md "%PREFIX%\\Menu" # [win] + - xcopy "%RECIPE_DIR%\\menu.json" "%PREFIX%\\Menu\\menu_json_validation.json" # [win] From 090693882f5b053ecd30ca8fa36a21b760b1bd42 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 15 Sep 2023 14:33:48 +0200 Subject: [PATCH 18/40] use the libmamba solver in env setup --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8f9a98fd87..1440c81a16 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -112,7 +112,7 @@ jobs: - name: Setup environment run: | - conda install -q -y -c defaults \ + conda install -q -y -c defaults --solver=libmamba \ --file ./tests/requirements.txt \ --file ./tests/requirements-linux.txt \ ${{ env.CONDA_CHANNEL_LABEL }}::conda @@ -217,7 +217,7 @@ jobs: - name: Setup environment run: | choco install visualstudio2017-workload-vctools - conda install -q -y -c defaults ` + conda install -q -y -c defaults --solver=libmamba ` --file .\tests\requirements.txt ` --file .\tests\requirements-windows.txt ` ${{ env.CONDA_CHANNEL_LABEL }}::conda @@ -328,7 +328,7 @@ jobs: - name: Setup environment run: | sudo xcode-select --switch /Applications/Xcode_11.7.app - conda install -q -y -c defaults \ + conda install -q -y -c defaults --solver=libmamba \ --file ./tests/requirements.txt \ --file ./tests/requirements-macos.txt \ ${{ env.CONDA_CHANNEL_LABEL }}::conda From cf32230e06ead2bf67e22a4ae6abadf93b20b98a Mon Sep 17 00:00:00 2001 From: jaimergp Date: Fri, 15 Sep 2023 16:18:24 +0200 Subject: [PATCH 19/40] exit early --- .github/workflows/tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1440c81a16..542c779aac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest defaults: run: - shell: bash -l {0} + shell: bash -el {0} strategy: fail-fast: false matrix: @@ -216,12 +216,12 @@ jobs: - name: Setup environment run: | - choco install visualstudio2017-workload-vctools + choco install visualstudio2017-workload-vctools || exit 1 conda install -q -y -c defaults --solver=libmamba ` --file .\tests\requirements.txt ` --file .\tests\requirements-windows.txt ` - ${{ env.CONDA_CHANNEL_LABEL }}::conda - pip install -e . --no-deps + ${{ env.CONDA_CHANNEL_LABEL }}::conda || exit 1 + pip install -e . --no-deps || exit 1 - name: Show info run: | @@ -279,7 +279,7 @@ jobs: runs-on: macos-11 defaults: run: - shell: bash -l {0} + shell: bash -el {0} strategy: fail-fast: false matrix: From 04dc682ff5ef33c47f1be66baa1193aa4aba3c76 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 2 Nov 2023 17:42:29 +0100 Subject: [PATCH 20/40] use jsonschema instead of pydantic --- conda_build/post.py | 33 ++++++++++---- pyproject.toml | 2 +- recipe/meta.yaml | 2 +- tests/requirements.txt | 2 +- .../metadata/menu_json_validation/menu.json | 1 - tests/test_post.py | 44 +++++++++++++++++-- 6 files changed, 68 insertions(+), 16 deletions(-) diff --git a/conda_build/post.py b/conda_build/post.py index 333369a33a..8b1b5554b8 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1,5 +1,6 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +import json import locale import os import re @@ -1688,26 +1689,42 @@ def check_menuinst_json(files, prefix): print("Validating Menu/*.json files") log = utils.get_logger(__name__) try: - from json import JSONDecodeError - - from menuinst._schema import validate - from pydantic import ValidationError + import jsonschema + from menuinst.utils import data_path except ModuleNotFoundError as exc: log.warning( - "Found 'Menu/*.json' files but couldn't validate:%s", + "Found 'Menu/*.json' files but couldn't validate: %s", ", ".join(json_files), exc_info=exc, ) return + + try: + schema_path = data_path("menuinst.schema.json") + with open(schema_path) as f: + schema = json.load(f) + ValidatorClass = jsonschema.validators.validator_for(schema) + validator = ValidatorClass(schema) + except (jsonschema.SchemaError, json.JSONDecodeError, OSError) as exc: + log.warning("'%s' is not a valid menuinst schema", schema_path, exc_info=exc) + return + for json_file in json_files: try: - validate(join(prefix, json_file)) - except (ValidationError, JSONDecodeError) as exc: + with open(join(prefix, json_file)) as f: + text = f.read() + if "$schema" not in text: + log.warning("menuinst v1 JSON document '%s' won't be validated.", json_file) + continue + validator.validate(json.loads(text)) + except (jsonschema.ValidationError, json.JSONDecodeError) as exc: log.warning( - "'%s' is not a valid menuinst JSON file!", + "'%s' is not a valid menuinst JSON document!", json_file, exc_info=exc, ) + else: + log.info("'%s' is a valid menuinst JSON document", json_file) def post_build(m, files, build_python, host_prefix=None, is_already_linked=False): diff --git a/pyproject.toml b/pyproject.toml index 0ee0efae0b..089ee7b405 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dependencies = [ "six", "tomli ; python_version<'3.11'", "tqdm", - "pydantic <2.0", + "jsonschema >=4.19", "menuinst >=2" ] dynamic = ["version"] diff --git a/recipe/meta.yaml b/recipe/meta.yaml index ea42fc3a8c..c2451656da 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -52,7 +52,7 @@ requirements: - tomli # [py<311] - tqdm - menuinst >=2 - - pydantic <2.0a0 + - jsonschema >=4.19 run_constrained: - conda-verify >=3.1.0 diff --git a/tests/requirements.txt b/tests/requirements.txt index 9c5f8bdbde..9b8ec0b04d 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -34,5 +34,5 @@ setuptools_scm # needed for devenv version detection tomli tqdm # NEW for menuinst validation -pydantic <2.0a0 +jsonschema conda-forge::menuinst >=2 diff --git a/tests/test-recipes/metadata/menu_json_validation/menu.json b/tests/test-recipes/metadata/menu_json_validation/menu.json index dc5468d9f8..eeed9e756f 100644 --- a/tests/test-recipes/metadata/menu_json_validation/menu.json +++ b/tests/test-recipes/metadata/menu_json_validation/menu.json @@ -6,7 +6,6 @@ { "name": "Example", "description": "This will install to Windows and Linux with default options. MacOS has a custom option.", - "icon": null, "command": [ "{{ PYTHON }}", "-c", diff --git a/tests/test_post.py b/tests/test_post.py index 8033cbe7c4..7187116b18 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -1,5 +1,6 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +import json import logging import os import shutil @@ -96,14 +97,18 @@ def test_pypi_installer_metadata(testing_config): def test_menuinst_validation_passes(testing_config, caplog): recipe = os.path.join(metadata_dir, "menu_json_validation") - with caplog.at_level(logging.WARNING): + with caplog.at_level(logging.INFO): pkg = api.build(recipe, config=testing_config, notest=True)[0] + print(caplog.text) + assert "Found 'Menu/*.json' files but couldn't validate:" not in caplog.text assert "not a valid menuinst JSON file" not in caplog.text + assert "is a valid menuinst JSON document" in caplog.text assert package_has_file(pkg, "Menu/menu_json_validation.json") -def test_menuinst_validation_fails(testing_config, caplog): +def test_menuinst_validation_fails_bad_json(testing_config, caplog): + "1st check - non-parsable JSON" recipe = os.path.join(metadata_dir, "menu_json_validation") original_content = None @@ -113,9 +118,40 @@ def test_menuinst_validation_fails(testing_config, caplog): f.write("Make this an invalid JSON") with caplog.at_level(logging.WARNING): - api.build(recipe, config=testing_config, notest=True)[0] - assert "not a valid menuinst JSON file" in caplog.text + api.build(recipe, config=testing_config, notest=True) + print(caplog.text) + assert "Found 'Menu/*.json' files but couldn't validate:" not in caplog.text + assert "not a valid menuinst JSON document" in caplog.text + assert "JSONDecodeError" in caplog.text + finally: + if original_content is not None: + with open(os.path.join(recipe, "menu.json"), "w") as f: + f.write(original_content) + + +def test_menuinst_validation_fails_bad_schema(testing_config, caplog): + "2nd check - valid JSON, but invalid content fails schema validation" + recipe = os.path.join(metadata_dir, "menu_json_validation") + original_content = None + + try: + with open(os.path.join(recipe, "menu.json")) as f: + original_content = f.read() + + bad_data = json.loads(original_content) + bad_data["menu_items"][0]["icon"] = None + with open(os.path.join(recipe, "menu.json"), "w") as f: + json.dump(bad_data, f) + + with caplog.at_level(logging.WARNING): + api.build(recipe, config=testing_config, notest=True) + + print(caplog.text) + assert "Found 'Menu/*.json' files but couldn't validate:" not in caplog.text + assert "not a valid menuinst JSON document" in caplog.text + assert "ValidationError" in caplog.text + assert "is a valid menuinst JSON document" not in caplog.text finally: if original_content is not None: with open(os.path.join(recipe, "menu.json"), "w") as f: From 72e8ab3b7ff2d98158e7d7c07293869fd85c75ca Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 2 Nov 2023 17:48:31 +0100 Subject: [PATCH 21/40] remove solver=libmamba bits --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cd48cb6272..530c5143a6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -112,7 +112,7 @@ jobs: - name: Setup environment run: | - conda install -q -y -c defaults --solver=libmamba \ + conda install -q -y -c defaults \ --file ./tests/requirements.txt \ --file ./tests/requirements-linux.txt \ ${{ env.CONDA_CHANNEL_LABEL }}::conda @@ -217,7 +217,7 @@ jobs: - name: Setup environment run: | choco install visualstudio2017-workload-vctools || exit 1 - conda install -q -y -c defaults --solver=libmamba ` + conda install -q -y -c defaults ` --file .\tests\requirements.txt ` --file .\tests\requirements-windows.txt ` ${{ env.CONDA_CHANNEL_LABEL }}::conda || exit 1 @@ -328,7 +328,7 @@ jobs: - name: Setup environment run: | sudo xcode-select --switch /Applications/Xcode_11.7.app - conda install -q -y -c defaults --solver=libmamba \ + conda install -q -y -c defaults \ --file ./tests/requirements.txt \ --file ./tests/requirements-macos.txt \ ${{ env.CONDA_CHANNEL_LABEL }}::conda From 81f824c49e34cc95cbe997ac5911c8df05a1ccae Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 2 Nov 2023 17:49:38 +0100 Subject: [PATCH 22/40] pre-commit --- conda_build/post.py | 4 +++- tests/requirements.txt | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/conda_build/post.py b/conda_build/post.py index 8b1b5554b8..d335a33a39 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1714,7 +1714,9 @@ def check_menuinst_json(files, prefix): with open(join(prefix, json_file)) as f: text = f.read() if "$schema" not in text: - log.warning("menuinst v1 JSON document '%s' won't be validated.", json_file) + log.warning( + "menuinst v1 JSON document '%s' won't be validated.", json_file + ) continue validator.validate(json.loads(text)) except (jsonschema.ValidationError, json.JSONDecodeError) as exc: diff --git a/tests/requirements.txt b/tests/requirements.txt index 9b8ec0b04d..75eb79cfad 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,8 +1,10 @@ +# NEW for menuinst validation anaconda-client beautifulsoup4 chardet conda >=4.13 conda-forge::allure-pytest +conda-forge::menuinst >=2 conda-index conda-package-handling conda-verify @@ -11,6 +13,7 @@ cytoolz filelock git jinja2 +jsonschema numpy perl pip @@ -33,6 +36,3 @@ ruamel.yaml setuptools_scm # needed for devenv version detection tomli tqdm -# NEW for menuinst validation -jsonschema -conda-forge::menuinst >=2 From 00b25445892b6a9828a1195462072b7bea27f891 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 6 Nov 2023 22:02:05 +0100 Subject: [PATCH 23/40] do not deduplicate log warnings --- conda_build/post.py | 4 +- tests/test_post.py | 106 +++++++++++++++++++++----------------------- 2 files changed, 52 insertions(+), 58 deletions(-) diff --git a/conda_build/post.py b/conda_build/post.py index 954bdda275..0b3b50fe6e 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1683,7 +1683,7 @@ def check_menuinst_json(files, prefix): return print("Validating Menu/*.json files") - log = utils.get_logger(__name__) + log = utils.get_logger(__name__, dedupe=False) try: import jsonschema from menuinst.utils import data_path @@ -1715,7 +1715,7 @@ def check_menuinst_json(files, prefix): ) continue validator.validate(json.loads(text)) - except (jsonschema.ValidationError, json.JSONDecodeError) as exc: + except (jsonschema.ValidationError, json.JSONDecodeError, OSError) as exc: log.warning( "'%s' is not a valid menuinst JSON document!", json_file, diff --git a/tests/test_post.py b/tests/test_post.py index 7187116b18..7e86debcc4 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -5,6 +5,7 @@ import os import shutil import sys +from pathlib import Path import pytest @@ -95,64 +96,57 @@ def test_pypi_installer_metadata(testing_config): assert "conda" == (package_has_file(pkg, expected_installer, refresh_mode="forced")) -def test_menuinst_validation_passes(testing_config, caplog): - recipe = os.path.join(metadata_dir, "menu_json_validation") +def test_menuinst_validation_ok(testing_config, caplog, tmp_path): + # 1st check - validation passes with recipe as is + recipe = Path(metadata_dir, "menu_json_validation") + recipe_tmp = tmp_path / "menu_json_validation" + shutil.copytree(recipe, recipe_tmp) + with caplog.at_level(logging.INFO): - pkg = api.build(recipe, config=testing_config, notest=True)[0] + pkg = api.build(str(recipe_tmp), config=testing_config, notest=True)[0] - print(caplog.text) - assert "Found 'Menu/*.json' files but couldn't validate:" not in caplog.text - assert "not a valid menuinst JSON file" not in caplog.text - assert "is a valid menuinst JSON document" in caplog.text + captured_text = caplog.text + print(captured_text) + assert "Found 'Menu/*.json' files but couldn't validate:" not in captured_text + assert "not a valid menuinst JSON file" not in captured_text + assert "is a valid menuinst JSON document" in captured_text assert package_has_file(pkg, "Menu/menu_json_validation.json") -def test_menuinst_validation_fails_bad_json(testing_config, caplog): - "1st check - non-parsable JSON" - recipe = os.path.join(metadata_dir, "menu_json_validation") - original_content = None - - try: - with open(os.path.join(recipe, "menu.json"), "r+") as f: - original_content = f.read() - f.write("Make this an invalid JSON") - - with caplog.at_level(logging.WARNING): - api.build(recipe, config=testing_config, notest=True) - - print(caplog.text) - assert "Found 'Menu/*.json' files but couldn't validate:" not in caplog.text - assert "not a valid menuinst JSON document" in caplog.text - assert "JSONDecodeError" in caplog.text - finally: - if original_content is not None: - with open(os.path.join(recipe, "menu.json"), "w") as f: - f.write(original_content) - - -def test_menuinst_validation_fails_bad_schema(testing_config, caplog): - "2nd check - valid JSON, but invalid content fails schema validation" - recipe = os.path.join(metadata_dir, "menu_json_validation") - original_content = None - - try: - with open(os.path.join(recipe, "menu.json")) as f: - original_content = f.read() - - bad_data = json.loads(original_content) - bad_data["menu_items"][0]["icon"] = None - with open(os.path.join(recipe, "menu.json"), "w") as f: - json.dump(bad_data, f) - - with caplog.at_level(logging.WARNING): - api.build(recipe, config=testing_config, notest=True) - - print(caplog.text) - assert "Found 'Menu/*.json' files but couldn't validate:" not in caplog.text - assert "not a valid menuinst JSON document" in caplog.text - assert "ValidationError" in caplog.text - assert "is a valid menuinst JSON document" not in caplog.text - finally: - if original_content is not None: - with open(os.path.join(recipe, "menu.json"), "w") as f: - f.write(original_content) +def test_menuinst_validation_fails_bad_schema(testing_config, caplog, tmp_path): + # 1st check - valid JSON but invalid content fails validation + recipe = Path(metadata_dir, "menu_json_validation") + recipe_tmp = tmp_path / "menu_json_validation" + shutil.copytree(recipe, recipe_tmp) + menu_json = recipe_tmp / "menu.json" + menu_json_contents = menu_json.read_text() + + bad_data = json.loads(menu_json_contents) + bad_data["menu_items"][0]["osx"] = ["bad", "schema"] + menu_json.write_text(json.dumps(bad_data, indent=2)) + with caplog.at_level(logging.WARNING): + api.build(str(recipe_tmp), config=testing_config, notest=True) + + captured_text = caplog.text + assert "Found 'Menu/*.json' files but couldn't validate:" not in captured_text + assert "not a valid menuinst JSON document" in captured_text + assert "ValidationError" in captured_text + caplog.clear() + + +def test_menuinst_validation_fails_bad_json(testing_config, caplog, tmp_path): + # 2nd check - non-parsable JSON fails validation + recipe = Path(metadata_dir, "menu_json_validation") + recipe_tmp = tmp_path / "menu_json_validation" + shutil.copytree(recipe, recipe_tmp) + menu_json = recipe_tmp / "menu.json" + menu_json_contents = menu_json.read_text() + menu_json.write_text(menu_json_contents + "Make this an invalid JSON") + + with caplog.at_level(logging.WARNING): + api.build(str(recipe_tmp), config=testing_config, notest=True) + + captured_text = caplog.text + assert "Found 'Menu/*.json' files but couldn't validate:" not in captured_text + assert "not a valid menuinst JSON document" in captured_text + assert "JSONDecodeError" in captured_text From 41b2b5051c96fc0fbeb6d37dcb6bcab6c80b6448 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 6 Nov 2023 22:03:43 +0100 Subject: [PATCH 24/40] make them docstrings --- tests/test_post.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_post.py b/tests/test_post.py index 7e86debcc4..36d20452ff 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -97,7 +97,7 @@ def test_pypi_installer_metadata(testing_config): def test_menuinst_validation_ok(testing_config, caplog, tmp_path): - # 1st check - validation passes with recipe as is + "1st check - validation passes with recipe as is" recipe = Path(metadata_dir, "menu_json_validation") recipe_tmp = tmp_path / "menu_json_validation" shutil.copytree(recipe, recipe_tmp) @@ -114,7 +114,7 @@ def test_menuinst_validation_ok(testing_config, caplog, tmp_path): def test_menuinst_validation_fails_bad_schema(testing_config, caplog, tmp_path): - # 1st check - valid JSON but invalid content fails validation + "2nd check - valid JSON but invalid content fails validation" recipe = Path(metadata_dir, "menu_json_validation") recipe_tmp = tmp_path / "menu_json_validation" shutil.copytree(recipe, recipe_tmp) @@ -135,7 +135,7 @@ def test_menuinst_validation_fails_bad_schema(testing_config, caplog, tmp_path): def test_menuinst_validation_fails_bad_json(testing_config, caplog, tmp_path): - # 2nd check - non-parsable JSON fails validation + "3rd check - non-parsable JSON fails validation" recipe = Path(metadata_dir, "menu_json_validation") recipe_tmp = tmp_path / "menu_json_validation" shutil.copytree(recipe, recipe_tmp) From d1250edc1e2bf48d0b0697a0e39cb1a061a066fc Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 6 Nov 2023 22:03:58 +0100 Subject: [PATCH 25/40] no clear needed here --- tests/test_post.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_post.py b/tests/test_post.py index 36d20452ff..4cb209bd71 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -131,7 +131,6 @@ def test_menuinst_validation_fails_bad_schema(testing_config, caplog, tmp_path): assert "Found 'Menu/*.json' files but couldn't validate:" not in captured_text assert "not a valid menuinst JSON document" in captured_text assert "ValidationError" in captured_text - caplog.clear() def test_menuinst_validation_fails_bad_json(testing_config, caplog, tmp_path): From 52e23f86dbb9acc4a8d6494f30b5b4dc6168c555 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 6 Nov 2023 22:04:24 +0100 Subject: [PATCH 26/40] no print needed here either --- tests/test_post.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_post.py b/tests/test_post.py index 4cb209bd71..40b5145042 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -106,7 +106,6 @@ def test_menuinst_validation_ok(testing_config, caplog, tmp_path): pkg = api.build(str(recipe_tmp), config=testing_config, notest=True)[0] captured_text = caplog.text - print(captured_text) assert "Found 'Menu/*.json' files but couldn't validate:" not in captured_text assert "not a valid menuinst JSON file" not in captured_text assert "is a valid menuinst JSON document" in captured_text From 1cc30c5f0c42a8fbf0eeeb3de09b8ca052a81d98 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 7 Nov 2023 11:45:09 +0100 Subject: [PATCH 27/40] try with libmamba again --- .github/workflows/tests.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3302aec421..2181aee90a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -225,12 +225,15 @@ jobs: - name: Setup environment run: | - choco install visualstudio2017-workload-vctools || exit 1 - conda install -q -y -c defaults ` + choco install visualstudio2017-workload-vctools + if %errorlevel% neq 0 exit %errorlevel% + conda install -q -y -c defaults --solver=libmamba ` --file .\tests\requirements.txt ` --file .\tests\requirements-windows.txt ` - ${{ env.CONDA_CHANNEL_LABEL }}::conda || exit 1 - pip install -e . --no-deps || exit 1 + ${{ env.CONDA_CHANNEL_LABEL }}::conda + if %errorlevel% neq 0 exit %errorlevel% + pip install -e . --no-deps + if %errorlevel% neq 0 exit %errorlevel% - name: Show info run: | From 8edf9340312e65189e3b67e0369aa667d3a8790b Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 20 Nov 2023 10:39:23 +0100 Subject: [PATCH 28/40] windows uses pwsh, not batch --- .github/workflows/tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2181aee90a..369a9c500c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -226,14 +226,11 @@ jobs: - name: Setup environment run: | choco install visualstudio2017-workload-vctools - if %errorlevel% neq 0 exit %errorlevel% conda install -q -y -c defaults --solver=libmamba ` --file .\tests\requirements.txt ` --file .\tests\requirements-windows.txt ` ${{ env.CONDA_CHANNEL_LABEL }}::conda - if %errorlevel% neq 0 exit %errorlevel% pip install -e . --no-deps - if %errorlevel% neq 0 exit %errorlevel% - name: Show info run: | From b10807639a795b0a150f80e847fb8a0e59540e17 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 20 Nov 2023 11:13:59 +0100 Subject: [PATCH 29/40] exit on error early by switching to cmd on this step --- .github/workflows/tests.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 369a9c500c..831e6f880a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -224,13 +224,17 @@ jobs: run-post: false # skip post cleanup - name: Setup environment + shell: cmd /C CALL {0} run: | choco install visualstudio2017-workload-vctools - conda install -q -y -c defaults --solver=libmamba ` - --file .\tests\requirements.txt ` - --file .\tests\requirements-windows.txt ` + if %errorlevel% neq 0 exit 1 + conda install -q -y -c defaults --solver=libmamba ^ + --file .\tests\requirements.txt ^ + --file .\tests\requirements-windows.txt ^ ${{ env.CONDA_CHANNEL_LABEL }}::conda + if %errorlevel% neq 0 exit 1 pip install -e . --no-deps + if %errorlevel% neq 0 exit 1 - name: Show info run: | From d5b43184b4fc670f1bbf6cb276d3b8b2b20e60bc Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 20 Nov 2023 11:16:01 +0100 Subject: [PATCH 30/40] get latest miniconda to avoid pre 23.11 bugs with history --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 831e6f880a..22fcfd15eb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -118,6 +118,7 @@ jobs: condarc-file: ./ci/github/.condarc python-version: ${{ matrix.python-version }} run-post: false # skip post cleanup + miniconda-version: latest - name: Setup environment run: | @@ -222,6 +223,7 @@ jobs: condarc-file: .\ci\github\.condarc python-version: ${{ matrix.python-version }} run-post: false # skip post cleanup + miniconda-version: latest - name: Setup environment shell: cmd /C CALL {0} @@ -337,6 +339,7 @@ jobs: condarc-file: ./ci/github/.condarc python-version: ${{ matrix.python-version }} run-post: false # skip post cleanup + miniconda-version: latest - name: Setup environment run: | From 6c4ba18220e89a7ea3fbcf0d3fa3c913dfd032f7 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 20 Nov 2023 11:31:46 +0100 Subject: [PATCH 31/40] revert --- .github/workflows/tests.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 22fcfd15eb..c9c0a6fb8e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -118,7 +118,6 @@ jobs: condarc-file: ./ci/github/.condarc python-version: ${{ matrix.python-version }} run-post: false # skip post cleanup - miniconda-version: latest - name: Setup environment run: | @@ -223,14 +222,13 @@ jobs: condarc-file: .\ci\github\.condarc python-version: ${{ matrix.python-version }} run-post: false # skip post cleanup - miniconda-version: latest - name: Setup environment shell: cmd /C CALL {0} run: | choco install visualstudio2017-workload-vctools if %errorlevel% neq 0 exit 1 - conda install -q -y -c defaults --solver=libmamba ^ + conda install -q -y -c defaults ^ --file .\tests\requirements.txt ^ --file .\tests\requirements-windows.txt ^ ${{ env.CONDA_CHANNEL_LABEL }}::conda @@ -339,7 +337,6 @@ jobs: condarc-file: ./ci/github/.condarc python-version: ${{ matrix.python-version }} run-post: false # skip post cleanup - miniconda-version: latest - name: Setup environment run: | From fe264495c5d3a981b4fcfc9ab9bdd517c97e55b5 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 20 Nov 2023 17:31:33 +0100 Subject: [PATCH 32/40] install menuinst from url on windows --- .github/workflows/tests.yml | 10 ++++++++++ tests/requirements-linux.txt | 2 ++ tests/requirements-macos.txt | 2 ++ tests/requirements.txt | 3 ++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c9c0a6fb8e..cc7fda7427 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -233,6 +233,16 @@ jobs: --file .\tests\requirements-windows.txt ^ ${{ env.CONDA_CHANNEL_LABEL }}::conda if %errorlevel% neq 0 exit 1 + # TEMPORARY + if "${{ matrix.python-version }}" == "3.8" ( + conda install https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py38hd3f51b4_1.conda + if %errorlevel% neq 0 exit 1 + ) + if "${{ matrix.python-version }}" == "3.11" ( + conda install https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py311h12c1d0e_1.conda + if %errorlevel% neq 0 exit 1 + ) + # /TEMPORARY pip install -e . --no-deps if %errorlevel% neq 0 exit 1 diff --git a/tests/requirements-linux.txt b/tests/requirements-linux.txt index 149ce09bad..54532fb819 100644 --- a/tests/requirements-linux.txt +++ b/tests/requirements-linux.txt @@ -1,3 +1,5 @@ patch patchelf shellcheck +# TEMP +conda-forge::menuinst >=2 diff --git a/tests/requirements-macos.txt b/tests/requirements-macos.txt index 133b191333..eb54d5eab3 100644 --- a/tests/requirements-macos.txt +++ b/tests/requirements-macos.txt @@ -1,2 +1,4 @@ patch shellcheck +# TEMP +conda-forge::menuinst >=2 diff --git a/tests/requirements.txt b/tests/requirements.txt index 75eb79cfad..8f3cfbc2f0 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,7 +4,8 @@ beautifulsoup4 chardet conda >=4.13 conda-forge::allure-pytest -conda-forge::menuinst >=2 +# Can't install on Windows because conda so far pins against menuinst<2 +# conda-forge::menuinst >=2 conda-index conda-package-handling conda-verify From 3c7c362d3f2e6978edf5177d8efe166142d7d3f3 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 20 Nov 2023 17:43:15 +0100 Subject: [PATCH 33/40] pre-commit --- tests/requirements-linux.txt | 4 ++-- tests/requirements-macos.txt | 4 ++-- tests/requirements.txt | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/requirements-linux.txt b/tests/requirements-linux.txt index 54532fb819..b1785e2c4f 100644 --- a/tests/requirements-linux.txt +++ b/tests/requirements-linux.txt @@ -1,5 +1,5 @@ +# TEMP +conda-forge::menuinst >=2 patch patchelf shellcheck -# TEMP -conda-forge::menuinst >=2 diff --git a/tests/requirements-macos.txt b/tests/requirements-macos.txt index eb54d5eab3..caa4235c84 100644 --- a/tests/requirements-macos.txt +++ b/tests/requirements-macos.txt @@ -1,4 +1,4 @@ -patch -shellcheck # TEMP conda-forge::menuinst >=2 +patch +shellcheck diff --git a/tests/requirements.txt b/tests/requirements.txt index 8f3cfbc2f0..3e230a6c24 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,11 +1,8 @@ -# NEW for menuinst validation anaconda-client beautifulsoup4 chardet conda >=4.13 conda-forge::allure-pytest -# Can't install on Windows because conda so far pins against menuinst<2 -# conda-forge::menuinst >=2 conda-index conda-package-handling conda-verify From 6a5ff450b50b73b023e19a220c56184afbd9ee4b Mon Sep 17 00:00:00 2001 From: jaimergp Date: Mon, 20 Nov 2023 18:43:42 +0100 Subject: [PATCH 34/40] rename to underscore --- .../menu.json | 0 .../meta.yaml | 0 tests/test_post.py | 12 ++++++------ 3 files changed, 6 insertions(+), 6 deletions(-) rename tests/test-recipes/metadata/{menu_json_validation => _menu_json_validation}/menu.json (100%) rename tests/test-recipes/metadata/{menu_json_validation => _menu_json_validation}/meta.yaml (100%) diff --git a/tests/test-recipes/metadata/menu_json_validation/menu.json b/tests/test-recipes/metadata/_menu_json_validation/menu.json similarity index 100% rename from tests/test-recipes/metadata/menu_json_validation/menu.json rename to tests/test-recipes/metadata/_menu_json_validation/menu.json diff --git a/tests/test-recipes/metadata/menu_json_validation/meta.yaml b/tests/test-recipes/metadata/_menu_json_validation/meta.yaml similarity index 100% rename from tests/test-recipes/metadata/menu_json_validation/meta.yaml rename to tests/test-recipes/metadata/_menu_json_validation/meta.yaml diff --git a/tests/test_post.py b/tests/test_post.py index 40b5145042..c15fffaf2a 100644 --- a/tests/test_post.py +++ b/tests/test_post.py @@ -98,8 +98,8 @@ def test_pypi_installer_metadata(testing_config): def test_menuinst_validation_ok(testing_config, caplog, tmp_path): "1st check - validation passes with recipe as is" - recipe = Path(metadata_dir, "menu_json_validation") - recipe_tmp = tmp_path / "menu_json_validation" + recipe = Path(metadata_dir, "_menu_json_validation") + recipe_tmp = tmp_path / "_menu_json_validation" shutil.copytree(recipe, recipe_tmp) with caplog.at_level(logging.INFO): @@ -114,8 +114,8 @@ def test_menuinst_validation_ok(testing_config, caplog, tmp_path): def test_menuinst_validation_fails_bad_schema(testing_config, caplog, tmp_path): "2nd check - valid JSON but invalid content fails validation" - recipe = Path(metadata_dir, "menu_json_validation") - recipe_tmp = tmp_path / "menu_json_validation" + recipe = Path(metadata_dir, "_menu_json_validation") + recipe_tmp = tmp_path / "_menu_json_validation" shutil.copytree(recipe, recipe_tmp) menu_json = recipe_tmp / "menu.json" menu_json_contents = menu_json.read_text() @@ -134,8 +134,8 @@ def test_menuinst_validation_fails_bad_schema(testing_config, caplog, tmp_path): def test_menuinst_validation_fails_bad_json(testing_config, caplog, tmp_path): "3rd check - non-parsable JSON fails validation" - recipe = Path(metadata_dir, "menu_json_validation") - recipe_tmp = tmp_path / "menu_json_validation" + recipe = Path(metadata_dir, "_menu_json_validation") + recipe_tmp = tmp_path / "_menu_json_validation" shutil.copytree(recipe, recipe_tmp) menu_json = recipe_tmp / "menu.json" menu_json_contents = menu_json.read_text() From 84b274953e6810ce48d324c2ac57e8e0cdc5347b Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 21 Nov 2023 09:09:09 +0100 Subject: [PATCH 35/40] use copy? --- tests/test-recipes/metadata/_menu_json_validation/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-recipes/metadata/_menu_json_validation/meta.yaml b/tests/test-recipes/metadata/_menu_json_validation/meta.yaml index fdd9924312..ac23805ec9 100644 --- a/tests/test-recipes/metadata/_menu_json_validation/meta.yaml +++ b/tests/test-recipes/metadata/_menu_json_validation/meta.yaml @@ -7,4 +7,4 @@ build: - mkdir -p "${PREFIX}/Menu" # [unix] - cp "${RECIPE_DIR}/menu.json" "${PREFIX}/Menu/menu_json_validation.json" # [unix] - md "%PREFIX%\\Menu" # [win] - - xcopy "%RECIPE_DIR%\\menu.json" "%PREFIX%\\Menu\\menu_json_validation.json" # [win] + - copy /y "%RECIPE_DIR%\\menu.json" "%PREFIX%\\Menu\\menu_json_validation.json" # [win] From 5a7ee7dccf11750e15e67843a9a37ca90be8b8e2 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 21 Nov 2023 15:39:30 +0100 Subject: [PATCH 36/40] debug --- .github/workflows/tests.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cc7fda7427..a858a9e551 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -226,25 +226,27 @@ jobs: - name: Setup environment shell: cmd /C CALL {0} run: | + @echo on + SetLocal EnableDelayedExpansion choco install visualstudio2017-workload-vctools - if %errorlevel% neq 0 exit 1 + if !errorlevel! neq 0 exit 1 conda install -q -y -c defaults ^ --file .\tests\requirements.txt ^ --file .\tests\requirements-windows.txt ^ ${{ env.CONDA_CHANNEL_LABEL }}::conda - if %errorlevel% neq 0 exit 1 + if !errorlevel! neq 0 exit 1 # TEMPORARY if "${{ matrix.python-version }}" == "3.8" ( - conda install https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py38hd3f51b4_1.conda - if %errorlevel% neq 0 exit 1 + conda install "https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py38hd3f51b4_1.conda" + if !errorlevel! neq 0 exit 1 ) if "${{ matrix.python-version }}" == "3.11" ( - conda install https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py311h12c1d0e_1.conda - if %errorlevel% neq 0 exit 1 + conda install "https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py311h12c1d0e_1.conda" + if !errorlevel! neq 0 exit 1 ) # /TEMPORARY pip install -e . --no-deps - if %errorlevel% neq 0 exit 1 + if !errorlevel! neq 0 exit 1 - name: Show info run: | From f779ae4c5905a0289d155d8926e72d0174790136 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 21 Nov 2023 16:06:11 +0100 Subject: [PATCH 37/40] gotta use CALL in 'conda' for CMD --- .github/workflows/tests.yml | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a858a9e551..e022390d90 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -227,26 +227,16 @@ jobs: shell: cmd /C CALL {0} run: | @echo on - SetLocal EnableDelayedExpansion - choco install visualstudio2017-workload-vctools - if !errorlevel! neq 0 exit 1 - conda install -q -y -c defaults ^ + CALL choco install visualstudio2017-workload-vctools || exit 1 + CALL conda install -q -y -c defaults ^ --file .\tests\requirements.txt ^ --file .\tests\requirements-windows.txt ^ - ${{ env.CONDA_CHANNEL_LABEL }}::conda - if !errorlevel! neq 0 exit 1 + ${{ env.CONDA_CHANNEL_LABEL }}::conda || exit 1 # TEMPORARY - if "${{ matrix.python-version }}" == "3.8" ( - conda install "https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py38hd3f51b4_1.conda" - if !errorlevel! neq 0 exit 1 - ) - if "${{ matrix.python-version }}" == "3.11" ( - conda install "https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py311h12c1d0e_1.conda" - if !errorlevel! neq 0 exit 1 - ) + if "${{ matrix.python-version }}" == "3.8" CALL conda install "https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py38hd3f51b4_1.conda" || exit 1 + if "${{ matrix.python-version }}" == "3.11" CALL conda install "https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py311h12c1d0e_1.conda" || exit 1 # /TEMPORARY - pip install -e . --no-deps - if !errorlevel! neq 0 exit 1 + CALL pip install -e . --no-deps || exit 1 - name: Show info run: | From 122f5f780c082497a7d59cd13573b1965f4df0a6 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Tue, 21 Nov 2023 16:22:53 +0100 Subject: [PATCH 38/40] fix comment syntax --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e022390d90..5fcaf26458 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -232,10 +232,10 @@ jobs: --file .\tests\requirements.txt ^ --file .\tests\requirements-windows.txt ^ ${{ env.CONDA_CHANNEL_LABEL }}::conda || exit 1 - # TEMPORARY + :: TEMPORARY if "${{ matrix.python-version }}" == "3.8" CALL conda install "https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py38hd3f51b4_1.conda" || exit 1 if "${{ matrix.python-version }}" == "3.11" CALL conda install "https://anaconda.org/conda-forge/menuinst/2.0.0/download/win-64/menuinst-2.0.0-py311h12c1d0e_1.conda" || exit 1 - # /TEMPORARY + :: /TEMPORARY CALL pip install -e . --no-deps || exit 1 - name: Show info From 8be5448d92318730dd5401e353871e1da38731f7 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 22 Nov 2023 11:09:43 +0100 Subject: [PATCH 39/40] add docstring --- conda_build/post.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/conda_build/post.py b/conda_build/post.py index d1fae941c6..cbbfc05462 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1732,7 +1732,18 @@ def fix_permissions(files, prefix): log.warn(str(e)) -def check_menuinst_json(files, prefix): +def check_menuinst_json(files, prefix) -> None: + """ + Check that Menu/*.json files are valid menuinst v2 JSON documents, + as defined by the CEP-11 schema. This JSON schema is part of the `menuinst` + package. + + Validation can fail if the menu/*.json file is not valid JSON, or if it doesn't + comply with the menuinst schema. + + We validate at build-time so we don't have to validate at install-time, saving + `conda` a few dependencies. + """ json_files = fnmatch_filter(files, "[Mm]enu[/\\]*.[Jj][Ss][Oo][Nn]") if not json_files: return From dd949a9936e621d80d3b358090706dee8105a7ce Mon Sep 17 00:00:00 2001 From: jaimergp Date: Wed, 22 Nov 2023 11:12:32 +0100 Subject: [PATCH 40/40] lowercase match --- conda_build/post.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_build/post.py b/conda_build/post.py index cbbfc05462..018c1f7e58 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -1744,7 +1744,7 @@ def check_menuinst_json(files, prefix) -> None: We validate at build-time so we don't have to validate at install-time, saving `conda` a few dependencies. """ - json_files = fnmatch_filter(files, "[Mm]enu[/\\]*.[Jj][Ss][Oo][Nn]") + json_files = fnmatch_filter(files, "[Mm][Ee][Nn][Uu][/\\]*.[Jj][Ss][Oo][Nn]") if not json_files: return