Browse Source

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 <brandon.maier@collins.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
Brandon Maier 1 year ago committed by David Gibson
parent
commit
cd3e2304f4
  1. 5
      setup.py

5
setup.py

@ -22,6 +22,9 @@ srcdir = os.path.dirname(__file__)
with open(os.path.join(srcdir, "README.md"), "r") as fh: with open(os.path.join(srcdir, "README.md"), "r") as fh:
long_description = fh.read() long_description = fh.read()


with open(os.path.join(srcdir, "VERSION.txt"), "r") as fh:
version = fh.readline().strip()

def get_top_builddir(): def get_top_builddir():
if '--top-builddir' in sys.argv: if '--top-builddir' in sys.argv:
index = sys.argv.index('--top-builddir') index = sys.argv.index('--top-builddir')
@ -51,6 +54,8 @@ setup(
name='libfdt', name='libfdt',
use_scm_version={ use_scm_version={
"root": srcdir, "root": srcdir,
"fallback_version": version,
"fallback_root": srcdir,
}, },
cmdclass = {'build_py' : build_py}, cmdclass = {'build_py' : build_py},
setup_requires = ['setuptools_scm'], setup_requires = ['setuptools_scm'],

Loading…
Cancel
Save