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

upip numerical version extention #358

Closed
wants to merge 10 commits into from

Conversation

Stephan-kashkarov
Copy link

I have written the functionality to provide a numerical package version according to PEP508 and PEP440. I have not implemented letter based versioning systems such as >=1.2.5rc5 but versions can have infinite subversions. The implemented operators include >, >=, <, <=, ==, ~=, ===, !=. Extra arguments are dumped as I am unsure how meta tags for upython are handled, i.e. upip install example;python_version<"2.7". Wildcard characters are also included. Thanks for looking at this pull request

@Stephan-kashkarov Stephan-kashkarov marked this pull request as ready for review November 25, 2019 10:25
@Stephan-kashkarov
Copy link
Author

Not tested in micropython but tested in python3.7 on a per-function basis. I have not tested the wildcard support however

"""
Parse Version

This function takes a string and gets all versioning infromation for
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

Typo

Suggested change
This function takes a string and gets all versioning infromation for
This function takes a string and gets all versioning information for


def ver_list_cmp(list1, list2):
"""
version list compaire
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

Suggested change
version list compaire
version list compare

This function takes a string and gets all versioning infromation for
pypi according to PEP508 and PEP440

Written by: Stephan Kashkarov 2019
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

Attribution probably shouldn't be in a method; perhaps best to insert the common MIT header used in a lot of the MicroPython source - it can contain a list of contributors. See pyboard.py for an example.

returns -1 if list zero is larger and 1 list one is larger
otherwise the function will return 0

Written by: Stephan Kashkarov 2019
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

See above

@@ -243,6 +249,113 @@ def cleanup():
except OSError:
print("Warning: Cannot delete " + fname)

def parse_version(string):
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

Should probably have unit tests around this method. I may be able to help there...
Also, consider changing the variable string since it's very generic. Perhaps version_string?

I'll try and test this (on the unix and ESP32 ports) soon. I've also only had a superficial glance over the parsing logic; will try to understand it better.

pkg['version'] = max(versions)
return pkg, data

def ver_list_cmp(list1, list2):
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

Again, unit testing this would be relatively straightforward and beneficial!
Also, I believe that if you used tuples then the built-in tuple comparisons will work correctly. Haven't yet validated that though...

@@ -268,7 +381,7 @@ def main():
help()
return

if sys.argv[1] != "install":
if sys.argv[1] not in ["install"]:
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

I think the original is more readable. The 'not in' form is great for testing if an item is in a collection but that's not the case here.

@jimmo
Copy link
Member

jimmo commented Jul 21, 2023

Thanks @Stephan-kashkarov -- since this PR was raised, upip has been removed and replaced with mip which has much simpler handling of package versions.

@jimmo jimmo closed this Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants