zerovm / zpm

ZeroVM Package Manager
Apache License 2.0
6 stars 11 forks source link

Allow specifying minimum zpm version in zapp.yaml #144

Open mgeisler opened 10 years ago

mgeisler commented 10 years ago

I think it would be useful if a zapp.yaml file could specify the minimum version of zpm that it requires. Something like

zpm-version: "0.2"

That is, a new top-level zpm-version key with a string. Should a float be present instead of a string, we might can either complain or turn it into a string. Complaining is probably best: in Python 2.7 we could do repr(f) and get back the string entered by the user in the YAML file (due to how repr now returns the shortest string representation of a float, Issue1580), but this doens't work on Python 2.6. There, "0.1" is parsed into a float that is slightly larger than 0.1 due to how binary floating point works. Basically, repr(float('0.2')) is not '0.2' in Python 2.6, but is '0.2' in Python 2.7 and later.

The version number should probably be compared using LooseVersion from distutils. Since we control the version number here, we could also use the StrictVersion class, but I think it adds a lot of extra unnecessary rules. An alternative is setuptool's parse_version function, which also has the extra rules from StrictVersion.