Add a pylorax.api.version number

lorax-composer is in a different package than lorax, so we need to use
its version number not lorax's when reporting the API /status/
This commit is contained in:
Brian C. Lane 2018-08-21 10:15:57 -07:00
parent d0c4524253
commit a00b009f77
5 changed files with 15 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
*.pyc *.pyc
src/pylorax/version.py* src/pylorax/version.py*
src/pylorax/api/version.py*
src/composer/version.py* src/composer/version.py*
*.swp *.swp
.pylint.d/ .pylint.d/

View File

@ -1,7 +1,7 @@
PYTHON ?= /usr/bin/python PYTHON ?= /usr/bin/python
DESTDIR ?= / DESTDIR ?= /
PKGNAME = lorax PKGNAME = lorax-composer
VERSION = $(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec) VERSION = $(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
RELEASE = $(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g') RELEASE = $(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g')
TAG = lorax-$(VERSION)-$(RELEASE) TAG = lorax-$(VERSION)-$(RELEASE)
@ -17,7 +17,10 @@ src/composer/version.py:
src/pylorax/version.py: src/pylorax/version.py:
echo "num = '$(VERSION)-$(RELEASE)'" > src/pylorax/version.py echo "num = '$(VERSION)-$(RELEASE)'" > src/pylorax/version.py
all: src/pylorax/version.py src/composer/version.py src/pylorax/api/version.py:
echo "num = '$(VERSION)-$(RELEASE)'" > src/pylorax/api/version.py
all: src/pylorax/version.py src/pylorax/api/version.py src/composer/version.py
$(PYTHON) setup.py build $(PYTHON) setup.py build
install: all install: all
@ -47,6 +50,7 @@ test: docs
clean: clean:
-rm -rf build src/pylorax/version.py -rm -rf build src/pylorax/version.py
-rm -rf build src/pylorax/api/version.py
-rm -rf build src/composer/version.py -rm -rf build src/composer/version.py
tag: tag:

View File

@ -17,5 +17,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
from pylorax.api.crossdomain import crossdomain from pylorax.api.crossdomain import crossdomain
__all__ = ["crossdomain"] # get the lorax-composer api version
try:
from pylorax.api.version import num as vernum
except ImportError:
vernum = "devel"
__all__ = ["crossdomain", "vernum"]

View File

@ -22,7 +22,7 @@ from flask import Flask, jsonify, redirect, send_from_directory
from glob import glob from glob import glob
import os import os
from pylorax import vernum from pylorax.api import vernum
from pylorax.api.crossdomain import crossdomain from pylorax.api.crossdomain import crossdomain
from pylorax.api.v0 import v0_api from pylorax.api.v0 import v0_api
from pylorax.sysutils import joinpaths from pylorax.sysutils import joinpaths

View File

@ -25,6 +25,7 @@ class LoraxLintConfig(PocketLintConfig):
self.falsePositives = [ FalsePositive(r"No name 'version' in module 'pylorax'"), self.falsePositives = [ FalsePositive(r"No name 'version' in module 'pylorax'"),
FalsePositive(r"Module 'pylorax' has no 'version' member"), FalsePositive(r"Module 'pylorax' has no 'version' member"),
FalsePositive(r"Module 'pylorax.api' has no 'version' member"),
FalsePositive(r"Instance of 'int' has no .* member"), FalsePositive(r"Instance of 'int' has no .* member"),
FalsePositive(r"Catching too general exception Exception"), FalsePositive(r"Catching too general exception Exception"),
FalsePositive(r"^E0712.*: Catching an exception which doesn't inherit from (Base|)Exception: GError$"), FalsePositive(r"^E0712.*: Catching an exception which doesn't inherit from (Base|)Exception: GError$"),