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

fix for dotnet hooks with prefixes #2641

Merged
merged 1 commit into from
Dec 21, 2022

Conversation

rkm
Copy link
Contributor

@rkm rkm commented Dec 12, 2022

(Recreated from #2630)

Fixes #2629

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)
Copy link
Member

Choose a reason for hiding this comment

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

this seems fragile -- can we read the name out of the metadata itself? or install the .nupkg file directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've committed a version which reads the xml from the nupkg (zip file), but it needs tidied up a bit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There might be a way to simplify it, but this version seems to work.

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

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

@asottile asottile merged commit bce513f into pre-commit:main Dec 21, 2022
@rkm rkm deleted the fix/dotnet-tool-prefix branch December 22, 2022 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

dotnet install fails for prefixed packages
2 participants