From cbeb3adbdb74c9b3ed12dbbca67957f2d1fbe71a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Wed, 1 Mar 2017 18:49:52 +0100 Subject: [PATCH] Added fallback version '0.0' Installing depends on the VERSION file, so it raies an error if it is installed in some other way. ReadTheDocs installs the package so it can generate code docs. This commit adds a default version 0.0 --- Makefile | 6 ++++-- senpy/version.py | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f723582..9bfb268 100644 --- a/Makefile +++ b/Makefile @@ -85,8 +85,6 @@ git_push: pip_upload: python setup.py sdist upload ; -pip_test: $(addprefix pip_test-,$(PYVERSIONS)) - run-%: build-% docker run --rm -p 5000:5000 -ti '$(IMAGEWTAG)-python$(PYMAIN)' --default-plugins @@ -101,6 +99,10 @@ push-latest: build-$(PYMAIN) push-%: build-% docker push $(IMAGENAME):$(VERSION)-python$* +push: $(addprefix push-,$(PYVERSIONS)) + docker tag '$(IMAGEWTAG)-python$(PYMAIN)' '$(IMAGEWTAG)' + docker push $(IMAGENAME):$(VERSION) + ci: gitlab-runner exec docker --docker-volumes /var/run/docker.sock:/var/run/docker.sock --env CI_PROJECT_NAME=$(NAME) ${action} diff --git a/senpy/version.py b/senpy/version.py index 1d5ec0d..fa3d933 100644 --- a/senpy/version.py +++ b/senpy/version.py @@ -8,8 +8,12 @@ DEFAULT_FILE = os.path.join(ROOT, 'VERSION') def read_version(versionfile=DEFAULT_FILE): - with open(versionfile) as f: - return f.read().strip() + try: + with open(versionfile) as f: + return f.read().strip() + except IOError: + logger.error('Running an unknown version of senpy. Be careful!.') + return '0.0' __version__ = read_version()