-
Notifications
You must be signed in to change notification settings - Fork 282
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
Added extract_regex_match
function and updated NuGetProvider
#1418
Conversation
I tested locally with the Japanese localization. Please confirm it is OK. |
b967d9e
to
461e478
Compare
A new function `extract_regex_match` has been added to the `vcpkg` namespace in `tools.cpp`. This function performs a regex search on an output string and returns the first match or a formatted error message. The `NuGetProvider` struct has been updated to replace the `extract_prefixed_nonwhitespace` function call with the new `extract_regex_match` function. This change enhances the flexibility and robustness of version extraction by using a regex match instead of a fixed prefix.
461e478
to
54e563b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole reason extract_prefixed_nonwhitespace
exists is that we are trying to break the dependency on std::regex
because all major implementations of that are awful. Only the 'fake XML parsing' thing still uses it, and that entire component's days are numbered as there is no longer any reason to have a separate vcpkgTools.xml
now that the bash bootstrap script no longer looks at it.
Can you write code that implements this instead and a comment with the example non-English output with which it is expected to work?
Alternately, should we be telling NuGet we want locale-independent output for this test somehow?
Thank you. The issue this pull request tries to resolve is nuget.exe's output is now locale-dependent and no longer has a fixed prefix. A sample is Possible alternatives would be either
Which one is better? |
I found the |
Setting the |
It works for me:
|
Hmm, you used the |
Rewrote this PR in #1451. |
Thanks! |
A new function
extract_regex_match
has been added to thevcpkg
namespace intools.cpp
. This function performs a regex search on an output string and returns the first match or a formatted error message.The
NuGetProvider
struct has been updated to replace theextract_prefixed_nonwhitespace
function call with the newextract_regex_match
function. This change enhances the flexibility and robustness of version extraction by using a regex match instead of a fixed prefix.Fixes microsoft/vcpkg#38940