From 5d159ccf17b5d5761e3ee79390a207780b537f65 Mon Sep 17 00:00:00 2001 From: Taylor Holberton Date: Mon, 17 Dec 2018 14:00:34 +0000 Subject: Putting version.py in scripts folder --- meson.build | 2 +- scripts/version.py | 25 +++++++++++++++++++++++++ version.py | 25 ------------------------- 3 files changed, 26 insertions(+), 26 deletions(-) create mode 100755 scripts/version.py delete mode 100755 version.py diff --git a/meson.build b/meson.build index 67607a1..d7e3a99 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,5 @@ project ('tinyalsa', 'c', - version : run_command(find_program('version.py')).stdout().strip(), + version : run_command(find_program('scripts/version.py')).stdout().strip(), meson_version : '>= 0.48.0') tinyalsa_includes = include_directories('.', 'include') diff --git a/scripts/version.py b/scripts/version.py new file mode 100755 index 0000000..892dbdb --- /dev/null +++ b/scripts/version.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# +# tinyalsa version.py: Extracts versions from TINYALSA_VERSION_STRING in +# include/tinyalsa/version.h header file for Meson build. +import os +import sys + +if __name__ == '__main__': + try: + srcroot = os.environ['MESON_SOURCE_ROOT'] + except: + srcroot = os.getcwd() + print('Warning: MESON_SOURCE_ROOT env var not set, assuming source code is in', srcroot, file=sys.stderr) + + # API version + api_version = None + f = open(os.path.join(srcroot, 'include', 'tinyalsa', 'version.h'), 'r') + for line in f: + if line.startswith('#define TINYALSA_VERSION_STRING '): + api_version = line[32:].strip().replace('"', '') + print(api_version) + sys.exit(0) + + print('Warning: Could not extract API version from TINYALSA_VERSION_STRING in include/tinyalsa/version.h in', srcroot, file=sys.stderr) + sys.exit(-1) diff --git a/version.py b/version.py deleted file mode 100755 index 892dbdb..0000000 --- a/version.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python3 -# -# tinyalsa version.py: Extracts versions from TINYALSA_VERSION_STRING in -# include/tinyalsa/version.h header file for Meson build. -import os -import sys - -if __name__ == '__main__': - try: - srcroot = os.environ['MESON_SOURCE_ROOT'] - except: - srcroot = os.getcwd() - print('Warning: MESON_SOURCE_ROOT env var not set, assuming source code is in', srcroot, file=sys.stderr) - - # API version - api_version = None - f = open(os.path.join(srcroot, 'include', 'tinyalsa', 'version.h'), 'r') - for line in f: - if line.startswith('#define TINYALSA_VERSION_STRING '): - api_version = line[32:].strip().replace('"', '') - print(api_version) - sys.exit(0) - - print('Warning: Could not extract API version from TINYALSA_VERSION_STRING in include/tinyalsa/version.h in', srcroot, file=sys.stderr) - sys.exit(-1) -- cgit v1.2.3