-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
134 lines (117 loc) · 4.33 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/usr/bin/env python
import os
import subprocess
import sys
from pathlib import Path
from setuptools import setup
# check that python version is 3.6 or above
python_version = sys.version_info
print("Running Python version %s.%s.%s" % python_version[:3])
if python_version < (3, 6):
sys.exit("Python < 3.6 is not supported, aborting setup")
print("Confirmed Python version 3.6.0 or above")
def write_version_file(version):
"""Writes a file with version information to be used at run time
Parameters
----------
version: str
A string containing the current version information
Returns
-------
version_file: str
A path to the version file (relative to the bilby_pipe
package directory)
"""
version_file = Path("bilby_pipe") / ".version"
try:
git_log = subprocess.check_output(
["git", "log", "-1", "--pretty=%h %ai"]
).decode("utf-8")
git_diff = (
subprocess.check_output(["git", "diff", "."])
+ subprocess.check_output(["git", "diff", "--cached", "."])
).decode("utf-8")
except subprocess.CalledProcessError: # git calls failed
# we already have a version file, let's use it
if version_file.is_file():
return version_file.name
# otherwise just return the version information
else:
git_version = version
else:
git_version = "{}: ({}) {}".format(
version, "UNCLEAN" if git_diff else "CLEAN", git_log.rstrip()
)
print(f"parsed git version info as: {git_version!r}")
with open(version_file, "w") as f:
print(git_version, file=f)
print(f"created {version_file}")
return version_file.name
def get_long_description():
""" Finds the README and reads in the description """
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 = "1.0.4"
version_file = write_version_file(VERSION)
long_description = get_long_description()
MAIN = "bilby_pipe"
JOB_CREATION = f"{MAIN}.job_creation"
NODES = f"{JOB_CREATION}.nodes"
setup(
name="bilby_pipe",
description="Automating the running of bilby for gravitational wave signals",
long_description=long_description,
url="https://lscsoft.docs.ligo.org/bilby_pipe/index.html",
author="Gregory Ashton, Isobel Romero-Shaw, Colm Talbot, Charlie Hoy, Shanika Galaudage",
author_email="[email protected]",
license="MIT",
version=VERSION,
package_data={"bilby_pipe": [version_file, "data_files/*"]},
packages=[MAIN, JOB_CREATION, NODES],
install_requires=[
"future",
"pycondor>=0.5",
"configargparse",
"ligo-gracedb",
"bilby[gw]>=1.1.2",
"scipy>=1.2.0",
"gwpy",
"gwosc",
"matplotlib",
"numpy",
"tqdm",
"corner",
"dynesty>=1.0.0",
"pesummary>=0.2.4",
"jinja2",
],
entry_points={
"console_scripts": [
"bilby_pipe=bilby_pipe.main:main",
"bilby_pipe_generation=bilby_pipe.data_generation:main",
"bilby_pipe_analysis=bilby_pipe.data_analysis:main",
"bilby_pipe_create_injection_file=bilby_pipe.create_injections:main",
"bilby_pipe_xml_converter=bilby_pipe.xml_converter:main",
"bilby_pipe_pp_test=bilby_pipe.pp_test:main",
"bilby_pipe_review=bilby_pipe.review:main",
"bilby_pipe_plot=bilby_pipe.plot:main",
"bilby_pipe_plot_calibration=bilby_pipe.plot:plot_calibration",
"bilby_pipe_plot_corner=bilby_pipe.plot:plot_corner",
"bilby_pipe_plot_marginal=bilby_pipe.plot:plot_marginal",
"bilby_pipe_plot_skymap=bilby_pipe.plot:plot_skymap",
"bilby_pipe_plot_waveform=bilby_pipe.plot:plot_waveform",
"bilby_pipe_gracedb=bilby_pipe.gracedb:main",
"bilby_pipe_write_default_ini=bilby_pipe.parser:main",
"bilby_pipe_to_ligo_skymap_samples=bilby_pipe.ligo_skymap:main",
]
},
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
],
)