Mercurial > hg-stable
changeset 43113:37af48031d6f
hghave: document format for version feature checks as <name><vers>, no dots
I had a bit of a difficult time when attempting to fix a use of `py-38` when
trying to figure out what the correct way of specifying the feature was. By
having the strings 'py-3*' and 'py3.8' in the hghave.checkvers docstring, I
would have had a much easier time of it instead of having to trace exactly what
was happening here.
Differential Revision: https://phab.mercurial-scm.org/D7023
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Tue, 08 Oct 2019 10:40:36 -0700 |
parents | 24a07347aa60 |
children | 8197b395710e |
files | tests/hghave.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Fri Feb 02 10:13:42 2018 -0800 +++ b/tests/hghave.py Tue Oct 08 10:40:36 2019 -0700 @@ -60,7 +60,11 @@ def checkvers(name, desc, vers): """Registers a check function for each of a series of versions. - vers can be a list or an iterator""" + vers can be a list or an iterator. + + Produces a series of feature checks that have the form <name><vers> without + any punctuation (even if there's punctuation in 'vers'; i.e. this produces + 'py38', not 'py3.8' or 'py-38').""" def decorator(func): def funcv(v): @@ -757,6 +761,8 @@ return (not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable' +# Add "py27", "py35", ... as possible feature checks. Note that there's no +# punctuation here. @checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9)) def has_python_range(v): major, minor = v.split('.')[0:2]