-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_class_py3.py
39 lines (34 loc) · 1.22 KB
/
setup_class_py3.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
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import numpy as nm
import os
import subprocess as sbp
import os.path as osp
# Recover the gcc compiler
GCCPATH_STRING = sbp.Popen(
['gcc', '-print-libgcc-file-name'],
stdout=sbp.PIPE).communicate()[0]
GCCPATH = osp.normpath(osp.dirname(GCCPATH_STRING))
GCCPATH = str(GCCPATH, "UTF-8")
# Recover the CLASS version
with open(os.path.join('..', 'include', 'common.h'), 'r') as v_file:
for line in v_file:
if line.find("_VERSION_") != -1:
# get rid of the " and the v
VERSION = line.split()[-1][2:-1]
break
setup(
name='classy',
version=VERSION,
description='Python interface to the Cosmological Boltzmann code CLASS',
url='http://www.class-code.net',
cmdclass={'build_ext': build_ext},
ext_modules=[Extension("classy", ["classy.pyx"],
include_dirs=[nm.get_include(), "../include"],
libraries=["class"],
library_dirs=["../", GCCPATH],
extra_link_args=['-lgomp'],
)],
data_files=(('bbn', ['../bbn/sBBN.dat']),)
)