forked from halomod/halomod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
66 lines (58 loc) · 2.41 KB
/
setup.py
File metadata and controls
66 lines (58 loc) · 2.41 KB
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
import setuptools
from numpy.distutils.core import setup, Extension
import os
import sys
import io
import re
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
) as fp:
return fp.read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
if sys.argv[-1] == "publish":
os.system("rm dist/*")
os.system("python setup.py sdist")
os.system("python setup.py bdist_wheel")
os.system("twine upload dist/*")
sys.exit()
fort = Extension('halomod.fort.routines', ['halomod/fort/routines.f90'],
extra_f90_compile_args=['-O3', '-Wall', '-Wtabs'],
f2py_options=['--quiet', 'only:', 'power_gal_2h',
'power_gal_1h_ss', 'corr_gal_1h_ss',
'corr_gal_1h_cs', 'power_to_corr',
'corr_gal_1h', 'get_subfind_centres', ':'])
corr_2h = Extension('halomod.fort.twohalo', ['halomod/fort/twohalo.f90'],
extra_f90_compile_args=['-Wall', '-Wtabs', '-fopenmp'],
f2py_options=['only:', "power_to_corr", "twohalo", "dblsimps", ":"],
libraries=['gomp']
)
if __name__ == "__main__":
setup(
name="halomod",
version=find_version("halomod","__init__.py"),
install_requires=['hmf>=2.0.0',
'mpmath',
'cached_property',
'numpy',
'scipy'],
scripts=['scripts/pophod',
'scripts/halomod-fit'],
author="Steven Murray",
author_email="steven.murray@curtin.edu.au",
description="A Halo Model calculator built on hmf",
long_description=read('README.rst'),
license='MIT',
keywords="halo occupation distribution",
url="https://github.com/steven-murray/halomod",
ext_modules=[fort, corr_2h] if os.getenv("WITH_FORTRAN",None) else [],
packages=['halomod', 'halomod.fort'] if os.getenv("WITH_FORTRAN",None) else ['halomod'],
package_data={"halomod":['data/*']}
)