check_version#

class check_version(expected, die=False, verbose=True)[source]#

Get current git information and optionally write it to disk. The expected version string may optionally start with ‘>=’ or ‘<=’ (== is implied otherwise), but other operators (e.g. ~=) are not supported. Note that e.g. ‘>’ is interpreted to mean ‘>=’.

Parameters:
  • expected (str) – expected version information

  • die (bool) – whether or not to raise an exception if the check fails

Example:

cv.check_version('>=1.7.0', die=True) # Will raise an exception if an older version is used