|
8 | 8 | Scripts: pdffit2
|
9 | 9 | """
|
10 | 10 |
|
| 11 | +import glob |
11 | 12 | import os
|
12 | 13 | import re
|
13 | 14 | import sys
|
14 | 15 | import warnings
|
15 | 16 |
|
16 |
| -from setuptools import Extension, find_packages, setup |
| 17 | +from setuptools import Extension, setup |
| 18 | + |
| 19 | +# Use this version when git data are not available, like in git zip archive. |
| 20 | +# Update when tagging a new release. |
| 21 | +FALLBACK_VERSION = "1.4.3" |
17 | 22 |
|
18 | 23 | MYDIR = os.path.dirname(os.path.abspath(__file__))
|
19 | 24 |
|
@@ -98,50 +103,30 @@ def get_gsl_config_win():
|
98 | 103 | library_dirs += gcfg["library_dirs"]
|
99 | 104 | # add optimization flags for other compilers if needed
|
100 | 105 |
|
| 106 | +# define extension arguments here |
| 107 | +ext_kws = { |
| 108 | + "include_dirs": include_dirs, |
| 109 | + "libraries": libraries, |
| 110 | + "library_dirs": library_dirs, |
| 111 | + "define_macros": define_macros, |
| 112 | + "extra_compile_args": extra_compile_args, |
| 113 | + "extra_link_args": extra_link_args, |
| 114 | + "extra_objects": extra_objects, |
| 115 | +} |
| 116 | + |
101 | 117 |
|
102 | 118 | # define extension here
|
103 |
| -pdffit2module = Extension( |
104 |
| - "diffpy.pdffit2.pdffit2", |
105 |
| - [ |
106 |
| - "src/extensions/pdffit2module/bindings.cc", |
107 |
| - "src/extensions/pdffit2module/misc.cc", |
108 |
| - "src/extensions/pdffit2module/pdffit2module.cc", |
109 |
| - "src/extensions/pdffit2module/pyexceptions.cc", |
110 |
| - "src/extensions/libpdffit2/Atom.cc", |
111 |
| - "src/extensions/libpdffit2/LocalPeriodicTable.cc", |
112 |
| - "src/extensions/libpdffit2/OutputStreams.cc", |
113 |
| - "src/extensions/libpdffit2/PeriodicTable.cc", |
114 |
| - "src/extensions/libpdffit2/PointsInSphere.cc", |
115 |
| - "src/extensions/libpdffit2/StringUtils.cc", |
116 |
| - "src/extensions/libpdffit2/fit.cc", |
117 |
| - "src/extensions/libpdffit2/gaussj.cc", |
118 |
| - "src/extensions/libpdffit2/metric.cc", |
119 |
| - "src/extensions/libpdffit2/nrutil.cc", |
120 |
| - "src/extensions/libpdffit2/output.cc", |
121 |
| - "src/extensions/libpdffit2/parser.cc", |
122 |
| - "src/extensions/libpdffit2/pdf.cc", |
123 |
| - "src/extensions/libpdffit2/pdffit.cc", |
124 |
| - "src/extensions/libpdffit2/pdflsmin.cc", |
125 |
| - "src/extensions/libpdffit2/scatlen.cc", |
126 |
| - "src/extensions/libpdffit2/stru.cc", |
127 |
| - ], |
128 |
| - include_dirs=include_dirs, |
129 |
| - libraries=libraries, |
130 |
| - library_dirs=library_dirs, |
131 |
| - define_macros=define_macros, |
132 |
| - extra_compile_args=extra_compile_args, |
133 |
| - extra_link_args=extra_link_args, |
134 |
| - extra_objects=extra_objects, |
135 |
| -) |
| 119 | +def create_extensions(): |
| 120 | + ext = Extension("diffpy.pdffit2.pdffit2", glob.glob("src/extensions/**/*.cc"), **ext_kws) |
| 121 | + return [ext] |
| 122 | + |
136 | 123 |
|
137 | 124 | setup_args = dict(
|
138 |
| - packages=find_packages(where="src"), |
139 |
| - package_dir={"": "src"}, |
140 |
| - ext_modules=[pdffit2module], |
141 |
| - # scripts=[] # place examples here |
| 125 | + ext_modules=[], |
142 | 126 | )
|
143 | 127 |
|
144 | 128 | if __name__ == "__main__":
|
| 129 | + setup_args["ext_modules"] = create_extensions() |
145 | 130 | setup(**setup_args)
|
146 | 131 |
|
147 | 132 | # End of file
|
0 commit comments