Skip to content
Snippets Groups Projects
Commit ca9f7837 authored by Matthew David Pitkin's avatar Matthew David Pitkin
Browse files

Add __version__ module-level attribute

parent 8ef70c5d
No related branches found
No related tags found
1 merge request!237Add __version__ module-level attribute
......@@ -23,3 +23,5 @@ from . import core, gw, hyper
from .core import utils, likelihood, prior, result, sampler
from .core.sampler import run_sampler
from .core.likelihood import Likelihood
__version__ = '0.3.1'
......@@ -18,6 +18,7 @@
#
import os
import sys
import bilby
sys.path.insert(0, os.path.abspath('../bilby/'))
......@@ -55,9 +56,9 @@ author = u'Paul Lasky'
# built documents.
#
# The short X.Y version.
version = u'0.2'
version = bilby.__version__
# The full version, including alpha/beta/rc tags.
release = u'0.2'
release = bilby.__version__
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
......
......@@ -2,7 +2,8 @@
from setuptools import setup
import subprocess
from os import path
import re
import os
def write_version_file(version):
......@@ -35,7 +36,7 @@ def write_version_file(version):
git_status = ''
version_file = '.version'
if path.isfile(version_file) is False:
if os.path.isfile(version_file) is False:
with open('bilby/' + version_file, 'w+') as f:
f.write('{}: {}'.format(version, git_status))
......@@ -44,14 +45,27 @@ def write_version_file(version):
def get_long_description():
""" Finds the README and reads in the description """
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst')) as f:
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
long_description = f.read()
return long_description
version = '0.3.1'
version_file = write_version_file(version)
# get version info from __init__.py
def readfile(filename):
with open(filename) as fp:
filecontents = fp.read()
return filecontents
VERSION_REGEX = re.compile(r"__version__ = \'(.*?)\'")
CONTENTS = readfile(os.path.join(
os.path.dirname(os.path.abspath(__file__)),
"bilby", "__init__.py"))
VERSION = VERSION_REGEX.findall(CONTENTS)[0]
version_file = write_version_file(VERSION)
long_description = get_long_description()
setup(name='bilby',
......@@ -61,7 +75,7 @@ setup(name='bilby',
author='Greg Ashton, Moritz Huebner, Paul Lasky, Colm Talbot',
author_email='paul.lasky@monash.edu',
license="MIT",
version=version,
version=VERSION,
packages=['bilby', 'bilby.core', 'bilby.core.sampler',
'bilby.gw', 'bilby.hyper', 'cli_bilby'],
package_dir={'bilby': 'bilby'},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment