tests/hghave.py
changeset 43113 37af48031d6f
parent 43095 fb41ea2ea076
child 43194 138ac8cbce60
equal deleted inserted replaced
43112:24a07347aa60 43113:37af48031d6f
    58 
    58 
    59 
    59 
    60 def checkvers(name, desc, vers):
    60 def checkvers(name, desc, vers):
    61     """Registers a check function for each of a series of versions.
    61     """Registers a check function for each of a series of versions.
    62 
    62 
    63     vers can be a list or an iterator"""
    63     vers can be a list or an iterator.
       
    64 
       
    65     Produces a series of feature checks that have the form <name><vers> without
       
    66     any punctuation (even if there's punctuation in 'vers'; i.e. this produces
       
    67     'py38', not 'py3.8' or 'py-38')."""
    64 
    68 
    65     def decorator(func):
    69     def decorator(func):
    66         def funcv(v):
    70         def funcv(v):
    67             def f():
    71             def f():
    68                 return func(v)
    72                 return func(v)
   755 def has_demandimport():
   759 def has_demandimport():
   756     # chg disables demandimport intentionally for performance wins.
   760     # chg disables demandimport intentionally for performance wins.
   757     return (not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable'
   761     return (not has_chg()) and os.environ.get('HGDEMANDIMPORT') != 'disable'
   758 
   762 
   759 
   763 
       
   764 # Add "py27", "py35", ... as possible feature checks. Note that there's no
       
   765 # punctuation here.
   760 @checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9))
   766 @checkvers("py", "Python >= %s", (2.7, 3.5, 3.6, 3.7, 3.8, 3.9))
   761 def has_python_range(v):
   767 def has_python_range(v):
   762     major, minor = v.split('.')[0:2]
   768     major, minor = v.split('.')[0:2]
   763     py_major, py_minor = sys.version_info.major, sys.version_info.minor
   769     py_major, py_minor = sys.version_info.major, sys.version_info.minor
   764 
   770