fix for dotnet hooks with prefixes#2641
Merged
asottile merged 1 commit intopre-commit:mainfrom Dec 21, 2022
Merged
Conversation
asottile
reviewed
Dec 12, 2022
pre_commit/languages/dotnet.py
Outdated
Comment on lines
+62
to
+70
| # https://learn.microsoft.com/en-us/nuget/concepts/package-versioning#version-basics | ||
| tool_name_re = re.compile(r'(.*)\.\d+\.\d+\.\d+(-.*)?\.nupkg') | ||
|
|
||
| build_outputs = os.listdir(os.path.join(prefix.prefix_dir, build_dir)) | ||
| for output in build_outputs: | ||
| tool_name = output.split('.')[0] | ||
|
|
||
| tool_name_match = tool_name_re.match(output) | ||
| assert tool_name_match | ||
| tool_name = tool_name_match.group(1) |
Member
There was a problem hiding this comment.
this seems fragile -- can we read the name out of the metadata itself? or install the .nupkg file directly?
Contributor
Author
There was a problem hiding this comment.
I've committed a version which reads the xml from the nupkg (zip file), but it needs tidied up a bit
Contributor
Author
There was a problem hiding this comment.
There might be a way to simplify it, but this version seems to work.
46af90f to
909f1b3
Compare
909f1b3 to
e904628
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.

(Recreated from #2630)
Fixes #2629