forked from LSSTDESC/CCL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
67 lines (62 loc) · 2.66 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
#!/usr/bin/env python
from setuptools.command.build_py import build_py as _build
from setuptools import setup
from subprocess import call
from io import open
import glob
import os
import sys
class build(_build):
"""Specialized Python source builder."""
def run(self):
call(["mkdir", "-p", "build"])
if call(["cmake", "-H.", "-Bbuild"]) != 0:
raise Exception("Could not run CMake configuration. Make sure CMake is installed !")
if call(["make", "-Cbuild", "_ccllib"]) != 0:
raise Exception("Could not build CCL")
# Finds the library under its different possible names
if os.path.exists("build/pyccl/_ccllib.so"):
call(["cp", "build/pyccl/_ccllib.so", "pyccl/"])
else:
raise Exception("Could not find wrapper shared library, compilation must have failed.")
if call(["cp", "build/pyccl/ccllib.py", "pyccl/"]) != 0:
raise Exception("Could not find python module, SWIG must have failed.")
call(["cp", "include/ccl_params.ini", "pyccl/"])
# Copy files required by CLASS
if call(["cp","-r", "build/extern/share/class/bbn", "pyccl/"]) != 0:
raise Exception("Could not copy the CLASS BBN fikes, CLASS compilation must have failed.")
if call(["cp","-r", "build/extern/share/class/hyrec", "pyccl/"]) != 0:
raise Exception("Could not copy the CLASS BBN fikes, CLASS compilation must have failed.")
_build.run(self)
# read the contents of the README file
with open('README.md', encoding="utf-8") as f:
long_description = f.read()
setup(name="pyccl",
description="Library of validated cosmological functions.",
long_description=long_description,
long_description_content_type='text/markdown',
author="LSST DESC",
url="https://github.com/LSSTDESC/CCL",
packages=['pyccl'],
provides=['pyccl'],
package_data={'pyccl': ['_ccllib.so', 'ccl_params.ini', 'bbn/*', 'hyrec/*']},
include_package_data = True,
use_scm_version=True,
setup_requires=['setuptools_scm'],
install_requires=['numpy', 'pyyaml'],
test_suite='nose.collector',
tests_require=['nose'],
cmdclass={'build_py': build},
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
'Programming Language :: C',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering :: Physics'
]
)