|
4 | 4 | from _version import __version__ |
5 | 5 |
|
6 | 6 | import re, os, sys, subprocess |
7 | | -#import cython_gsl |
8 | 7 | import numpy as np |
9 | 8 |
|
10 | | -from distutils.core import setup |
11 | | -from distutils.extension import Extension |
| 9 | +#from distutils.core import setup |
| 10 | +#from distutils.extension import Extension |
| 11 | +from setuptools import setup, Extension |
| 12 | + |
12 | 13 | from Cython.Distutils import build_ext |
13 | 14 | from Cython.Build import cythonize |
14 | 15 |
|
15 | 16 |
|
| 17 | +import platform |
| 18 | +if platform.system() is 'Darwin': |
| 19 | + print ("Info: since you are running Mac OS, you " |
| 20 | + "may have to install with the following line:\n\n" |
| 21 | + "$ CC=gcc-4.9 ./install\n" |
| 22 | + "(or any equivalent version of gcc)") |
| 23 | + raw_input('Hit any key to continue...') |
| 24 | + |
16 | 25 | VERSIONFILE="_version.py" |
17 | 26 | #verstrline = open(VERSIONFILE, "rt").read() |
18 | 27 | #VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" |
|
23 | 32 | # raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE,)) |
24 | 33 | execfile(VERSIONFILE) |
25 | 34 | verstr = __version__ |
| 35 | +if not verstr[0].isdigit(): |
| 36 | + raise RuntimeError("Unable to determine version from _version.py, " |
| 37 | + "perhaps no git-describe available?") |
26 | 38 |
|
27 | 39 | args = sys.argv[1:] |
28 | 40 | # Make a `cleanall` rule to get rid of intermediate and library files |
|
51 | 63 | # Set up extension and build |
52 | 64 | cy_ext_options = {"compiler_directives": {"profile": True}, "annotate": True} |
53 | 65 | cy_ext = [ |
54 | | - # Extension("beams.bunch", |
55 | | - # ["beams/bunch.pyx"], |
56 | | - # include_dirs=[np.get_include()], |
57 | | - # #extra_compile_args=["-g"], |
58 | | - # #extra_link_args=["-g"], |
59 | | - # libraries=["m"], |
60 | | - # library_dirs=[], |
61 | | - # ), |
62 | 66 | Extension("solvers.grid_functions", |
63 | 67 | ["solvers/grid_functions.pyx"], |
64 | 68 | include_dirs=[np.get_include()], library_dirs=[], libraries=["m"], |
|
70 | 74 | include_dirs=[np.get_include()], library_dirs=[], libraries=["m"], |
71 | 75 | extra_compile_args=["-fopenmp"], |
72 | 76 | extra_link_args=["-fopenmp"], |
73 | | - #extra_compile_args=["-g"], |
74 | | - #extra_link_args=["-g"], |
75 | 77 | ), |
76 | | - #Extension("cobra_functions.random", |
77 | | - #["cobra_functions/random.pyx"], |
78 | | - #include_dirs=[np.get_include(), cython_gsl.get_cython_include_dir()], |
79 | | - ##extra_compile_args=["-g"], |
80 | | - ##extra_link_args=["-g"], |
81 | | - #library_dirs=[], libraries=["gsl", "gslcblas"], |
82 | | - #), |
83 | 78 | Extension("solvers.compute_potential_fgreenm2m", |
84 | 79 | ["solvers/compute_potential_fgreenm2m.pyx"], |
85 | 80 | include_dirs=[np.get_include()], library_dirs=[], libraries=["m"], |
86 | | - #extra_compile_args=["-g"], |
87 | | - #extra_link_args=["-g"], |
88 | 81 | ), |
89 | | -# Extension("cobra_functions.interp1d", |
90 | | -# ["cobra_functions/interp1d.pyx"], |
91 | | -# include_dirs=[np.get_include()], library_dirs=[], libraries=["m"], |
92 | | -# #extra_compile_args=["-g"], |
93 | | -# #extra_link_args=["-g"], |
94 | | -# ), |
95 | 82 | Extension("trackers.transverse_tracking_cython", |
96 | 83 | ["trackers/transverse_tracking_cython.pyx"], |
97 | 84 | include_dirs=[np.get_include()], library_dirs=[], libraries=["m"], |
98 | 85 | extra_compile_args=["-fopenmp"], |
99 | 86 | extra_link_args=["-fopenmp"], |
100 | | - #extra_compile_args=["-g"], |
101 | | - #extra_link_args=["-g"], |
102 | 87 | ), |
103 | 88 | Extension("trackers.detuners_cython", |
104 | 89 | ["trackers/detuners_cython.pyx"], |
105 | 90 | include_dirs=[np.get_include()], library_dirs=[], libraries=["m"], |
106 | 91 | extra_compile_args=["-fopenmp"], |
107 | 92 | extra_link_args=["-fopenmp"], |
108 | | - #extra_compile_args=["-g"], |
109 | | - #extra_link_args=["-g"], |
110 | 93 | ), |
111 | 94 | Extension("rfq.rfq", |
112 | 95 | ["rfq/rfq.pyx"], |
113 | 96 | include_dirs=[np.get_include()], library_dirs=[], libraries=["m"], |
114 | 97 | extra_compile_args=["-fopenmp"], |
115 | 98 | extra_link_args=["-fopenmp"], |
116 | | - #extra_compile_args=["-g"], |
117 | | - #extra_link_args=["-g"], |
118 | 99 | ), |
119 | 100 | Extension("aperture.aperture", |
120 | 101 | ["aperture/aperture.pyx"], |
121 | 102 | include_dirs=[np.get_include()], library_dirs=[], libraries=["m"], |
122 | | - #extra_compile_args=["-fopenmp"], |
123 | | - #extra_link_args=["-fopenmp"], |
124 | | - #extra_compile_args=["-g"], |
125 | | - #extra_link_args=["-g"], |
126 | 103 | ) |
127 | 104 | ] |
128 | 105 |
|
|
134 | 111 | packages=['PyHEADTAIL'], |
135 | 112 | cmdclass={'build_ext': build_ext}, |
136 | 113 | ext_modules=cythonize(cy_ext, **cy_ext_options), |
| 114 | + install_requires=[ |
| 115 | + 'numpy', |
| 116 | + 'scipy', |
| 117 | + 'hdf5', |
| 118 | + 'h5py', |
| 119 | + 'cython' |
| 120 | + ] |
137 | 121 | ) |
0 commit comments