version: add ability to specify a version suffix

This commit is contained in:
Saúl Ibarra Corretgé 2014-09-11 20:58:41 +02:00
parent 1cc5f179f5
commit f70b3fae8b
3 changed files with 5 additions and 2 deletions

View File

@ -29,7 +29,9 @@ def get_libuv_version():
patch = int(m.group(1))
m = re.search(r"""^#define UV_VERSION_IS_RELEASE (\d)$""", data, re.MULTILINE)
is_release = int(m.group(1))
return '%d.%d.%d%s' % (major, minor, patch, '-pre' if not is_release else '')
m = re.search(r"""^#define UV_VERSION_SUFFIX \"(\w*)\"$""", data, re.MULTILINE)
suffix = m.group(1)
return '%d.%d.%d%s' % (major, minor, patch, '-%s' % suffix if not is_release else '')
except Exception:
return 'unknown'

View File

@ -34,5 +34,6 @@
#define UV_VERSION_MINOR 0
#define UV_VERSION_PATCH 0
#define UV_VERSION_IS_RELEASE 0
#define UV_VERSION_SUFFIX "dev"
#endif /* UV_VERSION_H */

View File

@ -35,7 +35,7 @@
#if UV_VERSION_IS_RELEASE
# define UV_VERSION_STRING UV_VERSION_STRING_BASE
#else
# define UV_VERSION_STRING UV_VERSION_STRING_BASE "-pre"
# define UV_VERSION_STRING UV_VERSION_STRING_BASE "-" UV_VERSION_SUFFIX
#endif