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, + )