source: sasview/installers/sasview_qt5_min_centos.spec @ bc7371fd

ESS_GUIESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since bc7371fd was 2fe721be, checked in by trnielsen, 6 years ago

spec file more min conda env centos

Changes to be committed:

new file: sasview_qt5_min_centos.spec

  • Property mode set to 100644
File size: 6.0 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'))
70
71# TRN COMMENT OUT
72# datas.append((os.path.join(PYTHON_LOC,'Library','plugins','platforms'),'platforms'))
73#sdatas.append((os.path.join(PYTHON_LOC,'Lib','site-packages','zmq','libzmq.cp36-win_amd64.pyd'),'.'))
74
75#
76# # These depend on whether we have MKL or Atlas numpy
77# if os.path.exists(os.path.join(LIBLOC, LIBPREFIX + 'mkl_core.' + LIBSUFFIX)):
78#     datas.append(add_binary(LIBPREFIX + 'mkl_avx2.' + LIBSUFFIX))
79#     datas.append(add_binary(LIBPREFIX + 'mkl_def.' + LIBSUFFIX))
80# elif os.path.exists(os.path.join(LIBLOC, LIBPREFIX + 'numpy-atlas.' + LIBSUFFIX)):
81#     datas.append(add_binary(LIBPREFIX + 'numpy-atlas.' + LIBSUFFIX))
82# else:
83#     raise Exception("No numerical library for numpy found.")
84#
85
86#import sas.sascalc.dataloader.readers
87#f = os.path.join(sas.sascalc.dataloader.readers.get_data_path(), 'defaults.json')
88#datas.append((f, '.'))
89
90# # Add a custom pyopencl hook, as described in
91# # https://github.com/pyinstaller/pyinstaller/issues/2130
92# from PyInstaller.utils.hooks import copy_metadata
93# datas.append(copy_metadata('pyopencl')[0])
94
95import sasmodels
96add_data(sasmodels.data_files())
97
98try:
99    import tinycc
100    add_data(tinycc.data_files())
101except ImportError:
102    warnings.warn("TinyCC package is not available and will not be included")
103
104import periodictable
105add_data(periodictable.data_files())
106
107import matplotlib
108matplotlibdatadir = matplotlib.get_data_path()
109matplotlibdata = findall(matplotlibdatadir)
110for f in matplotlibdata:
111    dirname = os.path.join('mpl-data', f[len(matplotlibdatadir)+1:])
112    datas.append((f, os.path.split(dirname)[0]))
113
114binaries = []
115
116# EXCLUDED FILES ############################################################
117# Spelled out to enable easier editing
118excludes = []
119
120# Need to explicitly exclude sasmodels here!!
121excludes.append('sasmodels')
122
123# HIDDEN MODULES ############################################################
124hiddenimports = [
125 'PyQt5',
126 'periodictable.core',
127 'sasmodels.core',
128  #'pyopencl',
129  #'tinycc',
130  #'SocketServer',
131 'logging',
132 'logging.config',
133 'reportlab', 'reportlab.graphics',
134 'reportlab.graphics.barcode.common',
135 'reportlab.graphics.barcode.code128',
136 'reportlab.graphics.barcode.code93',
137 'reportlab.graphics.barcode.code39',
138 'reportlab.graphics.barcode.lto',
139 'reportlab.graphics.barcode.qr',
140 'reportlab.graphics.barcode.usps',
141 'reportlab.graphics.barcode.usps4s',
142 'reportlab.graphics.barcode.eanbc',
143 'reportlab.graphics.barcode.ecc200datamatrix',
144 'reportlab.graphics.barcode.fourstate',
145 'ipykernel', 'ipykernel.datapub',
146 'pygments', 'pygments.lexers','pygments.lexers.python',
147 'pygments.styles','pygments.styles.default',
148 'atexit', 'cython', 'sip', 'xhtml2pdf',
149 'zmq', 'zmq.utils', 'zmq.utils.strtypes',
150 'zmq.utils.jsonapi','zmq.utils.garbage',
151 'zmq.backend.cython','zmq.backend.cffi',
152 'site','lxml._elementpath','lxml.etree',
153 'scipy._lib.messagestream',
154]
155
156a = Analysis([SCRIPT_TO_SOURCE],
157             pathex=[WORK_DIR],
158             binaries=binaries,
159             datas=datas,
160             hiddenimports=hiddenimports,
161             hookspath=[],
162             runtime_hooks=[],
163             excludes=excludes,
164             win_no_prefer_redirects=False,
165             win_private_assemblies=False,
166             cipher=None)
167
168pyz = PYZ(a.pure, a.zipped_data,
169             cipher=None)
170
171exe = EXE(pyz,
172          a.scripts,
173          exclude_binaries=True,
174          name='sasview',
175          debug=False,
176          upx=UPX,
177          icon=os.path.join("../src/sas/sasview/images","ball.ico"),
178          version="version.txt",
179          console=False )
180
181# COLLECT creates a directory instead of a single file.
182coll = COLLECT(exe,
183               a.binaries,
184               a.zipfiles,
185               a.datas,
186               strip=False,
187               upx=UPX,
188               name='sasview')
189
190if platform.system() == 'Darwin':
191    app = BUNDLE(exe,
192        name='SasView.app',
193        icon='../src/sas/sasview/images/ball.ico',
194        bundle_identifier=None)
195
Note: See TracBrowser for help on using the repository browser.