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

Apply Gregs patch

parent 575ed0f1
No related branches found
No related tags found
1 merge request!237Add __version__ module-level attribute
...@@ -24,4 +24,4 @@ from .core import utils, likelihood, prior, result, sampler ...@@ -24,4 +24,4 @@ from .core import utils, likelihood, prior, result, sampler
from .core.sampler import run_sampler from .core.sampler import run_sampler
from .core.likelihood import Likelihood from .core.likelihood import Likelihood
__version__ = '0.3.1' __version__ = utils.get_version_information()
...@@ -348,15 +348,21 @@ def setup_logger(outdir=None, label=None, log_level='INFO', print_version=False) ...@@ -348,15 +348,21 @@ def setup_logger(outdir=None, label=None, log_level='INFO', print_version=False)
for handler in logger.handlers: for handler in logger.handlers:
handler.setLevel(level) handler.setLevel(level)
version_file = os.path.join(
os.path.dirname(os.path.dirname(__file__)), '.version')
with open(version_file, 'r') as f:
version = f.readline().rstrip()
if print_version: if print_version:
version = get_version_information()
logger.info('Running bilby version: {}'.format(version)) logger.info('Running bilby version: {}'.format(version))
def get_version_information():
version_file = os.path.join(
os.path.dirname(os.path.dirname(__file__)), '.version')
try:
with open(version_file, 'r') as f:
return f.readline().rstrip()
except: # noqa
return "No version information"
def get_progress_bar(module='tqdm'): def get_progress_bar(module='tqdm'):
""" """
TODO: Write proper docstring TODO: Write proper docstring
......
...@@ -58,13 +58,7 @@ def readfile(filename): ...@@ -58,13 +58,7 @@ def readfile(filename):
return filecontents return filecontents
VERSION_REGEX = re.compile(r"__version__ = \'(.*?)\'") VERSION = '0.3.1'
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) version_file = write_version_file(VERSION)
long_description = get_long_description() long_description = get_long_description()
......
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