Skip to content

Commit

Permalink
Merge pull request #76 from scossu/version_hotfix
Browse files Browse the repository at this point in the history
HOTFIX: Use module variables for version and release numbers.
  • Loading branch information
scossu committed May 11, 2018
2 parents 01961c4 + 236db08 commit 75fcf0e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

7 changes: 3 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ def __getattr__(cls, name):
MOCK_MODULES = ['lmdb']
sys.modules.update((mod_name, MockModule()) for mod_name in MOCK_MODULES)

import lakesuperior
import lakesuperior.env_setup


here = path.abspath(path.dirname(__file__))

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down Expand Up @@ -75,8 +74,8 @@ def __getattr__(cls, name):
# built documents.
#
# Version and release are the same.
with open(path.realpath(path.join(here, '..', 'VERSION'))) as fh:
version = release = fh.readlines()[0]
version = lakesuperior.version
release = lakesuperior.release

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 4 additions & 0 deletions lakesuperior/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

from os import path


version = '1.0 alpha'
release = '1.0.0a17'

basedir = path.dirname(path.realpath(__file__))
"""
Base directory for the module.
Expand Down
8 changes: 2 additions & 6 deletions lakesuperior/endpoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from flask import Blueprint, render_template

from lakesuperior import basedir
from lakesuperior import release

logger = logging.getLogger(__name__)

Expand All @@ -18,11 +18,7 @@
@main.route('/', methods=['GET'])
def index():
"""Homepage."""
version_fname = path.abspath(
path.join(path.dirname(basedir), 'VERSION'))
with open(version_fname) as fh:
version = fh.readlines()[0]
return render_template('index.html', version=version)
return render_template('index.html', release=release)


@main.route('/debug', methods=['GET'])
Expand Down
2 changes: 1 addition & 1 deletion lakesuperior/endpoints/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html' %}
{% block title %}LAKEsuperior{% endblock %}
{% block content %}
<p>Version {{ version }}</p>
<p>Release {{ release }}</p>
<blockquote>
Superior, they said, never gives up her dead<br />
When the gales of November come early
Expand Down
11 changes: 4 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from glob import glob
from os import path

here = path.abspath(path.dirname(__file__))
import lakesuperior

# ``pytest_runner`` is referenced in ``setup_requires``.
# See https://github.com/pytest-dev/pytest-runner#conditional-requirement
Expand All @@ -22,17 +22,14 @@


# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
readme_fpath = path.join(path.dirname(lakesuperior.basedir), 'README.rst')
with open(readme_fpath, encoding='utf-8') as f:
long_description = f.read()

# Read release number.
with open(path.realpath(path.join(here, 'VERSION'))) as fh:
version = fh.readlines()[0]


setup(
name='lakesuperior',
version=version,
version=lakesuperior.release,

description='A Linked Data Platform repository sever.',
long_description=long_description,
Expand Down

0 comments on commit 75fcf0e

Please sign in to comment.