-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add semver comparrison #201
Conversation
Usage:
|
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.
This looks good so far.
-
I don't think we want an exception. I would like the result to be silent and just return an exit code of 1 if the version match fails and 0 if it succeeds. This makes it easy to use from a bash script (see example in next point)
-
I would like to also be able to compare two strings so i could do something like:
if ! ibek version below "$BASE" "7.0.8" ; then # do something relevant to epics base 7.0.8 and above fi
You could use the logic that single arg means compare with my own version or have different function names for comparing. Or maybe an option to declare that you are comparing against ibeks own version.
-
In the above example script I used what I believe to be the most common scenario. Doing something if a version is greater or equal than a specific point at which a feature was implemented. I had to negate 'below' to do that - should we consider a different scheme where 'greater that or equal' and 'less than or equal' are the two operators??
Hows something like:
|
Have you considered copying pip's requirements specifier syntax rather than "below", "above", etc.? https://pip.pypa.io/en/stable/reference/requirement-specifiers/ You could have a command that takes a package and a specifier that covers all cases, e.g. I think checking ibek itself might be better as a separate command. |
Thanks @GDYendell. Was just to get something simple out quickly to discuss really. Your proposal makes sense. Because of "Use quotes around specifiers in the shell when using >, <, or when using environment markers" I believe your proposal would actually be Agree "checking ibek itself might be better as a separate command" |
baf66e4
to
d4978ef
Compare
@gilesknap Thoughts?
|
Yes very happy with that - now the question is how to do ibek itself.
Too ugly? @GDYendell? |
BTW I assume with this syntax you will support >= >= == too ? Or maybe all of these ? https://pip.pypa.io/en/stable/reference/requirement-specifiers/#examples |
Right now I have Lines 10 to 16 in db28c9e
|
I think this is OK. I like it more than |
Like it ! |
Add compare command Add pip type compare command Linting Add fail test
0b93dae
to
9026476
Compare
Thoughts @gilesknap?