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

Fixed regex for matching versions #253

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

JohanMabille
Copy link
Member

No description provided.

@JohanMabille JohanMabille added the bug Something isn't working label Dec 10, 2024
Copy link
Member

@Klaim Klaim left a comment

Choose a reason for hiding this comment

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

(for context, related to mamba-org/mamba#3638 )

Copy link
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

Let's add tests?

src/options.ts Outdated
@@ -295,7 +295,7 @@ export const getOptions = () => {
),
micromambaVersion: parseOrUndefined(
'micromamba-version',
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+-\d+$/)]),
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]),
Copy link
Member

Choose a reason for hiding this comment

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

To match PEP440 version numbers of release candidates, alphas, and betas (for instance 2.0.0rc0):

Suggested change
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]),
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d+)?-\d+$/)]),

Copy link
Member Author

@JohanMabille JohanMabille Dec 10, 2024

Choose a reason for hiding this comment

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

This does not work. I think it's rather ^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d*)?-\d+$ (yes, I let you find the single character I had to change :D)

My bad, I entered wrong matches.

Copy link
Member

Choose a reason for hiding this comment

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

Let's go. :)

Suggested change
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]),
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d*)?-\d+$/)]),

src/options.ts Outdated
@@ -295,7 +295,7 @@ export const getOptions = () => {
),
micromambaVersion: parseOrUndefined(
'micromamba-version',
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+-\d+$/)]),
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]),
Copy link
Member

Choose a reason for hiding this comment

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

Should we add dev as well since it was added here?

Copy link
Member

@pavelzw pavelzw left a comment

Choose a reason for hiding this comment

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

could you also bump

"version": "2.0.2",
accordingly?

Copy link
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

Thank you, @JohanMabille.

@JohanMabille JohanMabille merged commit 068f1ab into mamba-org:main Dec 10, 2024
64 checks passed
@JohanMabille JohanMabille deleted the versionning branch December 10, 2024 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants