Skip to content

Commit

Permalink
Merge branch 'uninstall-standalone' of github.com:marcoesters/constru…
Browse files Browse the repository at this point in the history
…ctor into uninstall-standalone
  • Loading branch information
marcoesters committed Dec 5, 2024
2 parents d3ed416 + 4ed7cb0 commit c8ee571
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 22 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -132,12 +122,18 @@ 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"
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
Expand All @@ -155,7 +151,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
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 23 additions & 2 deletions constructor/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 6 additions & 3 deletions constructor/winexe.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,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
Expand Down
11 changes: 10 additions & 1 deletion examples/exe_extra_pages/construct.yaml
Original file line number Diff line number Diff line change
@@ -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 %}
17 changes: 17 additions & 0 deletions examples/regressions/construct.yaml
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions news/904-post-install-pages-win-fix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Correctly parse post-install pages for Windows when input is a string. (#904)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
20 changes: 20 additions & 0 deletions news/909-cls-compat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
### Enhancements

* <news item>

### 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

* <news item>

### Docs

* <news item>

### Other

* Do not run CI against Python 3.8. (#909)
1 change: 1 addition & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 17 additions & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,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)
Expand Down Expand Up @@ -998,3 +1001,16 @@ def test_uninstallation_standalone(
finally:
if system_rc.parent.exists():
shutil.rmtree(system_rc.parent)


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

0 comments on commit c8ee571

Please sign in to comment.