diff options
author | 2021-11-10 19:11:33 -0600 | |
---|---|---|
committer | 2021-11-11 14:30:33 +1100 | |
commit | 0b106a77dbdc34ef809526febafc490b90d79a54 (patch) | |
tree | 32479f675cf280596fb43e02080fc83a79b1a837 /pylibfdt/setup.py | |
parent | c691776ddb26acbd3674722caafacaf7b6e3e807 (diff) |
pylibfdt: Use setuptools_scm for the version
The DTC version in version_gen.h causes a warning with setuptools:
setuptools/dist.py:501: UserWarning: The version specified ('1.6.1-g5454474d') \
is an invalid version, this may not work as expected with newer versions of \
setuptools, pip, and PyPI. Please see PEP 440 for more details.
It also creates an unnecessary dependency on the rest of the build
system(s). Switch to use setuptools_scm instead to get the version for
pylibfdt.
Signed-off-by: Rob Herring <robh@kernel.org>
Message-Id: <20211111011135.2386773-3-robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'pylibfdt/setup.py')
-rwxr-xr-x | pylibfdt/setup.py | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/pylibfdt/setup.py b/pylibfdt/setup.py index f065a59..52b61b6 100755 --- a/pylibfdt/setup.py +++ b/pylibfdt/setup.py @@ -15,10 +15,6 @@ import os import re import sys - -VERSION_PATTERN = '^#define DTC_VERSION "DTC ([^"]*)"$' - - def get_top_builddir(): if '--top-builddir' in sys.argv: index = sys.argv.index('--top-builddir') @@ -27,18 +23,9 @@ def get_top_builddir(): else: return os.getcwd() - srcdir = os.path.dirname(os.path.abspath(sys.argv[0])) top_builddir = get_top_builddir() - -def get_version(): - version_file = os.path.join(top_builddir, 'version_gen.h') - f = open(version_file, 'rt') - m = re.match(VERSION_PATTERN, f.readline()) - return m.group(1) - - libfdt_module = Extension( '_libfdt', sources=[os.path.join(srcdir, 'libfdt.i')], @@ -50,7 +37,10 @@ libfdt_module = Extension( setup( name='libfdt', - version=get_version(), + use_scm_version={ + "root": os.path.join(srcdir, '..'), + }, + setup_requires = ['setuptools_scm'], author='Simon Glass <sjg@chromium.org>', description='Python binding for libfdt', ext_modules=[libfdt_module], |