Skip to content

fix for dotnet hooks with prefixes#2641

Merged
asottile merged 1 commit intopre-commit:mainfrom
rkm:fix/dotnet-tool-prefix
Dec 21, 2022
Merged

fix for dotnet hooks with prefixes#2641
asottile merged 1 commit intopre-commit:mainfrom
rkm:fix/dotnet-tool-prefix

Conversation

@rkm
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@rkm rkm force-pushed the fix/dotnet-tool-prefix branch from 46af90f to 909f1b3 Compare December 19, 2022 19:18
@rkm rkm requested a review from asottile December 19, 2022 22:50
@asottile asottile force-pushed the fix/dotnet-tool-prefix branch from 909f1b3 to e904628 Compare December 21, 2022 18:35
Copy link
Copy Markdown
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