operations.util.packaging: Extend PkgInfo for winget#1447
Merged
Fizzadar merged 2 commits intopyinfra-dev:3.xfrom Sep 16, 2025
Merged
operations.util.packaging: Extend PkgInfo for winget#1447Fizzadar merged 2 commits intopyinfra-dev:3.xfrom
Fizzadar merged 2 commits intopyinfra-dev:3.xfrom
Conversation
Fizzadar
reviewed
Sep 11, 2025
Member
Fizzadar
left a comment
There was a problem hiding this comment.
Big fan of using this in other packages, think extending here is a great call.
6767ca7 to
dc70773
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
I'm hoping to utilize the existing
ensure_packagesutility in `pyinfra-windows'.The utility currently makes some assumptions that don't work with
winget. Namely, that all package managers support the following syntax:apt install package1=version1 package2=version2 # does not work in winget winget install package1=version1 package2=version2You must do the following:
This PR introduces
Pkginfo.inst_vers_templateto customize the creationPkgInfo.inst_vers.The default template works from programs that support the
{name}{operator}{version}syntax.winget overides the template to do
'{name} {operator} {version};'.format("winget install Notepad++.Notepad++", "—version", "8.5")Notes
This PR does change the
shlex.quotebehavior slightly, and I have left the failing tests for now.Do you think this new quoting behavior is ok?
If you don't want to support this here, I totally understand. I will duplicate some of the code.
3.xat this time)scripts/dev-test.sh)scripts/dev-lint.sh)