[f36e01f] | 1 | # -*- coding: utf-8 -*- |
---|
| 2 | #!/usr/bin/env python |
---|
| 3 | |
---|
[d6bc28cf] | 4 | """ |
---|
[c329f4d] | 5 | Setup for SasView |
---|
[f36e01f] | 6 | TODO: Add checks to see that all the dependencies are on the system |
---|
[d6bc28cf] | 7 | """ |
---|
[d66dbcc] | 8 | from __future__ import print_function |
---|
[f36e01f] | 9 | |
---|
[d6bc28cf] | 10 | import os |
---|
[6c7e4cc1] | 11 | import subprocess |
---|
[c8843be] | 12 | import shutil |
---|
[f36e01f] | 13 | import sys |
---|
[2cef9d3] | 14 | from distutils.command.build_ext import build_ext |
---|
[968aa6e] | 15 | from distutils.core import Command |
---|
[f36e01f] | 16 | |
---|
[9a5097c] | 17 | import numpy as np |
---|
[f36e01f] | 18 | from setuptools import Extension, setup |
---|
[d6bc28cf] | 19 | |
---|
[3010f68] | 20 | try: |
---|
| 21 | import tinycc.distutils |
---|
| 22 | except ImportError: |
---|
| 23 | pass |
---|
| 24 | |
---|
[5548954] | 25 | # Manage version number ###################################### |
---|
[efe730d] | 26 | with open(os.path.join("src", "sas", "sasview", "__init__.py")) as fid: |
---|
| 27 | for line in fid: |
---|
| 28 | if line.startswith('__version__'): |
---|
| 29 | VERSION = line.split('"')[1] |
---|
| 30 | break |
---|
| 31 | else: |
---|
| 32 | raise ValueError("Could not find version in src/sas/sasview/__init__.py") |
---|
[5548954] | 33 | ############################################################## |
---|
| 34 | |
---|
[d6bc28cf] | 35 | package_dir = {} |
---|
| 36 | package_data = {} |
---|
| 37 | packages = [] |
---|
| 38 | ext_modules = [] |
---|
| 39 | |
---|
[8ab3302] | 40 | # Remove all files that should be updated by this setup |
---|
[3a39c2e] | 41 | # We do this here because application updates these files from .sasview |
---|
[8ab3302] | 42 | # except when there is no such file |
---|
| 43 | # Todo : make this list generic |
---|
[f36e01f] | 44 | # plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py', |
---|
[a62945e] | 45 | # 'sum_Ap1_1_Ap2.py', 'sum_p1_p2.py', |
---|
| 46 | # 'testmodel_2.py', 'testmodel.py', |
---|
| 47 | # 'polynominal5.pyc', 'sph_bessel_jn.pyc', |
---|
| 48 | # 'sum_Ap1_1_Ap2.pyc', 'sum_p1_p2.pyc', |
---|
| 49 | # 'testmodel_2.pyc', 'testmodel.pyc', 'plugins.log'] |
---|
[c8843be] | 50 | |
---|
| 51 | CURRENT_SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
---|
| 52 | SASVIEW_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") |
---|
| 53 | |
---|
[914ba0a] | 54 | # TODO: build step should not be messing with existing installation!! |
---|
[f36e01f] | 55 | sas_dir = os.path.join(os.path.expanduser("~"), '.sasview') |
---|
[3a39c2e] | 56 | if os.path.isdir(sas_dir): |
---|
| 57 | f_path = os.path.join(sas_dir, "sasview.log") |
---|
[e615a0d] | 58 | if os.path.isfile(f_path): |
---|
| 59 | os.remove(f_path) |
---|
[14ec91c5] | 60 | #f_path = os.path.join(sas_dir, "categories.json") |
---|
| 61 | #if os.path.isfile(f_path): |
---|
| 62 | # os.remove(f_path) |
---|
[3a39c2e] | 63 | f_path = os.path.join(sas_dir, 'config', "custom_config.py") |
---|
[e615a0d] | 64 | if os.path.isfile(f_path): |
---|
| 65 | os.remove(f_path) |
---|
[5881b17] | 66 | #f_path = os.path.join(sas_dir, 'plugin_models') |
---|
[f36e01f] | 67 | # if os.path.isdir(f_path): |
---|
[a62945e] | 68 | # for f in os.listdir(f_path): |
---|
| 69 | # if f in plugin_model_list: |
---|
| 70 | # file_path = os.path.join(f_path, f) |
---|
| 71 | # os.remove(file_path) |
---|
[899e084] | 72 | |
---|
[f542866] | 73 | |
---|
| 74 | # Optionally clean before build. |
---|
| 75 | dont_clean = 'update' in sys.argv |
---|
| 76 | if dont_clean: |
---|
| 77 | sys.argv.remove('update') |
---|
| 78 | elif os.path.exists(SASVIEW_BUILD): |
---|
[d66dbcc] | 79 | print("Removing existing build directory", SASVIEW_BUILD, "for a clean build") |
---|
[899e084] | 80 | shutil.rmtree(SASVIEW_BUILD) |
---|
[18e7309] | 81 | |
---|
[e615a0d] | 82 | # 'sys.maxsize' and 64bit: Not supported for python2.5 |
---|
[899e084] | 83 | is_64bits = sys.maxsize > 2**32 |
---|
[18e7309] | 84 | |
---|
[7a04dbb] | 85 | enable_openmp = False |
---|
[f36e01f] | 86 | if sys.platform == 'darwin': |
---|
[f468791] | 87 | if not is_64bits: |
---|
| 88 | # Disable OpenMP |
---|
| 89 | enable_openmp = False |
---|
| 90 | else: |
---|
| 91 | # Newer versions of Darwin don't support openmp |
---|
| 92 | try: |
---|
| 93 | darwin_ver = int(os.uname()[2].split('.')[0]) |
---|
| 94 | if darwin_ver >= 12: |
---|
| 95 | enable_openmp = False |
---|
| 96 | except: |
---|
[f3bf622] | 97 | print("PROBLEM determining Darwin version") |
---|
[b30ed8f] | 98 | |
---|
| 99 | # Options to enable OpenMP |
---|
[f36e01f] | 100 | copt = {'msvc': ['/openmp'], |
---|
| 101 | 'mingw32': ['-fopenmp'], |
---|
| 102 | 'unix': ['-fopenmp']} |
---|
| 103 | lopt = {'msvc': ['/MANIFEST'], |
---|
| 104 | 'mingw32': ['-fopenmp'], |
---|
| 105 | 'unix': ['-lgomp']} |
---|
[13f00a0] | 106 | |
---|
[ebdb833] | 107 | # Platform-specific link options |
---|
[f36e01f] | 108 | platform_lopt = {'msvc': ['/MANIFEST']} |
---|
[307fa4f] | 109 | platform_copt = {} |
---|
[b9c8fc5] | 110 | |
---|
| 111 | # Set copts to get compile working on OS X >= 10.9 using clang |
---|
[f36e01f] | 112 | if sys.platform == 'darwin': |
---|
[b9c8fc5] | 113 | try: |
---|
| 114 | darwin_ver = int(os.uname()[2].split('.')[0]) |
---|
[4adf48e] | 115 | if darwin_ver >= 13 and darwin_ver < 14: |
---|
[f36e01f] | 116 | platform_copt = { |
---|
| 117 | 'unix': ['-Wno-error=unused-command-line-argument-hard-error-in-future']} |
---|
[b9c8fc5] | 118 | except: |
---|
[f3bf622] | 119 | print("PROBLEM determining Darwin version") |
---|
[b9c8fc5] | 120 | |
---|
[f36e01f] | 121 | |
---|
[5972029] | 122 | class DisableOpenMPCommand(Command): |
---|
| 123 | description = "The version of MinGW that comes with Anaconda does not come with OpenMP :( "\ |
---|
| 124 | "This commands means we can turn off compiling with OpenMP for this or any "\ |
---|
| 125 | "other reason." |
---|
| 126 | user_options = [] |
---|
| 127 | |
---|
| 128 | def initialize_options(self): |
---|
| 129 | self.cwd = None |
---|
| 130 | |
---|
| 131 | def finalize_options(self): |
---|
| 132 | self.cwd = os.getcwd() |
---|
| 133 | global enable_openmp |
---|
| 134 | enable_openmp = False |
---|
[1829835] | 135 | |
---|
[5972029] | 136 | def run(self): |
---|
| 137 | pass |
---|
[ebdb833] | 138 | |
---|
[f36e01f] | 139 | |
---|
| 140 | class build_ext_subclass(build_ext): |
---|
[13f00a0] | 141 | def build_extensions(self): |
---|
| 142 | # Get 64-bitness |
---|
| 143 | c = self.compiler.compiler_type |
---|
[f3bf622] | 144 | print("Compiling with %s (64bit=%s)" % (c, str(is_64bits))) |
---|
[18e7309] | 145 | |
---|
[ebdb833] | 146 | # OpenMP build options |
---|
[b30ed8f] | 147 | if enable_openmp: |
---|
[f3bf622] | 148 | if c in copt: |
---|
[5980b1a] | 149 | for e in self.extensions: |
---|
[f36e01f] | 150 | e.extra_compile_args = copt[c] |
---|
[f3bf622] | 151 | if c in lopt: |
---|
[13f00a0] | 152 | for e in self.extensions: |
---|
[f36e01f] | 153 | e.extra_link_args = lopt[c] |
---|
[18e7309] | 154 | |
---|
[ebdb833] | 155 | # Platform-specific build options |
---|
[f3bf622] | 156 | if c in platform_lopt: |
---|
[ebdb833] | 157 | for e in self.extensions: |
---|
[f36e01f] | 158 | e.extra_link_args = platform_lopt[c] |
---|
[ebdb833] | 159 | |
---|
[f3bf622] | 160 | if c in platform_copt: |
---|
[1829835] | 161 | for e in self.extensions: |
---|
[f36e01f] | 162 | e.extra_compile_args = platform_copt[c] |
---|
[1829835] | 163 | |
---|
[13f00a0] | 164 | build_ext.build_extensions(self) |
---|
[d6bc28cf] | 165 | |
---|
[f36e01f] | 166 | |
---|
[968aa6e] | 167 | class BuildSphinxCommand(Command): |
---|
| 168 | description = "Build Sphinx documentation." |
---|
| 169 | user_options = [] |
---|
| 170 | |
---|
| 171 | def initialize_options(self): |
---|
| 172 | self.cwd = None |
---|
| 173 | |
---|
| 174 | def finalize_options(self): |
---|
| 175 | self.cwd = os.getcwd() |
---|
| 176 | |
---|
[d8c4019] | 177 | def run(self): |
---|
[115eb7e] | 178 | ''' First builds the sasmodels documentation if the directory |
---|
| 179 | is present. Then builds the sasview docs. |
---|
| 180 | ''' |
---|
| 181 | ### AJJ - Add code for building sasmodels docs here: |
---|
| 182 | # check for doc path |
---|
[14bb7a4] | 183 | SASMODELS_DOCPATH = os.path.abspath(os.path.join(os.getcwd(), '..', 'sasmodels', 'doc')) |
---|
| 184 | print("========= check for sasmodels at", SASMODELS_DOCPATH, "============") |
---|
[6c7e4cc1] | 185 | if os.path.exists(SASMODELS_DOCPATH): |
---|
| 186 | if os.path.isdir(SASMODELS_DOCPATH): |
---|
[115eb7e] | 187 | # if available, build sasmodels docs |
---|
[21bba86] | 188 | print("============= Building sasmodels model documentation ===============") |
---|
[14bb7a4] | 189 | smdocbuild = subprocess.call(["make", "-C", SASMODELS_DOCPATH, "html"]) |
---|
[6c7e4cc1] | 190 | else: |
---|
| 191 | # if not available warning message |
---|
[21bba86] | 192 | print("== !!WARNING!! sasmodels directory not found. Cannot build model docs. ==") |
---|
[115eb7e] | 193 | |
---|
| 194 | #Now build sasview (+sasmodels) docs |
---|
[d8c4019] | 195 | sys.path.append("docs/sphinx-docs") |
---|
| 196 | import build_sphinx |
---|
[c2ee2b1] | 197 | build_sphinx.rebuild() |
---|
[968aa6e] | 198 | |
---|
[afdb3b3] | 199 | _ = subprocess.call([sys.executable, "src/sas/qtgui/convertUI.py"]) |
---|
[f36e01f] | 200 | |
---|
[3a39c2e] | 201 | # sas module |
---|
| 202 | package_dir["sas"] = os.path.join("src", "sas") |
---|
| 203 | packages.append("sas") |
---|
[29e96f3] | 204 | |
---|
[e0bbb7c] | 205 | # sas module |
---|
[985ad94] | 206 | # qt module |
---|
| 207 | package_dir["sas.qtgui"] = os.path.join("src", "sas", "qtgui") |
---|
| 208 | packages.append("sas.qtgui") |
---|
| 209 | |
---|
[e0bbb7c] | 210 | # sas module |
---|
| 211 | package_dir["sas.sascalc"] = os.path.join("src", "sas", "sascalc") |
---|
| 212 | packages.append("sas.sascalc") |
---|
| 213 | |
---|
| 214 | # sas.sascalc.invariant |
---|
[f36e01f] | 215 | package_dir["sas.sascalc.invariant"] = os.path.join( |
---|
| 216 | "src", "sas", "sascalc", "invariant") |
---|
[e0bbb7c] | 217 | packages.extend(["sas.sascalc.invariant"]) |
---|
[d6bc28cf] | 218 | |
---|
| 219 | |
---|
[e0bbb7c] | 220 | # sas.sascalc.dataloader |
---|
[f36e01f] | 221 | package_dir["sas.sascalc.dataloader"] = os.path.join( |
---|
| 222 | "src", "sas", "sascalc", "dataloader") |
---|
[7a5d066] | 223 | package_data["sas.sascalc.dataloader.readers"] = ['schema/*.xsd'] |
---|
[f36e01f] | 224 | packages.extend(["sas.sascalc.dataloader", "sas.sascalc.dataloader.readers", |
---|
| 225 | "sas.sascalc.dataloader.readers.schema"]) |
---|
[d6bc28cf] | 226 | |
---|
| 227 | |
---|
[e0bbb7c] | 228 | # sas.sascalc.calculator |
---|
[9e531f2] | 229 | gen_dir = os.path.join("src", "sas", "sascalc", "calculator", "c_extensions") |
---|
| 230 | package_dir["sas.sascalc.calculator.core"] = gen_dir |
---|
[f36e01f] | 231 | package_dir["sas.sascalc.calculator"] = os.path.join( |
---|
| 232 | "src", "sas", "sascalc", "calculator") |
---|
| 233 | packages.extend(["sas.sascalc.calculator", "sas.sascalc.calculator.core"]) |
---|
| 234 | ext_modules.append(Extension("sas.sascalc.calculator.core.sld2i", |
---|
| 235 | sources=[ |
---|
[3010f68] | 236 | os.path.join(gen_dir, "sld2i_module.c"), |
---|
| 237 | os.path.join(gen_dir, "sld2i.c"), |
---|
[f36e01f] | 238 | os.path.join(gen_dir, "libfunc.c"), |
---|
| 239 | os.path.join(gen_dir, "librefl.c"), |
---|
| 240 | ], |
---|
| 241 | include_dirs=[gen_dir], |
---|
| 242 | ) |
---|
| 243 | ) |
---|
[9e531f2] | 244 | |
---|
[b699768] | 245 | # sas.sascalc.pr |
---|
[f36e01f] | 246 | srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") |
---|
[b699768] | 247 | package_dir["sas.sascalc.pr.core"] = srcdir |
---|
[f36e01f] | 248 | package_dir["sas.sascalc.pr"] = os.path.join("src", "sas", "sascalc", "pr") |
---|
| 249 | packages.extend(["sas.sascalc.pr", "sas.sascalc.pr.core"]) |
---|
| 250 | ext_modules.append(Extension("sas.sascalc.pr.core.pr_inversion", |
---|
| 251 | sources=[os.path.join(srcdir, "Cinvertor.c"), |
---|
| 252 | os.path.join(srcdir, "invertor.c"), |
---|
| 253 | ], |
---|
| 254 | include_dirs=[], |
---|
| 255 | )) |
---|
[18e7309] | 256 | |
---|
| 257 | |
---|
| 258 | # sas.sascalc.file_converter |
---|
| 259 | mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") |
---|
| 260 | package_dir["sas.sascalc.file_converter.core"] = mydir |
---|
[f36e01f] | 261 | package_dir["sas.sascalc.file_converter"] = os.path.join( |
---|
| 262 | "src", "sas", "sascalc", "file_converter") |
---|
| 263 | packages.extend(["sas.sascalc.file_converter", |
---|
| 264 | "sas.sascalc.file_converter.core"]) |
---|
[985ad94] | 265 | |
---|
[f36e01f] | 266 | ext_modules.append(Extension("sas.sascalc.file_converter.core.bsl_loader", |
---|
| 267 | sources=[os.path.join(mydir, "bsl_loader.c")], |
---|
| 268 | include_dirs=[np.get_include()], |
---|
| 269 | )) |
---|
[3010f68] | 270 | |
---|
[f36e01f] | 271 | # sas.sascalc.corfunc |
---|
| 272 | package_dir["sas.sascalc.corfunc"] = os.path.join( |
---|
| 273 | "src", "sas", "sascalc", "corfunc") |
---|
[3010f68] | 274 | |
---|
[1e13b53] | 275 | packages.extend(["sas.sascalc.corfunc"]) |
---|
| 276 | |
---|
[b699768] | 277 | # sas.sascalc.fit |
---|
| 278 | package_dir["sas.sascalc.fit"] = os.path.join("src", "sas", "sascalc", "fit") |
---|
| 279 | packages.append("sas.sascalc.fit") |
---|
[3d24489] | 280 | |
---|
| 281 | # Perspectives |
---|
[417c03f] | 282 | # package_dir["sas.sasgui.perspectives"] = os.path.join( |
---|
| 283 | # "src", "sas", "sasgui", "perspectives") |
---|
| 284 | # package_dir["sas.sasgui.perspectives.pr"] = os.path.join( |
---|
| 285 | # "src", "sas", "sasgui", "perspectives", "pr") |
---|
| 286 | # packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.pr"]) |
---|
| 287 | # package_data["sas.sasgui.perspectives.pr"] = ['media/*'] |
---|
| 288 | |
---|
| 289 | # package_dir["sas.sasgui.perspectives.invariant"] = os.path.join( |
---|
| 290 | # "src", "sas", "sasgui", "perspectives", "invariant") |
---|
| 291 | # packages.extend(["sas.sasgui.perspectives.invariant"]) |
---|
| 292 | # package_data['sas.sasgui.perspectives.invariant'] = [ |
---|
| 293 | # os.path.join("media", '*')] |
---|
| 294 | |
---|
| 295 | # package_dir["sas.sasgui.perspectives.fitting"] = os.path.join( |
---|
| 296 | # "src", "sas", "sasgui", "perspectives", "fitting") |
---|
| 297 | # package_dir["sas.sasgui.perspectives.fitting.plugin_models"] = os.path.join( |
---|
| 298 | # "src", "sas", "sasgui", "perspectives", "fitting", "plugin_models") |
---|
| 299 | # packages.extend(["sas.sasgui.perspectives.fitting", |
---|
| 300 | # "sas.sasgui.perspectives.fitting.plugin_models"]) |
---|
| 301 | # package_data['sas.sasgui.perspectives.fitting'] = [ |
---|
| 302 | # 'media/*', 'plugin_models/*'] |
---|
| 303 | |
---|
| 304 | # packages.extend(["sas.sasgui.perspectives", |
---|
| 305 | # "sas.sasgui.perspectives.calculator"]) |
---|
| 306 | # package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] |
---|
| 307 | |
---|
| 308 | # package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join( |
---|
| 309 | # "src", "sas", "sasgui", "perspectives", "corfunc") |
---|
| 310 | # packages.extend(["sas.sasgui.perspectives.corfunc"]) |
---|
| 311 | # package_data['sas.sasgui.perspectives.corfunc'] = ['media/*'] |
---|
| 312 | |
---|
| 313 | # package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join( |
---|
| 314 | # "src", "sas", "sasgui", "perspectives", "file_converter") |
---|
| 315 | # packages.extend(["sas.sasgui.perspectives.file_converter"]) |
---|
| 316 | # package_data['sas.sasgui.perspectives.file_converter'] = ['media/*'] |
---|
[1e13b53] | 317 | |
---|
[d6bc28cf] | 318 | # Data util |
---|
[f36e01f] | 319 | package_dir["sas.sascalc.data_util"] = os.path.join( |
---|
| 320 | "src", "sas", "sascalc", "data_util") |
---|
[b699768] | 321 | packages.append("sas.sascalc.data_util") |
---|
[d6bc28cf] | 322 | |
---|
[417c03f] | 323 | # # Plottools |
---|
| 324 | # package_dir["sas.sasgui.plottools"] = os.path.join( |
---|
| 325 | # "src", "sas", "sasgui", "plottools") |
---|
| 326 | # packages.append("sas.sasgui.plottools") |
---|
[d6bc28cf] | 327 | |
---|
[985ad94] | 328 | # QTGUI |
---|
| 329 | ## UI |
---|
| 330 | package_dir["sas.qtgui.UI"] = os.path.join( |
---|
| 331 | "src", "sas", "qtgui", "UI") |
---|
| 332 | packages.append("sas.qtgui.UI") |
---|
| 333 | |
---|
[377ade1] | 334 | ## UnitTesting |
---|
| 335 | package_dir["sas.qtgui.UnitTesting"] = os.path.join( |
---|
| 336 | "src", "sas", "qtgui", "UnitTesting") |
---|
| 337 | packages.append("sas.qtgui.UnitTesting") |
---|
| 338 | |
---|
[985ad94] | 339 | ## Utilities |
---|
| 340 | package_dir["sas.qtgui.Utilities"] = os.path.join( |
---|
| 341 | "src", "sas", "qtgui", "Utilities") |
---|
| 342 | packages.append("sas.qtgui.Utilities") |
---|
[3b3b40b] | 343 | package_dir["sas.qtgui.UtilitiesUI"] = os.path.join( |
---|
| 344 | "src", "sas", "qtgui", "Utilities","UI") |
---|
| 345 | packages.append("sas.qtgui.Utilities.UI") |
---|
[985ad94] | 346 | |
---|
| 347 | package_dir["sas.qtgui.Calculators"] = os.path.join( |
---|
| 348 | "src", "sas", "qtgui", "Calculators") |
---|
| 349 | package_dir["sas.qtgui.Calculators.UI"] = os.path.join( |
---|
| 350 | "src", "sas", "qtgui", "Calculators", "UI") |
---|
| 351 | packages.extend(["sas.qtgui.Calculators", "sas.qtgui.Calculators.UI"]) |
---|
| 352 | |
---|
| 353 | package_dir["sas.qtgui.MainWindow"] = os.path.join( |
---|
| 354 | "src", "sas", "qtgui", "MainWindow") |
---|
| 355 | package_dir["sas.qtgui.MainWindow.UI"] = os.path.join( |
---|
| 356 | "src", "sas", "qtgui", "MainWindow", "UI") |
---|
| 357 | packages.extend(["sas.qtgui.MainWindow", "sas.qtgui.MainWindow.UI"]) |
---|
| 358 | |
---|
| 359 | ## Perspectives |
---|
| 360 | package_dir["sas.qtgui.Perspectives"] = os.path.join( |
---|
| 361 | "src", "sas", "qtgui", "Perspectives") |
---|
| 362 | packages.append("sas.qtgui.Perspectives") |
---|
| 363 | |
---|
| 364 | package_dir["sas.qtgui.Perspectives.Invariant"] = os.path.join( |
---|
| 365 | "src", "sas", "qtgui", "Perspectives", "Invariant") |
---|
| 366 | package_dir["sas.qtgui.Perspectives.Invariant.UI"] = os.path.join( |
---|
| 367 | "src", "sas", "qtgui", "Perspectives", "Invariant", "UI") |
---|
| 368 | packages.extend(["sas.qtgui.Perspectives.Invariant", "sas.qtgui.Perspectives.Invariant.UI"]) |
---|
| 369 | |
---|
| 370 | package_dir["sas.qtgui.Perspectives.Fitting"] = os.path.join( |
---|
| 371 | "src", "sas", "qtgui", "Perspectives", "Fitting") |
---|
| 372 | package_dir["sas.qtgui.Perspectives.Fitting.UI"] = os.path.join( |
---|
| 373 | "src", "sas", "qtgui", "Perspectives", "Fitting", "UI") |
---|
| 374 | packages.extend(["sas.qtgui.Perspectives.Fitting", "sas.qtgui.Perspectives.Fitting.UI"]) |
---|
| 375 | |
---|
[fa81e94] | 376 | package_dir["sas.qtgui.Perspectives.Inversion"] = os.path.join( |
---|
| 377 | "src", "sas", "qtgui", "Perspectives", "Inversion") |
---|
| 378 | package_dir["sas.qtgui.Perspectives.Inversion.UI"] = os.path.join( |
---|
| 379 | "src", "sas", "qtgui", "Perspectives", "Inversion", "UI") |
---|
| 380 | packages.extend(["sas.qtgui.Perspectives.Inversion", "sas.qtgui.Perspectives.Inversion.UI"]) |
---|
| 381 | |
---|
[0261bc1] | 382 | package_dir["sas.qtgui.Perspectives.Corfunc"] = os.path.join( |
---|
| 383 | "src", "sas", "qtgui", "Perspectives", "Corfunc") |
---|
| 384 | package_dir["sas.qtgui.Perspectives.Corfunc.UI"] = os.path.join( |
---|
| 385 | "src", "sas", "qtgui", "Perspectives", "Corfunc", "UI") |
---|
| 386 | packages.extend(["sas.qtgui.Perspectives.Corfunc", "sas.qtgui.Perspectives.Corfunc.UI"]) |
---|
| 387 | |
---|
[985ad94] | 388 | ## Plotting |
---|
| 389 | package_dir["sas.qtgui.Plotting"] = os.path.join( |
---|
| 390 | "src", "sas", "qtgui", "Plotting") |
---|
| 391 | package_dir["sas.qtgui.Plotting.UI"] = os.path.join( |
---|
| 392 | "src", "sas", "qtgui", "Plotting", "UI") |
---|
| 393 | package_dir["sas.qtgui.Plotting.Slicers"] = os.path.join( |
---|
| 394 | "src", "sas", "qtgui", "Plotting", "Slicers") |
---|
[e20870bc] | 395 | package_dir["sas.qtgui.Plotting.Masks"] = os.path.join( |
---|
| 396 | "src", "sas", "qtgui", "Plotting", "Masks") |
---|
| 397 | packages.extend(["sas.qtgui.Plotting", "sas.qtgui.Plotting.UI", |
---|
| 398 | "sas.qtgui.Plotting.Slicers", "sas.qtgui.Plotting.Masks"]) |
---|
[985ad94] | 399 | |
---|
[9274711] | 400 | # # Last of the sas.models |
---|
| 401 | # package_dir["sas.models"] = os.path.join("src", "sas", "models") |
---|
| 402 | # packages.append("sas.models") |
---|
[2d1b700] | 403 | |
---|
[d6bc28cf] | 404 | EXTENSIONS = [".c", ".cpp"] |
---|
| 405 | |
---|
[f36e01f] | 406 | |
---|
[d6bc28cf] | 407 | def append_file(file_list, dir_path): |
---|
| 408 | """ |
---|
| 409 | Add sources file to sources |
---|
| 410 | """ |
---|
| 411 | for f in os.listdir(dir_path): |
---|
| 412 | if os.path.isfile(os.path.join(dir_path, f)): |
---|
| 413 | _, ext = os.path.splitext(f) |
---|
[4c29e4d] | 414 | if ext.lower() in EXTENSIONS: |
---|
[9e531f2] | 415 | file_list.append(os.path.join(dir_path, f)) |
---|
[d6bc28cf] | 416 | elif os.path.isdir(os.path.join(dir_path, f)) and \ |
---|
| 417 | not f.startswith("."): |
---|
| 418 | sub_dir = os.path.join(dir_path, f) |
---|
| 419 | for new_f in os.listdir(sub_dir): |
---|
| 420 | if os.path.isfile(os.path.join(sub_dir, new_f)): |
---|
| 421 | _, ext = os.path.splitext(new_f) |
---|
[4c29e4d] | 422 | if ext.lower() in EXTENSIONS: |
---|
[9e531f2] | 423 | file_list.append(os.path.join(sub_dir, new_f)) |
---|
[820df88] | 424 | |
---|
[f36e01f] | 425 | |
---|
[820df88] | 426 | # Comment out the following to avoid rebuilding all the models |
---|
[9e531f2] | 427 | file_sources = [] |
---|
| 428 | append_file(file_sources, gen_dir) |
---|
[820df88] | 429 | |
---|
[f36e01f] | 430 | # Wojtek's hacky way to add doc files while bundling egg |
---|
| 431 | # def add_doc_files(directory): |
---|
[5881b17] | 432 | # paths = [] |
---|
| 433 | # for (path, directories, filenames) in os.walk(directory): |
---|
| 434 | # for filename in filenames: |
---|
| 435 | # paths.append(os.path.join(path, filename)) |
---|
| 436 | # return paths |
---|
| 437 | |
---|
| 438 | #doc_files = add_doc_files('doc') |
---|
| 439 | |
---|
[c329f4d] | 440 | # SasView |
---|
[ed03b99] | 441 | package_data['sas'] = ['logging.ini'] |
---|
[5881b17] | 442 | package_data['sas.sasview'] = ['images/*', |
---|
[bbb8a56] | 443 | 'media/*', |
---|
[d4c88e24] | 444 | 'test/*.txt', |
---|
[bbb8a56] | 445 | 'test/1d_data/*', |
---|
| 446 | 'test/2d_data/*', |
---|
[27109e5] | 447 | 'test/convertible_files/*', |
---|
| 448 | 'test/coordinate_data/*', |
---|
| 449 | 'test/image_data/*', |
---|
| 450 | 'test/media/*', |
---|
| 451 | 'test/other_files/*', |
---|
[bbb8a56] | 452 | 'test/save_states/*', |
---|
[7152c82] | 453 | 'test/sesans_data/*', |
---|
| 454 | 'test/upcoming_formats/*', |
---|
[27109e5] | 455 | ] |
---|
[3a39c2e] | 456 | packages.append("sas.sasview") |
---|
[afdb3b3] | 457 | package_data['sas.qtgui'] = ['Calculators/UI/*', |
---|
| 458 | 'MainWindow/UI/*', |
---|
| 459 | 'Perspectives/Corfunc/UI/*', |
---|
| 460 | 'Perspectives/Fitting/UI/*', |
---|
| 461 | 'Perspectives/Invariant/UI/*', |
---|
| 462 | 'Perspectives/Inversion/UI/*', |
---|
| 463 | 'Plotting/UI/*', |
---|
| 464 | 'Utilities/UI/*', |
---|
| 465 | 'UI/*', |
---|
| 466 | 'UI/res/*', |
---|
| 467 | ] |
---|
| 468 | packages.append("sas.qtgui") |
---|
[d6bc28cf] | 469 | |
---|
[9f32c57] | 470 | required = [ |
---|
[3010f68] | 471 | 'bumps>=0.7.5.9', 'periodictable>=1.5.0', 'pyparsing>=2.0.0', |
---|
[db74ee8] | 472 | 'lxml', 'h5py', |
---|
[9f32c57] | 473 | |
---|
[f36e01f] | 474 | # The following dependecies won't install automatically, so assume them |
---|
| 475 | # The numbers should be bumped up for matplotlib and wxPython as well. |
---|
[9f32c57] | 476 | # 'numpy>=1.4.1', 'scipy>=0.7.2', 'matplotlib>=0.99.1.1', |
---|
| 477 | # 'wxPython>=2.8.11', 'pil', |
---|
[f36e01f] | 478 | ] |
---|
[213b445] | 479 | |
---|
[f36e01f] | 480 | if os.name == 'nt': |
---|
[7a211030] | 481 | required.extend(['html5lib', 'reportlab']) |
---|
[7f59928e] | 482 | else: |
---|
[775d06f] | 483 | # 'pil' is now called 'pillow' |
---|
[5f6336f] | 484 | required.extend(['pillow']) |
---|
[5881b17] | 485 | |
---|
[18e7309] | 486 | # Set up SasView |
---|
[d6bc28cf] | 487 | setup( |
---|
[c329f4d] | 488 | name="sasview", |
---|
[f36e01f] | 489 | version=VERSION, |
---|
| 490 | description="SasView application", |
---|
| 491 | author="SasView Team", |
---|
| 492 | author_email="developers@sasview.org", |
---|
| 493 | url="http://sasview.org", |
---|
| 494 | license="PSF", |
---|
| 495 | keywords="small-angle x-ray and neutron scattering analysis", |
---|
| 496 | download_url="https://github.com/SasView/sasview.git", |
---|
| 497 | package_dir=package_dir, |
---|
| 498 | packages=packages, |
---|
| 499 | package_data=package_data, |
---|
| 500 | ext_modules=ext_modules, |
---|
| 501 | install_requires=required, |
---|
| 502 | zip_safe=False, |
---|
| 503 | entry_points={ |
---|
| 504 | 'console_scripts': [ |
---|
[afdb3b3] | 505 | "sasview=sas.qtgui.MainWindow.MainWindow:run_sasview", |
---|
[f36e01f] | 506 | ] |
---|
| 507 | }, |
---|
| 508 | cmdclass={'build_ext': build_ext_subclass, |
---|
| 509 | 'docs': BuildSphinxCommand, |
---|
| 510 | 'disable_openmp': DisableOpenMPCommand} |
---|
| 511 | ) |
---|