source: sasview/installers/sasview_qt5.spec @ 8db20a9

ESS_GUIESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_openclESS_GUI_sync_sascalc
Last change on this file since 8db20a9 was a2b74bb, checked in by Piotr Rozyczko <rozyczko@…>, 6 years ago

A new minimal yml file for windows + modified spec file with no dependency on zmq

  • Property mode set to 100644
File size: 5.9 KB
RevLine 
[aefde77]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
[bb3b1c2]45#datas = [('../src/sas/sasview/images/ball.png', '.')]
[a0ed202]46
[aefde77]47datas.append(('../src/sas/sasview/media','media'))
48datas.append(('../src/sas/sasview/test','test'))
49datas.append(('../src/sas/sasview/custom_config.py','.'))
50datas.append(('../src/sas/sasview/local_config.py','.'))
51datas.append(('../src/sas/sasview/wxcruft.py','.'))
52datas.append(('../src/sas/logger_config.py','.'))
[a0ed202]53datas.append(('../src/sas/logging.ini','.'))
[aefde77]54
55# pyinstaller gets mightily confused by upper/lower case,
56# so some modules need to be copied explicitly to avoid
57# messages like
58# WARNING: Attempted to add Python module twice with different upper/lowercases
59datas.append((os.path.join(PYTHON_LOC,'Lib','SocketServer.py'),'.'))
60datas.append((os.path.join(PYTHON_LOC,'Lib','Queue.py'),'.'))
61
62# TODO
63# NEED BETTER WAY TO DEAL WITH THESE RELATIVE PATHS
64datas.append((os.path.join('..', '..','sasmodels','sasmodels'),'sasmodels'))
65datas.append((os.path.join('..', 'src','sas','sasgui','perspectives','fitting','plugin_models'),'plugin_models'))
66datas.append((os.path.join(PYTHON_LOC,'Library','plugins','platforms'),'platforms'))
[bb3b1c2]67datas.append((os.path.join(PYTHON_LOC,'Lib','site-packages','jedi'),'jedi'))
[aefde77]68
69# These depend on whether we have MKL or Atlas numpy
70if os.path.exists(os.path.join(LIBLOC, LIBPREFIX + 'mkl_core.' + LIBSUFFIX)):
71    datas.append(add_binary(LIBPREFIX + 'mkl_avx2.' + LIBSUFFIX))
72    datas.append(add_binary(LIBPREFIX + 'mkl_def.' + LIBSUFFIX))
73elif os.path.exists(os.path.join(LIBLOC, LIBPREFIX + 'numpy-atlas.' + LIBSUFFIX)):
74    datas.append(add_binary(LIBPREFIX + 'numpy-atlas.' + LIBSUFFIX))
75else:
76    raise Exception("No numerical library for numpy found.")
77
78#import sas.sascalc.dataloader.readers
79#f = os.path.join(sas.sascalc.dataloader.readers.get_data_path(), 'defaults.json')
80#datas.append((f, '.'))
81
82# Add a custom pyopencl hook, as described in
83# https://github.com/pyinstaller/pyinstaller/issues/2130
84from PyInstaller.utils.hooks import copy_metadata
85datas.append(copy_metadata('pyopencl')[0])
86
87import sasmodels
88add_data(sasmodels.data_files())
89
90try:
91    import tinycc
92    add_data(tinycc.data_files())
93except ImportError:
94    warnings.warn("TinyCC package is not available and will not be included")
95
96import periodictable
97add_data(periodictable.data_files())
98
99import matplotlib
100matplotlibdatadir = matplotlib.get_data_path()
101matplotlibdata = findall(matplotlibdatadir)
102for f in matplotlibdata:
103    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:])
104    datas.append((f, os.path.split(dirname)[0]))
105
106binaries = []
107
108# EXCLUDED FILES ############################################################
109# Spelled out to enable easier editing
110excludes = []
111
112# Need to explicitly exclude sasmodels here!!
113excludes.append('sasmodels')
114
115# HIDDEN MODULES ############################################################
116hiddenimports = [
117 'PyQt5',
118 'periodictable.core',
119 'sasmodels.core',
120 'pyopencl',
121 'tinycc',
122 'SocketServer',
123 'logging',
124 'logging.config',
[a0ed202]125 'reportlab', 'reportlab.graphics',
126 'reportlab.graphics.barcode.common',
127 'reportlab.graphics.barcode.code128',
128 'reportlab.graphics.barcode.code93',
129 'reportlab.graphics.barcode.code39',
130 'reportlab.graphics.barcode.lto',
131 'reportlab.graphics.barcode.qr',
132 'reportlab.graphics.barcode.usps',
133 'reportlab.graphics.barcode.usps4s',
134 'reportlab.graphics.barcode.eanbc',
135 'reportlab.graphics.barcode.ecc200datamatrix',
136 'reportlab.graphics.barcode.fourstate',
[aefde77]137 'ipykernel', 'ipykernel.datapub',
[a3221b6]138 'pygments', 'pygments.lexers','pygments.lexers.python',
139 'pygments.styles','pygments.styles.default',
[aefde77]140 'atexit', 'cython', 'sip', 'xhtml2pdf',
[a3221b6]141 'zmq', 'zmq.utils', 'zmq.utils.strtypes',
142 'zmq.utils.jsonapi','zmq.utils.garbage',
[aefde77]143 'zmq.backend.cython','zmq.backend.cffi',
144 'site','lxml._elementpath','lxml.etree',
145 'scipy._lib.messagestream',
146]
147
148a = Analysis([SCRIPT_TO_SOURCE],
149             pathex=[WORK_DIR],
150             binaries=binaries,
151             datas=datas,
152             hiddenimports=hiddenimports,
153             hookspath=[],
154             runtime_hooks=[],
155             excludes=excludes,
156             win_no_prefer_redirects=False,
157             win_private_assemblies=False,
158             cipher=None)
159
160pyz = PYZ(a.pure, a.zipped_data,
161             cipher=None)
162
163exe = EXE(pyz,
164          a.scripts,
165          exclude_binaries=True,
166          name='sasview',
167          debug=False,
168          upx=UPX,
169          icon=os.path.join("../src/sas/sasview/images","ball.ico"),
170          version="version.txt",
171          console=False )
172
173# COLLECT creates a directory instead of a single file.
174coll = COLLECT(exe,
175               a.binaries,
176               a.zipfiles,
177               a.datas,
178               strip=False,
179               upx=UPX,
180               name='sasview')
181
182if platform.system() == 'Darwin':
183    app = BUNDLE(exe,
184        name='SasView.app',
185        icon='../src/sas/sasview/images/ball.ico',
186        bundle_identifier=None)
187
Note: See TracBrowser for help on using the repository browser.