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
from setuptools import setup
from validata_ui.version import VERSION
script_dir = Path(__file__).parent
# Gets the long description from the README.md file
readme_filepath = Path(__file__).parent / 'README.md'
with readme_filepath.open('rt', encoding='utf-8') as fd_in:
LONG_DESCRIPTION = fd_in.read()
readme_filepath = script_dir / 'README.md'
with readme_filepath.open('rt', encoding='utf-8') as fd:
LONG_DESCRIPTION = fd.read()
with (script_dir / 'validata_ui' / 'VERSION').open('rt', encoding='utf-8') as fd:
VERSION = fd.read()
setup(
......
......@@ -8,16 +8,18 @@ from urllib.parse import quote_plus
import cachecontrol
import flask
import jinja2
import opendataschema
import pkg_resources
import requests
import tableschema
import opendataschema
from . import config
from .version import VERSION
log = logging.getLogger(__name__)
distribution = pkg_resources.get_distribution("validata-ui")
VERSION = distribution.version
def generate_schema_from_url_func(session):
"""Generates a function that encloses session"""
......@@ -91,6 +93,7 @@ def urlencode(context, value):
@app.context_processor
def inject_version():
global 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