Skip to content

Commit

Permalink
move version nr to lib (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
thijstriemstra authored and rm-hull committed Nov 23, 2017
1 parent d01a8cf commit 72c9a2b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include VERSION.txt README.rst CHANGES.rst CONTRIBUTING.rst LICENSE.rst tox.ini setup.cfg .coveragerc
include README.rst CHANGES.rst CONTRIBUTING.rst LICENSE.rst tox.ini setup.cfg .coveragerc

recursive-include luma *.py *.png

Expand Down
1 change: 0 additions & 1 deletion VERSION.txt

This file was deleted.

8 changes: 5 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import os, sys
import os
import sys
from datetime import datetime

version = open("../VERSION.txt").read().strip()

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

sys.path.insert(0, os.path.abspath('..'))

from luma.emulator import __version__ as version

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

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down
2 changes: 2 additions & 0 deletions luma/emulator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Richard Hull and contributors
# See LICENSE.rst for details.

__version__ = '1.0.1'
25 changes: 19 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import re
import os
import sys
from io import open
Expand All @@ -12,17 +13,29 @@ def read_file(fname, encoding='utf-8'):
return r.read()


README = read_file("README.rst")
CONTRIB = read_file("CONTRIBUTING.rst")
CHANGES = read_file("CHANGES.rst")
version = read_file("VERSION.txt").strip()
def find_version(*file_paths):
fpath = os.path.join(os.path.dirname(__file__), *file_paths)
version_file = read_file(fpath)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)

err_msg = 'Unable to find version string in {}'.format(fpath)
raise RuntimeError(err_msg)


README = read_file('README.rst')
CONTRIB = read_file('CONTRIBUTING.rst')
CHANGES = read_file('CHANGES.rst')
version = find_version('luma', 'emulator', '__init__.py')

needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
test_deps = [
'mock;python_version<"3.3"',
"pytest>=3.1",
"pytest-cov"
'pytest>=3.1',
'pytest-cov'
]

setup(
Expand Down

0 comments on commit 72c9a2b

Please sign in to comment.