Changes in setup.py [7a5d066:14bb7a4] in sasview
Legend:
- Unmodified
- Added
- Removed
-
setup.py
r7a5d066 r14bb7a4 1 # -*- coding: utf-8 -*-2 #!/usr/bin/env python3 4 1 """ 5 2 Setup for SasView 6 TODO: Add checks to see that all the dependencies are on the system3 #TODO: Add checks to see that all the dependencies are on the system 7 4 """ 8 5 import sys 9 6 import os 10 7 import subprocess 11 8 import shutil 12 import sys 9 from setuptools import setup, Extension 13 10 from distutils.command.build_ext import build_ext 14 11 from distutils.core import Command 15 16 12 import numpy as np 17 from setuptools import Extension, setup18 13 19 14 # Manage version number ###################################### 20 15 import sasview 21 22 16 VERSION = sasview.__version__ 23 17 ############################################################## … … 32 26 # except when there is no such file 33 27 # Todo : make this list generic 34 # 28 #plugin_model_list = ['polynominal5.py', 'sph_bessel_jn.py', 35 29 # 'sum_Ap1_1_Ap2.py', 'sum_p1_p2.py', 36 30 # 'testmodel_2.py', 'testmodel.py', … … 42 36 SASVIEW_BUILD = os.path.join(CURRENT_SCRIPT_DIR, "build") 43 37 44 sas_dir = os.path.join(os.path.expanduser("~"), 38 sas_dir = os.path.join(os.path.expanduser("~"),'.sasview') 45 39 if os.path.isdir(sas_dir): 46 40 f_path = os.path.join(sas_dir, "sasview.log") … … 54 48 os.remove(f_path) 55 49 #f_path = os.path.join(sas_dir, 'plugin_models') 56 # 50 #if os.path.isdir(f_path): 57 51 # for f in os.listdir(f_path): 58 52 # if f in plugin_model_list: … … 60 54 # os.remove(file_path) 61 55 if os.path.exists(SASVIEW_BUILD): 62 print("Removing existing build directory", 63 SASVIEW_BUILD, "for a clean build") 56 print("Removing existing build directory", SASVIEW_BUILD, "for a clean build") 64 57 shutil.rmtree(SASVIEW_BUILD) 65 58 … … 71 64 enable_openmp = False 72 65 73 if sys.platform == 66 if sys.platform =='darwin': 74 67 if not is_64bits: 75 68 # Disable OpenMP … … 85 78 86 79 # Options to enable OpenMP 87 copt = {'msvc': ['/openmp'],88 'mingw32': ['-fopenmp'],89 'unix': ['-fopenmp']}90 lopt = {'msvc': ['/MANIFEST'],91 'mingw32': ['-fopenmp'],92 'unix': ['-lgomp']}80 copt = {'msvc': ['/openmp'], 81 'mingw32' : ['-fopenmp'], 82 'unix' : ['-fopenmp']} 83 lopt = {'msvc': ['/MANIFEST'], 84 'mingw32' : ['-fopenmp'], 85 'unix' : ['-lgomp']} 93 86 94 87 # Platform-specific link options 95 platform_lopt = {'msvc' : ['/MANIFEST']}88 platform_lopt = {'msvc' : ['/MANIFEST']} 96 89 platform_copt = {} 97 90 98 91 # Set copts to get compile working on OS X >= 10.9 using clang 99 if sys.platform == 92 if sys.platform =='darwin': 100 93 try: 101 94 darwin_ver = int(os.uname()[2].split('.')[0]) 102 95 if darwin_ver >= 13 and darwin_ver < 14: 103 platform_copt = { 104 'unix': ['-Wno-error=unused-command-line-argument-hard-error-in-future']} 96 platform_copt = {'unix' : ['-Wno-error=unused-command-line-argument-hard-error-in-future']} 105 97 except: 106 98 print("PROBLEM determining Darwin version") 107 108 99 109 100 class DisableOpenMPCommand(Command): … … 124 115 pass 125 116 126 127 class build_ext_subclass(build_ext): 117 class build_ext_subclass( build_ext ): 128 118 def build_extensions(self): 129 119 # Get 64-bitness … … 135 125 if c in copt: 136 126 for e in self.extensions: 137 e.extra_compile_args = copt[ c]127 e.extra_compile_args = copt[ c ] 138 128 if c in lopt: 139 129 for e in self.extensions: 140 e.extra_link_args = lopt[ c]130 e.extra_link_args = lopt[ c ] 141 131 142 132 # Platform-specific build options 143 133 if c in platform_lopt: 144 134 for e in self.extensions: 145 e.extra_link_args = platform_lopt[ c]135 e.extra_link_args = platform_lopt[ c ] 146 136 147 137 if c in platform_copt: 148 138 for e in self.extensions: 149 e.extra_compile_args = platform_copt[c] 139 e.extra_compile_args = platform_copt[ c ] 140 150 141 151 142 build_ext.build_extensions(self) 152 153 143 154 144 class BuildSphinxCommand(Command): … … 184 174 build_sphinx.rebuild() 185 175 186 187 176 # sas module 188 177 package_dir["sas"] = os.path.join("src", "sas") … … 198 187 199 188 # sas.sascalc.invariant 200 package_dir["sas.sascalc.invariant"] = os.path.join( 201 "src", "sas", "sascalc", "invariant") 189 package_dir["sas.sascalc.invariant"] = os.path.join("src", "sas", "sascalc", "invariant") 202 190 packages.extend(["sas.sascalc.invariant"]) 203 191 … … 205 193 guiframe_path = os.path.join("src", "sas", "sasgui", "guiframe") 206 194 package_dir["sas.sasgui.guiframe"] = guiframe_path 207 package_dir["sas.sasgui.guiframe.local_perspectives"] = os.path.join( 208 os.path.join(guiframe_path, "local_perspectives")) 195 package_dir["sas.sasgui.guiframe.local_perspectives"] = os.path.join(os.path.join(guiframe_path, "local_perspectives")) 209 196 package_data["sas.sasgui.guiframe"] = ['images/*', 'media/*'] 210 packages.extend( 211 ["sas.sasgui.guiframe", "sas.sasgui.guiframe.local_perspectives"]) 197 packages.extend(["sas.sasgui.guiframe", "sas.sasgui.guiframe.local_perspectives"]) 212 198 # build local plugin 213 199 for d in os.listdir(os.path.join(guiframe_path, "local_perspectives")): … … 215 201 package_name = "sas.sasgui.guiframe.local_perspectives." + d 216 202 packages.append(package_name) 217 package_dir[package_name] = os.path.join( 218 guiframe_path, "local_perspectives", d) 203 package_dir[package_name] = os.path.join(guiframe_path, "local_perspectives", d) 219 204 220 205 # sas.sascalc.dataloader 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 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"]) 227 209 228 210 # sas.sascalc.calculator 229 211 gen_dir = os.path.join("src", "sas", "sascalc", "calculator", "c_extensions") 230 212 package_dir["sas.sascalc.calculator.core"] = gen_dir 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 ) 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 ) 244 225 245 226 # sas.sascalc.pr 246 srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions")227 srcdir = os.path.join("src", "sas", "sascalc", "pr", "c_extensions") 247 228 package_dir["sas.sascalc.pr.core"] = srcdir 248 229 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 )) 256 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 ) ) 257 237 258 238 # sas.sascalc.file_converter 259 239 mydir = os.path.join("src", "sas", "sascalc", "file_converter", "c_ext") 260 240 package_dir["sas.sascalc.file_converter.core"] = mydir 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 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") 274 250 packages.extend(["sas.sascalc.corfunc"]) 275 251 … … 279 255 280 256 # Perspectives 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"]) 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"]) 286 260 package_data["sas.sasgui.perspectives.pr"] = ['media/*'] 287 261 288 package_dir["sas.sasgui.perspectives.invariant"] = os.path.join( 289 "src", "sas", "sasgui", "perspectives", "invariant") 262 package_dir["sas.sasgui.perspectives.invariant"] = os.path.join("src", "sas", "sasgui", "perspectives", "invariant") 290 263 packages.extend(["sas.sasgui.perspectives.invariant"]) 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"]) 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"]) 305 272 package_data['sas.sasgui.perspectives.calculator'] = ['images/*', 'media/*'] 306 273 307 package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join( 308 "src", "sas", "sasgui", "perspectives", "corfunc") 274 package_dir["sas.sasgui.perspectives.corfunc"] = os.path.join("src", "sas", "sasgui", "perspectives", "corfunc") 309 275 packages.extend(["sas.sasgui.perspectives.corfunc"]) 310 276 package_data['sas.sasgui.perspectives.corfunc'] = ['media/*'] 311 277 312 package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join( 313 "src", "sas", "sasgui", "perspectives", "file_converter") 278 package_dir["sas.sasgui.perspectives.file_converter"] = os.path.join("src", "sas", "sasgui", "perspectives", "file_converter") 314 279 packages.extend(["sas.sasgui.perspectives.file_converter"]) 315 280 package_data['sas.sasgui.perspectives.file_converter'] = ['media/*'] 316 281 317 282 # Data util 318 package_dir["sas.sascalc.data_util"] = os.path.join( 319 "src", "sas", "sascalc", "data_util") 283 package_dir["sas.sascalc.data_util"] = os.path.join("src", "sas", "sascalc", "data_util") 320 284 packages.append("sas.sascalc.data_util") 321 285 322 286 # Plottools 323 package_dir["sas.sasgui.plottools"] = os.path.join( 324 "src", "sas", "sasgui", "plottools") 287 package_dir["sas.sasgui.plottools"] = os.path.join("src", "sas", "sasgui", "plottools") 325 288 packages.append("sas.sasgui.plottools") 326 289 … … 330 293 331 294 EXTENSIONS = [".c", ".cpp"] 332 333 295 334 296 def append_file(file_list, dir_path): … … 350 312 file_list.append(os.path.join(sub_dir, new_f)) 351 313 352 353 314 # Comment out the following to avoid rebuilding all the models 354 315 file_sources = [] 355 316 append_file(file_sources, gen_dir) 356 317 357 # 358 # 318 #Wojtek's hacky way to add doc files while bundling egg 319 #def add_doc_files(directory): 359 320 # paths = [] 360 321 # for (path, directories, filenames) in os.walk(directory): … … 369 330 package_data['sas.sasview'] = ['images/*', 370 331 'media/*', 371 'logging.ini',372 332 'test/*.txt', 373 333 'test/1d_data/*', … … 389 349 'lxml', 'h5py', 390 350 391 # The following dependecies won't install automatically, so assume them392 # The numbers should be bumped up for matplotlib and wxPython as well.351 ## The following dependecies won't install automatically, so assume them 352 ## The numbers should be bumped up for matplotlib and wxPython as well. 393 353 # 'numpy>=1.4.1', 'scipy>=0.7.2', 'matplotlib>=0.99.1.1', 394 354 # 'wxPython>=2.8.11', 'pil', 395 ]396 397 if os.name =='nt':355 ] 356 357 if os.name=='nt': 398 358 required.extend(['html5lib', 'reportlab']) 399 359 else: … … 404 364 setup( 405 365 name="sasview", 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 )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 "sasview = sas.sasview.sasview:run", 383 ] 384 }, 385 cmdclass = {'build_ext': build_ext_subclass, 386 'docs': BuildSphinxCommand, 387 'disable_openmp': DisableOpenMPCommand} 388 )
Note: See TracChangeset
for help on using the changeset viewer.