Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render post-install pages for Windows when input is a string #904

Merged
merged 7 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions constructor/winexe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 %}
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>
5 changes: 4 additions & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading