From 4b1098369c3722ebb59a067a0a9df988f490051f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=20V=C3=AEjdea?= Date: Thu, 3 Jan 2019 20:36:12 +0200 Subject: [PATCH] Add check to prevent build of docs with bad version --- .travis.yml | 2 +- docs/conf.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 60ce5fc..a3f5cfd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,7 +16,7 @@ jobs: dist: xenial sudo: required - python: '3.6' - env: TOXENV=docs + env: TOXENV=docs - python: '3.6' env: TOXENV=djmaster - python: '3.6' diff --git a/docs/conf.py b/docs/conf.py index 6fc44f4..4d006bb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -48,6 +48,11 @@ author = 'Cristi V.' # The full version, including alpha/beta/rc tags. release = get_distribution('drf_yasg').version +if 'noscm' in release: + raise AssertionError('Invalid package version string: %s. \n' + 'The documentation must be built with drf_yasg installed from a distribution package, ' + 'which must have been built with a proper version number (i.e. from a full source checkout).' + % (release,)) # The short X.Y.Z version. version = '.'.join(release.split('.')[:3])