parameters: (impl, version_min, version_max)
docstring: Check python version
docstring_summary: Check python version
docstring_tokens: Check python version
function: def check_python_version(impl, version_min, version_max):
      """ Check python version """
      if impl == 'python':
          version_info = _sys.version_info
      elif impl == 'pypy':
          version_info = getattr(_sys, 'pypy_version_info', None)
          if not version_info:
              return
      elif impl == 'jython':
          if not 'java' in _sys.platform.lower():
              return
          version_info = _sys.version_info
      else:
          raise AssertionError("impl not in ('python', 'pypy', 'jython')")
  
      pyversion = list(map(int, version_info[:3]))
      if version_min:
          min_required = list(
              map(int, '.'.join((version_min, '0.0.0')).split('.')[:3])
          )
          if pyversion < min_required:
              raise EnvironmentError("Need at least %s %s (vs. %s)" % (
                  impl, version_min, '.'.join(map(str, pyversion))
              ))
      if version_max:
          max_required = list(map(int, version_max.split('.')))
          max_required[-1] += 1
          if pyversion >= max_required:
              raise EnvironmentError("Need at max %s %s (vs. %s)" % (
                  impl,
                  version_max,
                  '.'.join(map(str, pyversion))
              ))
function_tokens: def check_python_version ( impl , version_min , version_max ) : if impl == 'python' : version_info = _sys . version_info elif impl == 'pypy' : version_info = getattr ( _sys , 'pypy_version_info' , None ) if not version_info : return elif impl == 'jython' : if not 'java' in _sys . platform . lower ( ) : return version_info = _sys . version_info else : raise AssertionError ( "impl not in ('python', 'pypy', 'jython')" ) pyversion = list ( map ( int , version_info [ : 3 ] ) ) if version_min : min_required = list ( map ( int , '.' . join ( ( version_min , '0.0.0' ) ) . split ( '.' ) [ : 3 ] ) ) if pyversion < min_required : raise EnvironmentError ( "Need at least %s %s (vs. %s)" % ( impl , version_min , '.' . join ( map ( str , pyversion ) ) ) ) if version_max : max_required = list ( map ( int , version_max . split ( '.' ) ) ) max_required [ - 1 ] += 1 if pyversion >= max_required : raise EnvironmentError ( "Need at max %s %s (vs. %s)" % ( impl , version_max , '.' . join ( map ( str , pyversion ) ) ) )