Fix missing import in finiterectlat-scatter.py
[qpms.git] / setup.py
blob3fb7b3bd69da3b7e752da8f5d249009e45dd3510
1 from setuptools import setup, dist#, Extension
2 from distutils.extension import Extension
4 # We need to have numpy and cython imported before calling cythonize
5 # cf. https://luminousmen.com/post/resolve-cython-and-numpy-dependencies
6 # and https://github.com/pypa/pip/issues/5761
8 dist.Distribution().fetch_build_eggs(['Cython>=0.28', 'numpy>=1.2'])
10 from Cython.Build import cythonize, build_ext
11 import numpy
12 numpy_includes=numpy.get_include()
14 # setuptools DWIM monkey-patch madness
15 # http://mail.python.org/pipermail/distutils-sig/2007-September/thread.html#8204
16 #import sys
17 #if 'setuptools.extension' in sys.modules:
18 # m = sys.modules['setuptools.extension']
19 # m.Extension.__dict__ = m._Extension.__dict__
21 # TODO CHECK THIS OUT http://stackoverflow.com/questions/4056657/what-is-the-easiest-way-to-make-an-optional-c-extension-for-a-python-package
22 # AND THIS https://groups.google.com/forum/#!topic/cython-users/GAAPYb2X304
23 # also this: https://docs.python.org/2/extending/building.html
24 import os
26 #print("You might want to add additional library path to LD_LIBRARY_PATH (especially if you are not using"
27 # " GNU GSL in your system library path) and if import fails. ")
28 #if("LD_LIBRARY_PATH" in os.environ):
29 # print(os.environ['LD_LIBRARY_PATH'].split(':'))
33 '''
34 amos_sources = [
35 'amos/d1mach.f',
36 'amos/dgamln.f',
37 'amos/i1mach.f',
38 'amos/xerror.f',
39 'amos/zabs.f',
40 'amos/zacai.f',
41 'amos/zacon.f',
42 'amos/zairy.f',
43 'amos/zasyi.f',
44 'amos/zbesh.f',
45 'amos/zbesi.f',
46 'amos/zbesj.f',
47 'amos/zbesk.f',
48 'amos/zbesy.f',
49 'amos/zbinu.f',
50 'amos/zbiry.f',
51 'amos/zbknu.f',
52 'amos/zbuni.f',
53 'amos/zbunk.f',
54 'amos/zdiv.f',
55 'amos/zexp.f',
56 'amos/zkscl.f',
57 'amos/zlog.f',
58 'amos/zmlri.f',
59 'amos/zmlt.f',
60 'amos/zrati.f',
61 'amos/zs1s2.f',
62 'amos/zseri.f',
63 'amos/zshch.f',
64 'amos/zsqrt.f',
65 'amos/zuchk.f',
66 'amos/zunhj.f',
67 'amos/zuni1.f',
68 'amos/zuni2.f',
69 'amos/zunik.f',
70 'amos/zunk1.f',
71 'amos/zunk2.f',
72 'amos/zuoik.f',
73 'amos/zwrsk.f',
76 libqpms_sources = [
77 #'qpms/hexpoints_c.pyx',
78 'qpms/gaunt.c',#'qpms/gaunt.h','qpms/vectors.h','qpms/translations.h',
79 # FIXME http://stackoverflow.com/questions/4259170/python-setup-script-extensions-how-do-you-include-a-h-file
80 'qpms/translations.c',
81 'qpms/symmetries.c',
82 'qpms/wigner.c',
83 'qpms/scatsystem.c',
84 'qpms/vswf.c', # FIXME many things from vswf.c are not required by this module, but they have many dependencies (following in this list); maybe I want to move all the "basespec stuff"
85 'qpms/legendre.c',
86 'qpms/tmatrices.c',
87 'qpms/materials.c',
88 'qpms/error.c',
89 'qpms/bessel.c',
90 'qpms/own_zgemm.c',
91 'qpms/pointgroups.c',
93 '''
95 common_libs=['qpms', 'gsl', 'lapacke', 'blas', 'pthread',]
97 cycommon = Extension('qpms.cycommon',
98 sources = ['qpms/cycommon.pyx'],
99 #extra_link_args=['qpms/libqpms.a'],
100 libraries = common_libs,
101 include_dirs = [numpy_includes],
103 cytmatrices = Extension('qpms.cytmatrices',
104 sources = ['qpms/cytmatrices.pyx'],
105 #extra_link_args=['qpms/libqpms.a', 'amos/libamos.a'],
106 libraries = common_libs,
107 include_dirs = [numpy_includes],
109 cywaves = Extension('qpms.cywaves',
110 sources = ['qpms/cywaves.pyx'],
111 libraries = common_libs,
112 include_dirs = [numpy_includes],
114 cytranslations = Extension('qpms.cytranslations',
115 sources = ['qpms/cytranslations.pyx',
116 'qpms/translations_python.c',
118 extra_compile_args=['-std=c99',
119 '-DQPMS_COMPILE_PYTHON_EXTENSIONS', # This is needed to enable it in translations.h
121 #extra_link_args=['qpms/libqpms.a', 'amos/libamos.a'],
122 libraries = common_libs,
123 include_dirs = [numpy_includes],
125 cybspec = Extension('qpms.cybspec',
126 sources = ['qpms/cybspec.pyx'],
127 #extra_link_args=['qpms/libqpms.a'],
128 libraries = common_libs,
129 include_dirs = [numpy_includes],
131 cymaterials = Extension('qpms.cymaterials',
132 sources = ['qpms/cymaterials.pyx'],
133 #extra_link_args=['qpms/libqpms.a'],
134 libraries = common_libs,
135 include_dirs = [numpy_includes],
137 cyquaternions = Extension('qpms.cyquaternions',
138 sources = ['qpms/cyquaternions.pyx'],
139 #extra_link_args=['amos/libamos.a', 'qpms/libqpms.a'],
140 libraries = common_libs,
141 include_dirs = [numpy_includes],
143 cyewaldtest = Extension('qpms.cyewaldtest',
144 sources = ['qpms/cyewaldtest.pyx'],
145 libraries = common_libs,
146 include_dirs = [numpy_includes],
149 qpms_c = Extension('qpms.qpms_c',
150 sources = ['qpms/qpms_c.pyx',],
151 libraries = common_libs,
152 include_dirs=['amos', 'qpms', numpy_includes],
153 extra_link_args=['-fopenmp'],
154 extra_compile_args=['-fopenmp'],
157 setup(name='qpms',
158 version = "0.2.996",
159 packages=['qpms'],
160 # libraries = [('amos', {'sources': amos_sources} )],
161 setup_requires=['cython>=0.28','numpy>=1.2','setuptools>=18.0'],
162 install_requires=['cython>=0.28',
163 #'quaternion','spherical_functions',
164 'sympy>=1.2', 'numpy>=1.2'],
165 #dependency_links=['https://github.com/moble/quaternion/archive/v2.0.tar.gz','https://github.com/moble/spherical_functions/archive/master.zip'],
166 ext_modules=cythonize([qpms_c, cywaves, cytranslations, cytmatrices, cycommon, cyquaternions, cybspec, cymaterials, cyewaldtest], include_path=['qpms', 'amos'], gdb_debug=True),
167 cmdclass = {'build_ext': build_ext},
168 zip_safe=False