- Timestamp:
- Apr 11, 2017 8:08:59 AM (7 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 97c60f8, 9c23f40
- Parents:
- a42fb8e (diff), b854587 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Andrew Jackson <andrew.jackson@…> (04/11/17 08:08:59)
- git-committer:
- GitHub <noreply@…> (04/11/17 08:08:59)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
setup.py
r14bb7a4 rb854587 1 # -*- coding: utf-8 -*- 2 #!/usr/bin/env python 3 1 4 """ 2 5 Setup for SasView 3 #TODO: Add checks to see that all the dependencies are on the system6 TODO: Add checks to see that all the dependencies are on the system 4 7 """ 5 import sys 8 6 9 import os 7 10 import subprocess 8 11 import shutil 9 from setuptools import setup, Extension 12 import sys 10 13 from distutils.command.build_ext import build_ext 11 14 from distutils.core import Command 15 12 16 import numpy as np 17 from setuptools import Extension, setup 13 18 14 19 # Manage version number ###################################### 15 20 import sasview 21 16 22 VERSION = sasview.__version__ 17 23 ############################################################## … … 26 32 # except when there is no such file 27 33 # Todo : make this list generic 28 # plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py',34 # plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py', 29 35 # 'sum_Ap1_1_Ap2.py', 'sum_p1_p2.py', 30 36 # 'testmodel_2.py', 'testmodel.py', … … 36 42 SASVIEW_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") 37 43 38 sas_dir = os.path.join(os.path.expanduser("~"), '.sasview')44 sas_dir = os.path.join(os.path.expanduser("~"), '.sasview') 39 45 if os.path.isdir(sas_dir): 40 46 f_path = os.path.join(sas_dir, "sasview.log") … … 48 54 os.remove(f_path) 49 55 #f_path = os.path.join(sas_dir, 'plugin_models') 50 # if os.path.isdir(f_path):56 # if os.path.isdir(f_path): 51 57 # for f in os.listdir(f_path): 52 58 # if f in plugin_model_list: … … 54 60 # os.remove(file_path) 55 61 if os.path.exists(SASVIEW_BUILD): 56 print("Removing existing build directory", SASVIEW_BUILD, "for a clean build") 62 print("Removing existing build directory", 63 SASVIEW_BUILD, "for a clean build") 57 64 shutil.rmtree(SASVIEW_BUILD) 58 65 … … 64 71 enable_openmp = False 65 72 66 if sys.platform == 'darwin':73 if sys.platform == 'darwin': 67 74 if not is_64bits: 68 75 # Disable OpenMP … … 78 85 79 86 # Options to enable OpenMP 80 copt = 81 'mingw32': ['-fopenmp'],82 'unix': ['-fopenmp']}83 lopt = 84 'mingw32': ['-fopenmp'],85 'unix': ['-lgomp']}87 copt = {'msvc': ['/openmp'], 88 'mingw32': ['-fopenmp'], 89 'unix': ['-fopenmp']} 90 lopt = {'msvc': ['/MANIFEST'], 91 'mingw32': ['-fopenmp'], 92 'unix': ['-lgomp']} 86 93 87 94 # Platform-specific link options 88 platform_lopt = {'msvc' 95 platform_lopt = {'msvc': ['/MANIFEST']} 89 96 platform_copt = {} 90 97 91 98 # Set copts to get compile working on OS X >= 10.9 using clang 92 if sys.platform == 'darwin':99 if sys.platform == 'darwin': 93 100 try: 94 101 darwin_ver = int(os.uname()[2].split('.')[0]) 95 102 if darwin_ver >= 13 and darwin_ver < 14: 96 platform_copt = {'unix' : ['-Wno-error=unused-command-line-argument-hard-error-in-future']} 103 platform_copt = { 104 'unix': ['-Wno-error=unused-command-line-argument-hard-error-in-future']} 97 105 except: 98 106 print("PROBLEM determining Darwin version") 107 99 108 100 109 class DisableOpenMPCommand(Command): … … 115 124 pass 116 125 117 class build_ext_subclass( build_ext ): 126 127 class build_ext_subclass(build_ext): 118 128 def build_extensions(self): 119 129 # Get 64-bitness … … 125 135 if c in copt: 126 136 for e in self.extensions: 127 e.extra_compile_args = copt[ c]137 e.extra_compile_args = copt[c] 128 138 if c in lopt: 129 139 for e in self.extensions: 130 e.extra_link_args = lopt[ c]140 e.extra_link_args = lopt[c] 131 141 132 142 # Platform-specific build options 133 143 if c in platform_lopt: 134 144 for e in self.extensions: 135 e.extra_link_args = platform_lopt[ c]145 e.extra_link_args = platform_lopt[c] 136 146 137 147 if c in platform_copt: 138 148 for e in self.extensions: 139 e.extra_compile_args = platform_copt[ c ] 140 149 e.extra_compile_args = platform_copt[c] 141 150 142 151 build_ext.build_extensions(self) 152 143 153 144 154 class BuildSphinxCommand(Command): … … 174 184 build_sphinx.rebuild() 175 185 186 176 187 # sas module 177 188 package_dir["sas"] = os.path.join("src", "sas") … … 187 198 188 199 # sas.sascalc.invariant 189 package_dir["sas.sascalc.invariant"] = os.path.join("src", "sas", "sascalc", "invariant") 200 package_dir["sas.sascalc.invariant"] = os.path.join( 201 "src", "sas", "sascalc", "invariant") 190 202 packages.extend(["sas.sascalc.invariant"]) 191 203 … … 193 205 guiframe_path = os.path.join("src", "sas", "sasgui", "guiframe") 194 206 package_dir["sas.sasgui.guiframe"] = guiframe_path 195 package_dir["sas.sasgui.guiframe.local_perspectives"] = os.path.join(os.path.join(guiframe_path, "local_perspectives")) 207 package_dir["sas.sasgui.guiframe.local_perspectives"] = os.path.join( 208 os.path.join(guiframe_path, "local_perspectives")) 196 209 package_data["sas.sasgui.guiframe"] = ['images/*', 'media/*'] 197 packages.extend(["sas.sasgui.guiframe", "sas.sasgui.guiframe.local_perspectives"]) 210 packages.extend( 211 ["sas.sasgui.guiframe", "sas.sasgui.guiframe.local_perspectives"]) 198 212 # build local plugin 199 213 for d in os.listdir(os.path.join(guiframe_path, "local_perspectives")): … … 201 215 package_name = "sas.sasgui.guiframe.local_perspectives." + d 202 216 packages.append(package_name) 203 package_dir[package_name] = os.path.join(guiframe_path, "local_perspectives", d) 217 package_dir[package_name] = os.path.join( 218 guiframe_path, "local_perspectives", d) 204 219 205 220 # sas.sascalc.dataloader 206 package_dir["sas.sascalc.dataloader"] = os.path.join("src", "sas", "sascalc", "dataloader") 207 package_data["sas.sascalc.dataloader.readers"] = ['defaults.json', 'schema/*.xsd'] 208 packages.extend(["sas.sascalc.dataloader", "sas.sascalc.dataloader.readers", "sas.sascalc.dataloader.readers.schema"]) 221 package_dir["sas.sascalc.dataloader"] = os.path.join( 222 "src", "sas", "sascalc", "dataloader") 223 package_data["sas.sascalc.dataloader.readers"] = [ 224 'defaults.json', 'schema/*.xsd'] 225 packages.extend(["sas.sascalc.dataloader", "sas.sascalc.dataloader.readers", 226 "sas.sascalc.dataloader.readers.schema"]) 227 209 228 210 229 # sas.sascalc.calculator 211 230 gen_dir = os.path.join("src", "sas", "sascalc", "calculator", "c_extensions") 212 231 package_dir["sas.sascalc.calculator.core"] = gen_dir 213 package_dir["sas.sascalc.calculator"] = os.path.join("src", "sas", "sascalc", "calculator") 214 packages.extend(["sas.sascalc.calculator","sas.sascalc.calculator.core"]) 215 ext_modules.append( Extension("sas.sascalc.calculator.core.sld2i", 216 sources = [ 217 os.path.join(gen_dir, "sld2i_module.cpp"), 218 os.path.join(gen_dir, "sld2i.cpp"), 219 os.path.join(gen_dir, "libfunc.c"), 220 os.path.join(gen_dir, "librefl.c"), 221 ], 222 include_dirs=[gen_dir], 223 ) 224 ) 232 package_dir["sas.sascalc.calculator"] = os.path.join( 233 "src", "sas", "sascalc", "calculator") 234 packages.extend(["sas.sascalc.calculator", "sas.sascalc.calculator.core"]) 235 ext_modules.append(Extension("sas.sascalc.calculator.core.sld2i", 236 sources=[ 237 os.path.join(gen_dir, "sld2i_module.cpp"), 238 os.path.join(gen_dir, "sld2i.cpp"), 239 os.path.join(gen_dir, "libfunc.c"), 240 os.path.join(gen_dir, "librefl.c"), 241 ], 242 include_dirs=[gen_dir], 243 ) 244 ) 225 245 226 246 # sas.sascalc.pr 227 srcdir 247 srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") 228 248 package_dir["sas.sascalc.pr.core"] = srcdir 229 249 package_dir["sas.sascalc.pr"] = os.path.join("src", "sas", "sascalc", "pr") 230 packages.extend(["sas.sascalc.pr","sas.sascalc.pr.core"]) 231 ext_modules.append( Extension("sas.sascalc.pr.core.pr_inversion", 232 sources = [os.path.join(srcdir, "Cinvertor.c"), 233 os.path.join(srcdir, "invertor.c"), 234 ], 235 include_dirs=[], 236 ) ) 250 packages.extend(["sas.sascalc.pr", "sas.sascalc.pr.core"]) 251 ext_modules.append(Extension("sas.sascalc.pr.core.pr_inversion", 252 sources=[os.path.join(srcdir, "Cinvertor.c"), 253 os.path.join(srcdir, "invertor.c"), 254 ], 255 include_dirs=[], 256 )) 257 237 258 238 259 # sas.sascalc.file_converter 239 260 mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") 240 261 package_dir["sas.sascalc.file_converter.core"] = mydir 241 package_dir["sas.sascalc.file_converter"] = os.path.join("src", "sas", "sascalc", "file_converter") 242 packages.extend(["sas.sascalc.file_converter", "sas.sascalc.file_converter.core"]) 243 ext_modules.append( Extension("sas.sascalc.file_converter.core.bsl_loader", 244 sources = [os.path.join(mydir, "bsl_loader.c")], 245 include_dirs=[np.get_include()], 246 ) ) 247 248 #sas.sascalc.corfunc 249 package_dir["sas.sascalc.corfunc"] = os.path.join("src", "sas", "sascalc", "corfunc") 262 package_dir["sas.sascalc.file_converter"] = os.path.join( 263 "src", "sas", "sascalc", "file_converter") 264 packages.extend(["sas.sascalc.file_converter", 265 "sas.sascalc.file_converter.core"]) 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 )) 270 271 # sas.sascalc.corfunc 272 package_dir["sas.sascalc.corfunc"] = os.path.join( 273 "src", "sas", "sascalc", "corfunc") 274 250 275 packages.extend(["sas.sascalc.corfunc"]) 251 276 … … 255 280 256 281 # Perspectives 257 package_dir["sas.sasgui.perspectives"] = os.path.join("src", "sas", "sasgui", "perspectives") 258 package_dir["sas.sasgui.perspectives.pr"] = os.path.join("src", "sas", "sasgui", "perspectives", "pr") 259 packages.extend(["sas.sasgui.perspectives","sas.sasgui.perspectives.pr"]) 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"]) 260 287 package_data["sas.sasgui.perspectives.pr"] = ['media/*'] 261 288 262 package_dir["sas.sasgui.perspectives.invariant"] = os.path.join("src", "sas", "sasgui", "perspectives", "invariant") 289 package_dir["sas.sasgui.perspectives.invariant"] = os.path.join( 290 "src", "sas", "sasgui", "perspectives", "invariant") 263 291 packages.extend(["sas.sasgui.perspectives.invariant"]) 264 package_data['sas.sasgui.perspectives.invariant'] = [os.path.join("media",'*')] 265 266 package_dir["sas.sasgui.perspectives.fitting"] = os.path.join("src", "sas", "sasgui", "perspectives", "fitting") 267 package_dir["sas.sasgui.perspectives.fitting.plugin_models"] = os.path.join("src", "sas", "sasgui", "perspectives", "fitting", "plugin_models") 268 packages.extend(["sas.sasgui.perspectives.fitting", "sas.sasgui.perspectives.fitting.plugin_models"]) 269 package_data['sas.sasgui.perspectives.fitting'] = ['media/*', 'plugin_models/*'] 270 271 packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.calculator"]) 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"]) 272 306 package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 273 307 274 package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join("src", "sas", "sasgui", "perspectives", "corfunc") 308 package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join( 309 "src", "sas", "sasgui", "perspectives", "corfunc") 275 310 packages.extend(["sas.sasgui.perspectives.corfunc"]) 276 311 package_data['sas.sasgui.perspectives.corfunc'] = ['media/*'] 277 312 278 package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join("src", "sas", "sasgui", "perspectives", "file_converter") 313 package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join( 314 "src", "sas", "sasgui", "perspectives", "file_converter") 279 315 packages.extend(["sas.sasgui.perspectives.file_converter"]) 280 316 package_data['sas.sasgui.perspectives.file_converter'] = ['media/*'] 281 317 282 318 # Data util 283 package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") 319 package_dir["sas.sascalc.data_util"] = os.path.join( 320 "src", "sas", "sascalc", "data_util") 284 321 packages.append("sas.sascalc.data_util") 285 322 286 323 # Plottools 287 package_dir["sas.sasgui.plottools"] = os.path.join("src", "sas", "sasgui", "plottools") 324 package_dir["sas.sasgui.plottools"] = os.path.join( 325 "src", "sas", "sasgui", "plottools") 288 326 packages.append("sas.sasgui.plottools") 289 327 … … 293 331 294 332 EXTENSIONS = [".c", ".cpp"] 333 295 334 296 335 def append_file(file_list, dir_path): … … 312 351 file_list.append(os.path.join(sub_dir, new_f)) 313 352 353 314 354 # Comment out the following to avoid rebuilding all the models 315 355 file_sources = [] 316 356 append_file(file_sources, gen_dir) 317 357 318 # Wojtek's hacky way to add doc files while bundling egg319 # def add_doc_files(directory):358 # Wojtek's hacky way to add doc files while bundling egg 359 # def add_doc_files(directory): 320 360 # paths = [] 321 361 # for (path, directories, filenames) in os.walk(directory): … … 330 370 package_data['sas.sasview'] = ['images/*', 331 371 'media/*', 372 'logging.ini', 332 373 'test/*.txt', 333 374 'test/1d_data/*', … … 349 390 'lxml', 'h5py', 350 391 351 # #The following dependecies won't install automatically, so assume them352 # #The numbers should be bumped up for matplotlib and wxPython as well.392 # The following dependecies won't install automatically, so assume them 393 # The numbers should be bumped up for matplotlib and wxPython as well. 353 394 # 'numpy>=1.4.1', 'scipy>=0.7.2', 'matplotlib>=0.99.1.1', 354 395 # 'wxPython>=2.8.11', 'pil', 355 356 357 if os.name =='nt':396 ] 397 398 if os.name == 'nt': 358 399 required.extend(['html5lib', 'reportlab']) 359 400 else: … … 364 405 setup( 365 406 name="sasview", 366 version =VERSION,367 description ="SasView application",368 author ="SasView Team",369 author_email ="developers@sasview.org",370 url ="http://sasview.org",371 license ="PSF",372 keywords ="small-angle x-ray and neutron scattering analysis",373 download_url ="https://github.com/SasView/sasview.git",374 package_dir =package_dir,375 packages =packages,376 package_data =package_data,377 ext_modules =ext_modules,378 install_requires =required,379 zip_safe =False,380 entry_points ={381 'console_scripts':[382 383 384 385 cmdclass ={'build_ext': build_ext_subclass,386 387 388 407 version=VERSION, 408 description="SasView application", 409 author="SasView Team", 410 author_email="developers@sasview.org", 411 url="http://sasview.org", 412 license="PSF", 413 keywords="small-angle x-ray and neutron scattering analysis", 414 download_url="https://github.com/SasView/sasview.git", 415 package_dir=package_dir, 416 packages=packages, 417 package_data=package_data, 418 ext_modules=ext_modules, 419 install_requires=required, 420 zip_safe=False, 421 entry_points={ 422 'console_scripts': [ 423 "sasview = sas.sasview.sasview:run", 424 ] 425 }, 426 cmdclass={'build_ext': build_ext_subclass, 427 'docs': BuildSphinxCommand, 428 'disable_openmp': DisableOpenMPCommand} 429 )
Note: See TracChangeset
for help on using the changeset viewer.