From d4a35e96890a811688e218c0fa0a683915e8a40b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:54:14 -0800 Subject: [PATCH 1/4] Bump codecov/codecov-action from 5.0.2 to 5.0.7 in /.github/workflows (#902) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.0.2 to 5.0.7. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/5c47607acb93fed5485fdbf7232e8a31425f672a...015f24e6818733317a2da2edd6290ab26238649a) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cd549eafe..1d3f231df 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -137,7 +137,7 @@ jobs: pytest -vv --cov=constructor --cov-branch tests/ -m "not examples" coverage run --branch --append -m constructor -V coverage json - - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 + - uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unit @@ -155,7 +155,7 @@ jobs: pytest -vv --cov=constructor --cov-branch tests/test_examples.py coverage run --branch --append -m constructor -V coverage json - - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 + - uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 with: token: ${{ secrets.CODECOV_TOKEN }} flags: integration From d85133decbc713ea6bc13359bb479c3bcf90c0fa Mon Sep 17 00:00:00 2001 From: Marco Esters Date: Thu, 28 Nov 2024 06:45:54 -0800 Subject: [PATCH 2/4] Render post-install pages for Windows when input is a string (#904) --- constructor/winexe.py | 9 ++++++--- examples/exe_extra_pages/construct.yaml | 11 ++++++++++- news/904-post-install-pages-win-fix | 19 +++++++++++++++++++ tests/test_examples.py | 5 ++++- 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 news/904-post-install-pages-win-fix diff --git a/constructor/winexe.py b/constructor/winexe.py index 16d42304c..74cf2e4da 100644 --- a/constructor/winexe.py +++ b/constructor/winexe.py @@ -365,9 +365,12 @@ def make_nsi( if variables['custom_conclusion'] else '' ) - variables['POST_INSTALL_PAGES'] = '\n'.join( - custom_nsi_insert_from_file(file) for file in info.get('post_install_pages', []) - ) + if isinstance(info.get("post_install_pages"), str): + variables["POST_INSTALL_PAGES"] = custom_nsi_insert_from_file(info["post_install_pages"]) + else: + variables['POST_INSTALL_PAGES'] = '\n'.join( + custom_nsi_insert_from_file(file) for file in info.get('post_install_pages', []) + ) variables['TEMP_EXTRA_FILES'] = '\n '.join(insert_tempfiles_commands(temp_extra_files)) variables['VIRTUAL_SPECS'] = " ".join([f'"{spec}"' for spec in info.get("virtual_specs", ())]) # This is the same but without quotes so we can print it fine diff --git a/examples/exe_extra_pages/construct.yaml b/examples/exe_extra_pages/construct.yaml index 95b649bf4..a7987b4e9 100644 --- a/examples/exe_extra_pages/construct.yaml +++ b/examples/exe_extra_pages/construct.yaml @@ -1,10 +1,19 @@ -name: extraPages +{% if os.environ.get("POST_INSTALL_PAGES_LIST") %} +{% set name = "extraPages" %} +{% else %} +{% set name = "extraPageSingle" %} +{% endif %} +name: {{ name }} version: X installer_type: all channels: - http://repo.anaconda.com/pkgs/main/ specs: - python +{% if os.environ.get("POST_INSTALL_PAGES_LIST") %} post_install_pages: - extra_page_1.nsi - extra_page_2.nsi +{% else %} +post_install_pages: extra_page_1.nsi +{% endif %} diff --git a/news/904-post-install-pages-win-fix b/news/904-post-install-pages-win-fix new file mode 100644 index 000000000..40d2a879e --- /dev/null +++ b/news/904-post-install-pages-win-fix @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* Correctly parse post-install pages for Windows when input is a string. (#904) + +### Deprecations + +* + +### Docs + +* + +### Other + +* diff --git a/tests/test_examples.py b/tests/test_examples.py index f16200f44..0fd099a19 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -378,8 +378,11 @@ def test_example_customized_welcome_conclusion(tmp_path, request): _run_installer(input_path, installer, install_dir, request=request) +@pytest.mark.parametrize("extra_pages", ("str", "list")) @pytest.mark.skipif(sys.platform != "win32", reason="Windows only") -def test_example_extra_pages_win(tmp_path, request): +def test_example_extra_pages_win(tmp_path, request, extra_pages, monkeypatch): + if extra_pages == "list": + monkeypatch.setenv("POST_INSTALL_PAGES_LIST", "1") input_path = _example_path("exe_extra_pages") for installer, install_dir in create_installer(input_path, tmp_path): _run_installer(input_path, installer, install_dir, request=request) From b0a37b568ac7c939c8a43a7c20b4841ef34cf068 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 08:42:18 -0800 Subject: [PATCH 3/4] [pre-commit.ci] pre-commit autoupdate (#906) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/python-jsonschema/check-jsonschema: 0.29.4 → 0.30.0](https://github.com/python-jsonschema/check-jsonschema/compare/0.29.4...0.30.0) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b027b6f6..fd4c3cc68 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -36,6 +36,6 @@ repos: - id: shellcheck exclude: ^(constructor/header.sh|constructor/osx/.*sh) - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.29.4 + rev: 0.30.0 hooks: - id: check-github-workflows From 0710405fe38006940ae5ed422cf856db960026b0 Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 5 Dec 2024 18:50:22 +0100 Subject: [PATCH 4/4] Fix `channels_remap` and add regression test for percent-encoded packages (#909) * add test * patch gha workflow (TMP) * mock version * install from remap branch, do not test py38 * debug with CLS 24.9 * revert this debug block * more debugging * Treat http:// and https:// as equivalent * add slash to channel urls during replacement in case input had slashes too * add news * skip conda-libmamba-solver=24.11.0 --- .github/workflows/main.yml | 20 ++++++++------------ constructor/utils.py | 25 +++++++++++++++++++++++-- examples/regressions/construct.yaml | 17 +++++++++++++++++ news/909-cls-compat | 20 ++++++++++++++++++++ recipe/meta.yaml | 1 + tests/test_examples.py | 13 +++++++++++++ 6 files changed, 82 insertions(+), 14 deletions(-) create mode 100644 examples/regressions/construct.yaml create mode 100644 news/909-cls-compat diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d3f231df..27544258d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,10 +39,6 @@ jobs: matrix: include: # UBUNTU - - os: ubuntu-latest - python-version: "3.8" - conda-standalone: conda-standalone - check-docs: true - os: ubuntu-latest python-version: "3.9" conda-standalone: conda-standalone @@ -58,12 +54,9 @@ jobs: conda-standalone: conda-standalone # MACOS - os: macos-13 - python-version: "3.8" + python-version: "3.9" conda-standalone: conda-standalone-nightly - # Not running for 3.9, 3.10 to save some CI resources - # - os: macos - # python-version: "3.9" - # conda-standalone: conda-standalone + # Not running for 3.10 to save some CI resources # - os: macos-13 # python-version: "3.10" # conda-standalone: micromamba @@ -74,9 +67,6 @@ jobs: python-version: "3.12" conda-standalone: micromamba # WINDOWS - - os: windows-latest - python-version: "3.8" - conda-standalone: conda-standalone - os: windows-latest python-version: "3.9" conda-standalone: conda-standalone-nightly @@ -132,6 +122,12 @@ jobs: conda activate constructor-dev echo "CONSTRUCTOR_CONDA_EXE=$CONDA_PREFIX/standalone_conda/conda.exe" >> $GITHUB_ENV fi + - name: conda info + run: conda info + - name: conda list + run: conda list + - name: conda config + run: conda config --show-sources - name: Run unit tests run: | pytest -vv --cov=constructor --cov-branch tests/ -m "not examples" diff --git a/constructor/utils.py b/constructor/utils.py index 730ea47e3..4b2c6352a 100644 --- a/constructor/utils.py +++ b/constructor/utils.py @@ -178,14 +178,35 @@ def ensure_transmuted_ext(info, url): def get_final_url(info, url): mapping = info.get('channels_remap', []) + if not url.lower().endswith((".tar.bz2", ".conda", "/")): + url += "/" + added_slash = True + else: + added_slash = False for entry in mapping: src = entry['src'] dst = entry['dest'] - if url.startswith(src): - new_url = url.replace(src, dst) + # Treat http:// and https:// as equivalent + if src.startswith("http"): + srcs = tuple( + dict.fromkeys( + [ + src.replace("http://", "https://"), + src.replace("https://", "http://") + ] + ) + ) + else: + srcs = (src,) + if url.startswith(srcs): + new_url = url + for src in srcs: + new_url = new_url.replace(src, dst) if url.endswith(".tar.bz2"): logger.warning("You need to make the package %s available " "at %s", url.rsplit('/', 1)[1], new_url) + if added_slash: + new_url = new_url[:-1] return new_url return url diff --git a/examples/regressions/construct.yaml b/examples/regressions/construct.yaml new file mode 100644 index 000000000..ceda1fd05 --- /dev/null +++ b/examples/regressions/construct.yaml @@ -0,0 +1,17 @@ +name: regressions + +version: 0.0.1 + +keep_pkgs: True + +channels: + - conda-forge + +specs: + - x264 # check https://github.com/conda/constructor/issues/908 + +initialize_by_default: false +register_python: false +check_path_spaces: false +check_path_length: false +installer_type: all diff --git a/news/909-cls-compat b/news/909-cls-compat new file mode 100644 index 000000000..832510317 --- /dev/null +++ b/news/909-cls-compat @@ -0,0 +1,20 @@ +### Enhancements + +* + +### Bug fixes + +* `channels_remap` is now insensitive to `http` vs `https`, and trailing slashes. (#909) +* Add a regression test for packages including percent-encodable characters in their filenames. (#908 via #909) + +### Deprecations + +* + +### Docs + +* + +### Other + +* Do not run CI against Python 3.8. (#909) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index e89e93a27..1fda791f2 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -28,6 +28,7 @@ requirements: - nsis >=3.08 # [win] run_constrained: # [unix] - nsis >=3.08 # [unix] + - conda-libmamba-solver !=24.11.0 test: source_files: diff --git a/tests/test_examples.py b/tests/test_examples.py index 0fd099a19..c0a744783 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -911,3 +911,16 @@ def test_ignore_condarc_files(tmp_path, monkeypatch, request): # the bogus .condarc file. # pkg installers unfortunately do not output any errors into the log. assert proc.stderr.count("Bad conversion of configurable") == 4 + + +def test_regressions(tmp_path, request): + input_path = _example_path("regressions") + for installer, install_dir in create_installer(input_path, tmp_path): + _run_installer( + input_path, + installer, + install_dir, + request=request, + check_subprocess=True, + uninstall=True, + )