-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
55 lines (46 loc) · 1.85 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
from setuptools import setup, Extension
import numpy
include_dirs_numpy = [numpy.get_include()]
def get_version_number():
main_ns = {}
for line in open('posym/__init__.py', 'r').readlines():
if not(line.find('__version__')):
exec(line, main_ns)
return main_ns['__version__']
def check_compiler():
import subprocess
output = subprocess.Popen(['gcc'], stderr=subprocess.PIPE).communicate()[1]
if b'clang' in output:
return 'clang'
if b'gcc' in output:
return 'gcc'
if check_compiler() == 'clang':
integrals = Extension('posym.integrals',
extra_compile_args=['-std=c99'],
include_dirs=include_dirs_numpy,
sources=['c/integrals.c'])
else:
print ('openmp is used')
integrals = Extension('posym.integrals',
extra_compile_args=['-std=c99', '-fopenmp'],
extra_link_args=['-lgomp'],
include_dirs=include_dirs_numpy,
sources=['c/integrals.c'])
permutations = Extension('posym.permutation.permutations',
extra_compile_args=['-std=c99'],
include_dirs=include_dirs_numpy,
sources=['c/permutations.c'])
setup(name='posym',
version=get_version_number(),
description='posym module',
long_description=open('README.md').read(),
long_description_content_type='text/markdown',
author='Abel Carreras',
url='https://github.com/abelcarreras/posym',
author_email='[email protected]',
packages=['posym',
'posym.operations',
'posym.permutation'],
install_requires=['numpy', 'scipy', 'pandas', 'PyYaml'],
license='MIT License',
ext_modules=[integrals, permutations])