Skip to content

doc: explain which parts of a custom manifest PyInstaller changes - #9531

Merged
rokm merged 3 commits into
pyinstaller:developfrom
ethanstoner:doc/manifest-uac-note
Sep 27, 2026
Merged

rokm merged 3 commits into
pyinstaller:developfrom
ethanstoner:doc/manifest-uac-note

Conversation

@ethanstoner

Copy link
Copy Markdown
Contributor

Closes #9341

A manifest passed with --manifest is only a starting point. create_application_manifest() in PyInstaller/utils/win32/winmanifest.py always rewrites two things in it:

  • _set_execution_level() sets level on <requestedExecutionLevel> to requireAdministrator if uac_admin is true and asInvoker otherwise, and sets uiAccess from uac_uiaccess. Missing parent elements get created.
  • _ensure_common_controls_dependency() finds the Microsoft.Windows.Common-Controls dependency and sets it to version 6.0.0.0. If there isn't one, it adds it.

So a custom manifest asking for requireAdministrator builds an asInvoker executable unless --uac-admin is also passed, which is what the issue ran into. None of this was documented.

As rokm suggested in the thread, this PR:

  • extends the --manifest help text in makespec.py, which also generates the usage page
  • adds a short "The Application Manifest on Windows" section to doc/spec-files.rst, just before the macOS bundle section. It covers what manifest= accepts, the built-in default manifest when none is given, the two changes above, and says to use --uac-admin / uac_admin=True instead of editing requestedExecutionLevel

I ran a custom manifest through create_application_manifest() to confirm the behavior. It had requireAdministrator, a dpiAware setting and no Common-Controls entry. The output had asInvoker, the same dpiAware setting and a new Common-Controls 6.0.0.0 dependency. With uac_admin=True the output had requireAdministrator.

make clean && make html in doc/ finishes with no warnings, both before and after this change. I checked the rendered --manifest entry on the usage page and the new spec-files section, and the :option: cross-references resolve. flake8 and yapf --diff are clean on makespec.py.

Generated with Claude Code on behalf of @ethanstoner.

A manifest passed with --manifest is used as a base, but its
<requestedExecutionLevel> is always set from --uac-admin and
--uac-uiaccess (asInvoker and uiAccess="false" when those options are
not used), and a Microsoft.Windows.Common-Controls 6.0.0.0 dependency
is added or updated. A manifest asking for requireAdministrator
therefore ends up with asInvoker unless --uac-admin is also given.

Mention this in the --manifest help text (which also generates the
usage docs), and add a section to the spec file docs describing the
default manifest and the two modifications, as outlined in pyinstaller#9341.

@rokm rokm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While I have very mixed feelings about the recent uptick of LLM-generated PRs (perhaps it's time to set an official policy so that we can act on it in consistent way?), this one looks decent enough to me.

Comment thread doc/spec-files.rst Resolved
Comment thread doc/spec-files.rst Resolved
Comment thread doc/spec-files.rst Resolved
Comment thread doc/spec-files.rst Resolved
Comment thread doc/spec-files.rst Resolved
Comment thread doc/spec-files.rst Resolved
Link "application manifest", "longPathAware", "<requestedExecutionLevel>"
and "dependency" to the corresponding parts of the Microsoft application
manifest documentation, rename the section to "The Windows Application
Manifest", and drop the unused reference label.
@rokm
rokm merged commit 6adbc6e into pyinstaller:develop Sep 27, 2026
48 checks passed
@rokm

rokm commented Sep 27, 2026

Copy link
Copy Markdown
Member

Thanks!

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manifest With "requireAdministrator" Doesn't Require Administrator

2 participants