source: sasview/installers/sasview_qt5_min_centos.spec @ a22b77a

ESS_GUIESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_openclESS_GUI_sync_sascalc
Last change on this file since a22b77a was a22b77a, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 19 months ago

Explicit dependencies for minimum installation. Fixes broken Ubuntu
builds and is the first attempt at SASVIEW-1250

  • Property mode set to 100644
File size: 6.1 KB
Line 
1# -*- mode: python -*-
2# Modifiable location
3import sys
4import os
5import platform
6
7import warnings
8from distutils.filelist import findall
9
10PYTHON_LOC = sys.exec_prefix
11# Portability settings
12if os.name == 'posix':
13    LIBPREFIX='lib'
14    LIBSUFFIX='so'
15    LIBLOC = os.path.join(PYTHON_LOC,'lib')
16    # Darwin needs UPX=False, Linux actually builds with both...
17    if platform.system() == 'Darwin':
18        UPX=False
19    else:
20        UPX=True
21else:
22    LIBPREFIX=''
23    LIBSUFFIX='dll'
24    LIBLOC = os.path.join(PYTHON_LOC,'Library','bin')
25    UPX=True
26
27SCRIPT_TO_SOURCE = 'sasview.py'
28
29# Warning! pyinstaller/py2exe etc. don't have the __file__ attribute
30WORK_DIR = os.path.dirname(os.path.realpath(sys.argv[0]))
31
32#### LOCAL METHODS
33def add_data(data):
34    for component in data:
35        target = component[0]
36        for filename in component[1]:
37           datas.append((filename, target))
38
39def add_binary(binary):
40    return (os.path.join(LIBLOC,binary),'.')
41
42# ADDITIONAL DATA ############################################################
43datas = [('../src/sas/sasview/images', 'images')]
44
45# datas = [('../src/sas/sasview/images/ball.png', '.')]
46datas = [('../src/sas/sasview/images/ball.ico', '.')]
47
48
49datas.append(('../src/sas/sasview/media','media'))
50datas.append(('../src/sas/sasview/test','test'))
51datas.append(('../src/sas/sasview/custom_config.py','.'))
52datas.append(('../src/sas/sasview/local_config.py','.'))
53# TRN COMMENT OUT
54#datas.append(('../src/sas/sasview/wxcruft.py','.'))
55datas.append(('../src/sas/logger_config.py','.'))
56datas.append(('../src/sas/logging.ini','.'))
57
58# pyinstaller gets mightily confused by upper/lower case,
59# so some modules need to be copied explicitly to avoid
60# messages like
61# WARNING: Attempted to add Python module twice with different upper/lowercases
62# TRN COMMENT OsUT
63# datas.append((os.path.join(PYTHON_LOC,'Lib','SocketServer.py'),'.'))
64# datas.append((os.path.join(PYTHON_LOC,'Lib','Queue.py'),'.'))
65
66# TODO
67# NEED BETTER WAY TO DEAL WITH THESE RELATIVE PATHS
68datas.append((os.path.join('..', '..','sasmodels','sasmodels'),'sasmodels'))
69datas.append((os.path.join('..', 'src','sas','sasgui','perspectives','fitting','plugin_models'),'plugin_models'))
70datas.append((os.path.join(PYTHON_LOC,'lib','python3.6', 'site-packages','jedi'),'jedi'))
71
72# TRN COMMENT OUT
73# datas.append((os.path.join(PYTHON_LOC,'Library','plugins','platforms'),'platforms'))
74#sdatas.append((os.path.join(PYTHON_LOC,'Lib','site-packages','zmq','libzmq.cp36-win_amd64.pyd'),'.'))
75
76#
77# # These depend on whether we have MKL or Atlas numpy
78# if os.path.exists(os.path.join(LIBLOC, LIBPREFIX + 'mkl_core.' + LIBSUFFIX)):
79#     datas.append(add_binary(LIBPREFIX + 'mkl_avx2.' + LIBSUFFIX))
80#     datas.append(add_binary(LIBPREFIX + 'mkl_def.' + LIBSUFFIX))
81# elif os.path.exists(os.path.join(LIBLOC, LIBPREFIX + 'numpy-atlas.' + LIBSUFFIX)):
82#     datas.append(add_binary(LIBPREFIX + 'numpy-atlas.' + LIBSUFFIX))
83# else:
84#     raise Exception("No numerical library for numpy found.")
85
86
87#import sas.sascalc.dataloader.readers
88#f = os.path.join(sas.sascalc.dataloader.readers.get_data_path(), 'defaults.json')
89#datas.append((f, '.'))
90
91# # Add a custom pyopencl hook, as described in
92# # https://github.com/pyinstaller/pyinstaller/issues/2130
93# from PyInstaller.utils.hooks import copy_metadata
94# datas.append(copy_metadata('pyopencl')[0])
95
96import sasmodels
97add_data(sasmodels.data_files())
98
99try:
100    import tinycc
101    add_data(tinycc.data_files())
102except ImportError:
103    warnings.warn("TinyCC package is not available and will not be included")
104
105import periodictable
106add_data(periodictable.data_files())
107
108import matplotlib
109matplotlibdatadir = matplotlib.get_data_path()
110matplotlibdata = findall(matplotlibdatadir)
111for f in matplotlibdata:
112    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:])
113    datas.append((f, os.path.split(dirname)[0]))
114
115binaries = []
116
117# EXCLUDED FILES ############################################################
118# Spelled out to enable easier editing
119excludes = []
120
121# Need to explicitly exclude sasmodels here!!
122excludes.append('sasmodels')
123
124# HIDDEN MODULES ############################################################
125hiddenimports = [
126 'PyQt5',
127 'periodictable.core',
128 'sasmodels.core',
129  #'pyopencl',
130  #'tinycc',
131  #'SocketServer',
132 'logging',
133 'logging.config',
134 'reportlab', 'reportlab.graphics',
135 'reportlab.graphics.barcode.common',
136 'reportlab.graphics.barcode.code128',
137 'reportlab.graphics.barcode.code93',
138 'reportlab.graphics.barcode.code39',
139 'reportlab.graphics.barcode.lto',
140 'reportlab.graphics.barcode.qr',
141 'reportlab.graphics.barcode.usps',
142 'reportlab.graphics.barcode.usps4s',
143 'reportlab.graphics.barcode.eanbc',
144 'reportlab.graphics.barcode.ecc200datamatrix',
145 'reportlab.graphics.barcode.fourstate',
146 'ipykernel', 'ipykernel.datapub',
147 'pygments', 'pygments.lexers','pygments.lexers.python',
148 'pygments.styles','pygments.styles.default',
149 'atexit', 'cython', 'sip', 'xhtml2pdf',
150 'zmq', 'zmq.utils', 'zmq.utils.strtypes',
151 'zmq.utils.jsonapi','zmq.utils.garbage',
152 'zmq.backend.cython','zmq.backend.cffi',
153 'site','lxml._elementpath','lxml.etree',
154 'scipy._lib.messagestream',
155 'IPython',
156]
157
158a = Analysis([SCRIPT_TO_SOURCE],
159             pathex=[WORK_DIR],
160             binaries=binaries,
161             datas=datas,
162             hiddenimports=hiddenimports,
163             hookspath=[],
164             runtime_hooks=[],
165             excludes=excludes,
166             win_no_prefer_redirects=False,
167             win_private_assemblies=False,
168             cipher=None)
169
170pyz = PYZ(a.pure, a.zipped_data,
171             cipher=None)
172
173exe = EXE(pyz,
174          a.scripts,
175          exclude_binaries=True,
176          name='sasview',
177          debug=False,
178          upx=UPX,
179          icon=os.path.join("../src/sas/sasview/images","ball.ico"),
180          version="version.txt",
181          console=False )
182
183# COLLECT creates a directory instead of a single file.
184coll = COLLECT(exe,
185               a.binaries,
186               a.zipfiles,
187               a.datas,
188               strip=False,
189               upx=UPX,
190               name='sasview')
191
192if platform.system() == 'Darwin':
193    app = BUNDLE(exe,
194        name='SasView.app',
195        icon='../src/sas/sasview/images/ball.ico',
196        bundle_identifier=None)
197
Note: See TracBrowser for help on using the repository browser.