-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpyinstaller.spec
120 lines (95 loc) · 3.48 KB
/
pyinstaller.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/usr/bin/env python
#
#
# Wild Find
#
#
# Copyright 2014 - 2017 Al Brown
#
# Wildlife tracking and mapping
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import platform
import sys
from PyInstaller.utils.win32 import versioninfo
def build_harrier(version):
filename = 'harrier-' + system + '-' + machine
a = Analysis(['harrier.py'])
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts + [('O', '', 'OPTION')],
a.binaries,
a.zipfiles,
a.datas,
name=os.path.join('dist', filename),
icon='wildfind.ico',
version=version,
upx=False)
def build_falconer(version):
filename = 'falconer-' + system + '-' + machine
hidden = ['PySide.QtXml', 'matplotlib.mlab.griddata.natgrid']
a = Analysis(['falconer.py'],
hiddenimports=hidden)
a.datas += Tree('wildfind/falconer/gui', prefix='wildfind/falconer/gui')
a.datas += Tree('wildfind/falconer/htdocs', prefix='wildfind/falconer/htdocs')
if system == 'windows':
a.datas += Tree('/openssl/', prefix='openssl')
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts + [('O', '', 'OPTION')],
a.binaries,
a.zipfiles,
a.datas,
name=os.path.join('dist', filename),
icon='wildfind.ico',
version=version,
upx=False)
def create_version():
search = os.path.join(os.getcwd(), 'wildfind', 'common')
sys.path.append(search)
from version import VERSION
version = VERSION
version.append(0)
ffi = versioninfo.FixedFileInfo(filevers=VERSION,
prodvers=VERSION)
strings = []
strings.append(versioninfo.StringStruct('ProductName',
'Wild Find'))
strings.append(versioninfo.StringStruct('FileDescription',
'Wildlif tracking'))
strings.append(versioninfo.StringStruct('LegalCopyright',
'Copyright 2012 - 2017 Al Brown'))
table = versioninfo.StringTable('040904B0', strings)
sInfo = versioninfo.StringFileInfo([table])
var = versioninfo.VarStruct('Translation', [2057, 1200])
vInfo = versioninfo.VarFileInfo([var])
vvi = versioninfo.VSVersionInfo(ffi, [sInfo, vInfo])
f = open('version.txt', 'w')
f.write(vvi.__unicode__())
f.close()
print 'Version: {}.{}.{}.{}'.format (vvi.ffi.fileVersionMS >> 16,
vvi.ffi.fileVersionMS & 0xffff,
vvi.ffi.fileVersionLS >> 16,
vvi.ffi.fileVersionLS & 0xFFFF)
system = platform.system().lower()
machine = platform.machine().lower()
version = None
if system == 'windows':
create_version()
version = 'version.txt'
build_harrier(version)
build_falconer(version)
if version is not None:
os.remove('version.txt')