Skip to content

Commit

Permalink
Added single source version information.
Browse files Browse the repository at this point in the history
  • Loading branch information
smelandr committed Mar 23, 2017
1 parent d60d1c2 commit e7b9029
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
4 changes: 3 additions & 1 deletion nmrstarlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@
chemical shift values using the Graphviz (http://www.graphviz.org/) DOT Languge description
and provides code example for utilizing the library.
"""
from __future__ import print_function

import os
from . import nmrstarlib

__title__ = "nmrstarlib"
__version__ = "1.1.0"

this_directory = os.path.dirname(__file__)

if nmrstarlib.NMRSTAR_VERSION == "3":
Expand Down
3 changes: 2 additions & 1 deletion nmrstarlib/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from . import nmrstarlib
from .converter import Converter
from .csviewer import CSViewer
from nmrstarlib import __version__


def main(cmdargs):
Expand All @@ -51,5 +52,5 @@ def main(cmdargs):
csviewer.csview(view=True)


args = docopt.docopt(__doc__, version="1.1.0")
args = docopt.docopt(__doc__, version=__version__)
main(args)
15 changes: 14 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import sys
import re
from setuptools import setup, find_packages, Extension

try:
Expand All @@ -22,13 +23,25 @@ def readme():
with open('README.rst') as readme_file:
return readme_file.read()


def find_version():
with open('nmrstarlib/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(), re.MULTILINE).group(1)
if not version:
raise RuntimeError('Cannot find version information')
return version


REQUIRES = [
'docopt >= 0.6.2',
'graphviz >= 0.5.2'
]


EXTENSIONS = []


if HAVE_CYTHON:
EXTENSIONS.append(Extension('nmrstarlib.cbmrblex',
sources=['nmrstarlib/cbmrblex.pyx']))
Expand All @@ -38,7 +51,7 @@ def readme():

setup(
name='nmrstarlib',
version='1.1.0',
version=find_version(),
author='Andrey Smelter',
author_email='andrey.smelter@gmail.com',
description='Python library for parsing data from NMR-STAR format files',
Expand Down

0 comments on commit e7b9029

Please sign in to comment.