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

only insert custom_conclusion if the file ends in .nsi #701

Merged
merged 5 commits into from
Jul 24, 2023
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
5 changes: 4 additions & 1 deletion constructor/nsis/main.nsi.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,13 @@ Page Custom mui_AnaCustomOptions_Show
!define MUI_FINISHPAGE_TEXT __CONCLUSION_TEXT__
#endif

#if custom_conclusion
# Custom conclusion file(s)
@CUSTOM_CONCLUSION_FILE@

#else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty fundamental change. To restore old behavior, our custom conclusion files will have to add !insertmacro MUI_PAGE_FINISH, correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, that was always the intention IIRC, but this sneaked in. Otherwise you can't replace the last page (like the example tries to do), and you get two "Finish" pages which feels weird.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two finish pages may be desirable from a marketing perspective, but I do agree that we shouldn't force a default page. I'm all for more flexibility

!insertmacro MUI_PAGE_FINISH
#endif


!insertmacro MUI_UNPAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE un.OnDirectoryLeave
Expand Down
25 changes: 22 additions & 3 deletions constructor/winexe.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ def make_nsi(info, dir_path, extra_files=None, temp_extra_files=None):
# for the newlines business
replace['CONCLUSION_TEXT'] = "\r\n".join(conclusion_lines[1:])

for key in ['welcome_file', 'conclusion_file']:
value = info.get(key, "")
if value and not value.endswith(".nsi"):
logger.warning(
"On Windows, %s must be a .nsi file; %s will be ignored.",
key,
value,
)

for key, value in replace.items():
if value.startswith('@'):
value = join(dir_path, value[1:])
Expand Down Expand Up @@ -323,9 +332,19 @@ def make_nsi(info, dir_path, extra_files=None, temp_extra_files=None):
'${NAME} ${VERSION} (Python ${PYVERSION} ${ARCH})'
)),
('@EXTRA_FILES@', '\n '.join(extra_files_commands(extra_files, dir_path))),
('@CUSTOM_WELCOME_FILE@', custom_nsi_insert_from_file(info.get('welcome_file', ''))),
('@CUSTOM_CONCLUSION_FILE@', custom_nsi_insert_from_file(info.get('conclusion_file', ''))),
('@TEMP_EXTRA_FILES@', '\n '.join(insert_tempfiles_commands(temp_extra_files)))
(
'@CUSTOM_WELCOME_FILE@',
custom_nsi_insert_from_file(info.get('welcome_file', ''))
if ppd['custom_welcome']
else ''
),
(
'@CUSTOM_CONCLUSION_FILE@',
custom_nsi_insert_from_file(info.get('conclusion_file', ''))
if ppd['custom_conclusion']
else ''
),
('@TEMP_EXTRA_FILES@', '\n '.join(insert_tempfiles_commands(temp_extra_files))),
]:
data = data.replace(key, value)

Expand Down
19 changes: 19 additions & 0 deletions news/701-conclusion-file-windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* On Windows installers, only insert `conclusion_file` if the extension is `.nsi`. Ignore otherwise. Also prevents a double final page. (#700 via #701)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>