1 # SPDX-License-Identifier: GPL-2.0-only
 
   3 # This file is part of Nominatim. (https://nominatim.org)
 
   5 # Copyright (C) 2022 by the Nominatim developer community.
 
   6 # For a full list of authors see the git log.
 
   8 Version information for Nominatim.
 
  10 from typing import Optional, Tuple
 
  12 # Version information: major, minor, patch level, database patch level
 
  14 # The first three numbers refer to the last released version.
 
  16 # The database patch level tracks important changes between releases
 
  17 # and must always be increased when there is a change to the database or code
 
  18 # that requires a migration.
 
  20 # When adding a migration on the development branch, raise the patch level
 
  21 # to 99 to make sure that the migration is applied when updating from a
 
  22 # patch release to the next minor version. Patch releases usually shouldn't
 
  23 # have migrations in them. When they are needed, then make sure that the
 
  24 # migration can be reapplied and set the migration version to the appropriate
 
  25 # patch level when cherry-picking the commit with the migration.
 
  27 # Released versions always have a database patch level of 0.
 
  28 NOMINATIM_VERSION = (4, 2, 99, 0)
 
  30 POSTGRESQL_REQUIRED_VERSION = (9, 6)
 
  31 POSTGIS_REQUIRED_VERSION = (2, 2)
 
  33 # Cmake sets a variable @GIT_HASH@ by executing 'git --log'. It is not run
 
  34 # on every execution of 'make'.
 
  35 # cmake/tool-installed.tmpl is used to build the binary 'nominatim'. Inside
 
  36 # there is a call to set the variable value below.
 
  37 GIT_COMMIT_HASH : Optional[str] = None
 
  40 # pylint: disable=consider-using-f-string
 
  41 def version_str(version:Tuple[int, int, int, int] = NOMINATIM_VERSION) -> str:
 
  43     Return a human-readable string of the version.
 
  45     return '{}.{}.{}-{}'.format(*version)