Skip to content
Snippets Groups Projects
Commit e0044114 authored by Gregory Ashton's avatar Gregory Ashton
Browse files

General clean up of setup.py

parent 90f1c761
No related branches found
No related tags found
1 merge request!117Clean up of setup
...@@ -4,31 +4,53 @@ from setuptools import setup ...@@ -4,31 +4,53 @@ from setuptools import setup
import subprocess import subprocess
from os import path from os import path
version = '0.2.1'
# Write a version file containing the git hash and info def write_version_file(version):
try: """ Writes a file with version information to be used at run time
git_log = subprocess.check_output(
['git', 'log', '-1', '--pretty=%h %ai']).decode('utf-8') Parameters
git_diff = (subprocess.check_output(['git', 'diff', '.']) ----------
+ subprocess.check_output( version: str
['git', 'diff', '--cached', '.'])).decode('utf-8') A string containing the current version information
if git_diff == '':
status = '(CLEAN) ' + git_log Returns
else: -------
status = '(UNCLEAN) ' + git_log version_file: str
except subprocess.CalledProcessError: A path to the version file
status = ''
"""
version_file = '.version' try:
if path.isfile(version_file) is False: git_log = subprocess.check_output(
with open('tupak/' + version_file, 'w+') as f: ['git', 'log', '-1', '--pretty=%h %ai']).decode('utf-8')
f.write('{} - {}'.format(version, status)) git_diff = (subprocess.check_output(['git', 'diff', '.'])
+ subprocess.check_output(
['git', 'diff', '--cached', '.'])).decode('utf-8')
here = path.abspath(path.dirname(__file__)) if git_diff == '':
with open(path.join(here, 'README.rst')) as f: status = '(CLEAN) ' + git_log
long_description = f.read() else:
status = '(UNCLEAN) ' + git_log
except subprocess.CalledProcessError:
status = ''
version_file = '.version'
if path.isfile(version_file) is False:
with open('tupak/' + version_file, 'w+') as f:
f.write('{} - {}'.format(version, status))
return version_file
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:
long_description = f.read()
return long_description
version = '0.2.1'
version_file = write_version_file(version)
long_description = get_long_description()
setup(name='tupak', setup(name='tupak',
description='The User friendly Parameter estimAtion Kode', description='The User friendly Parameter estimAtion Kode',
...@@ -40,7 +62,8 @@ setup(name='tupak', ...@@ -40,7 +62,8 @@ setup(name='tupak',
version=version, version=version,
packages=['tupak', 'tupak.core', 'tupak.gw', 'tupak.hyper', 'cli_tupak'], packages=['tupak', 'tupak.core', 'tupak.gw', 'tupak.hyper', 'cli_tupak'],
package_dir={'tupak': 'tupak'}, package_dir={'tupak': 'tupak'},
package_data={'tupak.gw': ['prior_files/*', 'noise_curves/*.txt', 'detectors/*'], package_data={'tupak.gw': ['prior_files/*', 'noise_curves/*.txt',
'detectors/*'],
'tupak': [version_file]}, 'tupak': [version_file]},
install_requires=[ install_requires=[
'future', 'future',
...@@ -50,9 +73,7 @@ setup(name='tupak', ...@@ -50,9 +73,7 @@ setup(name='tupak',
'matplotlib>=2.0', 'matplotlib>=2.0',
'deepdish', 'deepdish',
'pandas', 'pandas',
'scipy', 'scipy'],
],
entry_points={'console_scripts': entry_points={'console_scripts':
['tupak_plot=cli_tupak.plot_multiple_posteriors:main'] ['tupak_plot=cli_tupak.plot_multiple_posteriors:main']
}) })
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