Changes in setup.py [14bb7a4:7a5d066] in sasview
Legend:
- Unmodified
- Added
- Removed
-
setup.py
r14bb7a4 r7a5d066 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"] = ['schema/*.xsd'] 224 packages.extend(["sas.sascalc.dataloader", "sas.sascalc.dataloader.readers", 225 "sas.sascalc.dataloader.readers.schema"]) 226 209 227 210 228 # sas.sascalc.calculator 211 229 gen_dir = os.path.join("src", "sas", "sascalc", "calculator", "c_extensions") 212 230 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 ) 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=[ 236 os.path.join(gen_dir, "sld2i_module.cpp"), 237 os.path.join(gen_dir, "sld2i.cpp"), 238 os.path.join(gen_dir, "libfunc.c"), 239 os.path.join(gen_dir, "librefl.c"), 240 ], 241 include_dirs=[gen_dir], 242 ) 243 ) 225 244 226 245 # sas.sascalc.pr 227 srcdir 246 srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") 228 247 package_dir["sas.sascalc.pr.core"] = srcdir 229 248 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 ) ) 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 )) 256 237 257 238 258 # sas.sascalc.file_converter 239 259 mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") 240 260 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") 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"]) 265 ext_modules.append(Extension("sas.sascalc.file_converter.core.bsl_loader", 266 sources=[os.path.join(mydir, "bsl_loader.c")], 267 include_dirs=[np.get_include()], 268 )) 269 270 # sas.sascalc.corfunc 271 package_dir["sas.sascalc.corfunc"] = os.path.join( 272 "src", "sas", "sascalc", "corfunc") 273 250 274 packages.extend(["sas.sascalc.corfunc"]) 251 275 … … 255 279 256 280 # 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"]) 281 package_dir["sas.sasgui.perspectives"] = os.path.join( 282 "src", "sas", "sasgui", "perspectives") 283 package_dir["sas.sasgui.perspectives.pr"] = os.path.join( 284 "src", "sas", "sasgui", "perspectives", "pr") 285 packages.extend(["sas.sasgui.perspectives", "sas.sasgui.perspectives.pr"]) 260 286 package_data["sas.sasgui.perspectives.pr"] = ['media/*'] 261 287 262 package_dir["sas.sasgui.perspectives.invariant"] = os.path.join("src", "sas", "sasgui", "perspectives", "invariant") 288 package_dir["sas.sasgui.perspectives.invariant"] = os.path.join( 289 "src", "sas", "sasgui", "perspectives", "invariant") 263 290 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"]) 291 package_data['sas.sasgui.perspectives.invariant'] = [ 292 os.path.join("media", '*')] 293 294 package_dir["sas.sasgui.perspectives.fitting"] = os.path.join( 295 "src", "sas", "sasgui", "perspectives", "fitting") 296 package_dir["sas.sasgui.perspectives.fitting.plugin_models"] = os.path.join( 297 "src", "sas", "sasgui", "perspectives", "fitting", "plugin_models") 298 packages.extend(["sas.sasgui.perspectives.fitting", 299 "sas.sasgui.perspectives.fitting.plugin_models"]) 300 package_data['sas.sasgui.perspectives.fitting'] = [ 301 'media/*', 'plugin_models/*'] 302 303 packages.extend(["sas.sasgui.perspectives", 304 "sas.sasgui.perspectives.calculator"]) 272 305 package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 273 306 274 package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join("src", "sas", "sasgui", "perspectives", "corfunc") 307 package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join( 308 "src", "sas", "sasgui", "perspectives", "corfunc") 275 309 packages.extend(["sas.sasgui.perspectives.corfunc"]) 276 310 package_data['sas.sasgui.perspectives.corfunc'] = ['media/*'] 277 311 278 package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join("src", "sas", "sasgui", "perspectives", "file_converter") 312 package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join( 313 "src", "sas", "sasgui", "perspectives", "file_converter") 279 314 packages.extend(["sas.sasgui.perspectives.file_converter"]) 280 315 package_data['sas.sasgui.perspectives.file_converter'] = ['media/*'] 281 316 282 317 # Data util 283 package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") 318 package_dir["sas.sascalc.data_util"] = os.path.join( 319 "src", "sas", "sascalc", "data_util") 284 320 packages.append("sas.sascalc.data_util") 285 321 286 322 # Plottools 287 package_dir["sas.sasgui.plottools"] = os.path.join("src", "sas", "sasgui", "plottools") 323 package_dir["sas.sasgui.plottools"] = os.path.join( 324 "src", "sas", "sasgui", "plottools") 288 325 packages.append("sas.sasgui.plottools") 289 326 … … 293 330 294 331 EXTENSIONS = [".c", ".cpp"] 332 295 333 296 334 def append_file(file_list, dir_path): … … 312 350 file_list.append(os.path.join(sub_dir, new_f)) 313 351 352 314 353 # Comment out the following to avoid rebuilding all the models 315 354 file_sources = [] 316 355 append_file(file_sources, gen_dir) 317 356 318 # Wojtek's hacky way to add doc files while bundling egg319 # def add_doc_files(directory):357 # Wojtek's hacky way to add doc files while bundling egg 358 # def add_doc_files(directory): 320 359 # paths = [] 321 360 # for (path, directories, filenames) in os.walk(directory): … … 330 369 package_data['sas.sasview'] = ['images/*', 331 370 'media/*', 371 'logging.ini', 332 372 'test/*.txt', 333 373 'test/1d_data/*', … … 349 389 'lxml', 'h5py', 350 390 351 # #The following dependecies won't install automatically, so assume them352 # #The numbers should be bumped up for matplotlib and wxPython as well.391 # The following dependecies won't install automatically, so assume them 392 # The numbers should be bumped up for matplotlib and wxPython as well. 353 393 # 'numpy>=1.4.1', 'scipy>=0.7.2', 'matplotlib>=0.99.1.1', 354 394 # 'wxPython>=2.8.11', 'pil', 355 356 357 if os.name =='nt':395 ] 396 397 if os.name == 'nt': 358 398 required.extend(['html5lib', 'reportlab']) 359 399 else: … … 364 404 setup( 365 405 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 406 version=VERSION, 407 description="SasView application", 408 author="SasView Team", 409 author_email="developers@sasview.org", 410 url="http://sasview.org", 411 license="PSF", 412 keywords="small-angle x-ray and neutron scattering analysis", 413 download_url="https://github.com/SasView/sasview.git", 414 package_dir=package_dir, 415 packages=packages, 416 package_data=package_data, 417 ext_modules=ext_modules, 418 install_requires=required, 419 zip_safe=False, 420 entry_points={ 421 'console_scripts': [ 422 "sasview = sas.sasview.sasview:run", 423 ] 424 }, 425 cmdclass={'build_ext': build_ext_subclass, 426 'docs': BuildSphinxCommand, 427 'disable_openmp': DisableOpenMPCommand} 428 )
Note: See TracChangeset
for help on using the changeset viewer.