Commit 721720cf authored by Christophe Benz's avatar Christophe Benz

Read version from text file

parent eba5ec54
Pipeline #1092 passed with stage
in 5 minutes and 1 second
...@@ -4,12 +4,15 @@ from pathlib import Path ...@@ -4,12 +4,15 @@ from pathlib import Path
from setuptools import setup from setuptools import setup
from validata_ui.version import VERSION script_dir = Path(__file__).parent
# Gets the long description from the README.md file # Gets the long description from the README.md file
readme_filepath = Path(__file__).parent / 'README.md' readme_filepath = script_dir / 'README.md'
with readme_filepath.open('rt', encoding='utf-8') as fd_in: with readme_filepath.open('rt', encoding='utf-8') as fd:
LONG_DESCRIPTION = fd_in.read() LONG_DESCRIPTION = fd.read()
with (script_dir / 'validata_ui' / 'VERSION').open('rt', encoding='utf-8') as fd:
VERSION = fd.read()
setup( setup(
......
...@@ -8,16 +8,18 @@ from urllib.parse import quote_plus ...@@ -8,16 +8,18 @@ from urllib.parse import quote_plus
import cachecontrol import cachecontrol
import flask import flask
import jinja2 import jinja2
import opendataschema
import pkg_resources
import requests import requests
import tableschema import tableschema
import opendataschema
from . import config from . import config
from .version import VERSION
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
distribution = pkg_resources.get_distribution("validata-ui")
VERSION = distribution.version
def generate_schema_from_url_func(session): def generate_schema_from_url_func(session):
"""Generates a function that encloses session""" """Generates a function that encloses session"""
...@@ -91,6 +93,7 @@ def urlencode(context, value): ...@@ -91,6 +93,7 @@ def urlencode(context, value):
@app.context_processor @app.context_processor
def inject_version(): def inject_version():
global VERSION
return {"validata_ui_version": VERSION} return {"validata_ui_version": VERSION}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment