From cd3e2304f4a9c4f725dcc548082ccc6c89d078a4 Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Wed, 2 Aug 2023 18:44:28 +0000 Subject: pylibfdt: use fallback version in tarballs When building pylibfdt from the released tarballs[1] setup.py will fail with the following. > LookupError: setuptools-scm was unable to detect version for dtc. > Make sure you're either building from a fully intact git repository or > PyPI tarballs. Most other sources (such as GitHub's tarballs, a git > checkout without the .git folder) don't contain the necessary metadata > and will not work. seutptools_scm supports a 'fallback_version' that will use the provided string as the version when the git repo is not available. [1] https://www.kernel.org/pub/software/utils/dtc/dtc-1.7.0.tar.xz Signed-off-by: Brandon Maier Signed-off-by: David Gibson --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/setup.py b/setup.py index e82a832..c3ffb2b 100755 --- a/setup.py +++ b/setup.py @@ -22,6 +22,9 @@ srcdir = os.path.dirname(__file__) with open(os.path.join(srcdir, "README.md"), "r") as fh: long_description = fh.read() +with open(os.path.join(srcdir, "VERSION.txt"), "r") as fh: + version = fh.readline().strip() + def get_top_builddir(): if '--top-builddir' in sys.argv: index = sys.argv.index('--top-builddir') @@ -51,6 +54,8 @@ setup( name='libfdt', use_scm_version={ "root": srcdir, + "fallback_version": version, + "fallback_root": srcdir, }, cmdclass = {'build_py' : build_py}, setup_requires = ['setuptools_scm'], -- cgit v1.1