Skip to content

Commit da5253a

Browse files
Robert M OchshornRobert M Ochshorn
authored andcommitted
pyinstaller is driving me mad.
there was one bug that was genuinely ours: by moving the extensions into ext/, but keeping them (in gentle.spec) in Resources/, shelling out to them failed. fine. i've fixed that by moving the entire ext/ folder to Resources/. as a hack, ffmpeg is in there too, so the get_binary function adds ext/ if we're frozen. i have no idea why pyinstaller all of a sudden (using the python.org python) decided to put the entire gentle/ directory into the bundle. there's an egregious hack in make_dmg.sh to work around that.
1 parent 77d24a9 commit da5253a

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

gentle.spec

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,44 +4,41 @@ block_cipher = None
44
import os
55

66
data_files = []
7-
for dirpath in ['www', 'data', 'PROTO_LANGDIR']:
7+
for dirpath in ['www', 'data', 'PROTO_LANGDIR', 'ext']:
88
data_files.append((dirpath, dirpath))
9-
for exepath in ['ffmpeg', 'ext/standard_kaldi', 'ext/mkgraph']:
10-
data_files.append((exepath, ''))
119

1210
a = Analysis(['gentle.py'],
1311
pathex=[os.path.abspath(os.curdir)],
1412
binaries=None,
1513
datas=data_files,
1614
hiddenimports=[],
17-
hookspath=None,
18-
runtime_hooks=None,
19-
excludes=None,
20-
win_no_prefer_redirects=None,
21-
win_private_assemblies=None,
15+
hookspath=[],
16+
runtime_hooks=[],
17+
excludes=[],
18+
win_no_prefer_redirects=False,
19+
win_private_assemblies=False,
2220
cipher=block_cipher)
2321
pyz = PYZ(a.pure, a.zipped_data,
2422
cipher=block_cipher)
2523
exe = EXE(pyz,
2624
a.scripts,
2725
exclude_binaries=True,
28-
name='gentle',
26+
name='gentler',
2927
debug=False,
30-
strip=None,
31-
upx=False,
28+
strip=False,
29+
upx=True,
3230
console=False )
3331
coll = COLLECT(exe,
3432
a.binaries,
3533
a.zipfiles,
3634
a.datas,
37-
strip=None,
35+
strip=False,
3836
upx=True,
39-
name='gentle')
37+
name='gentler')
4038
app = BUNDLE(coll,
4139
name='gentle.app',
4240
icon=None,
4341
bundle_identifier=None,
4442
info_plist={
4543
'NSHighResolutionCapable': 'True'
46-
},
47-
)
44+
})

gentle/paths.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
def get_binary(name):
88
binpath = name
99
if hasattr(sys, "frozen"):
10+
# HACK
11+
if name == 'ffmpeg':
12+
name = 'ext/ffmpeg'
1013
binpath = os.path.abspath(os.path.join(sys._MEIPASS, '..', 'Resources', name))
1114
elif os.path.exists(name):
1215
binpath = "./%s" % (name)

make_dmg.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
pyinstaller gentle.spec
2+
3+
# For unknown reasons, pyinstaller suddenly started dumping this
4+
# entire root directory into the folder (ie. once I changed the system
5+
# python from homebrew to python.org). This makes zero sense. But in
6+
# lieu of tracking down the bug, let's just go in and delete some of
7+
# the nastier, offending files.
8+
cd dist/gentle.app/Contents/Resources
9+
rm -rf COPYING Dockerfile *.sh examples *.spec include lib tests *.pyc gentle *.py *.bkp webdata \
10+
.git* .travis.yml .DS_Store \
11+
ext/kaldi ext/*.dSYM ext/Makefile ext/*.cc
12+
cd ../MacOS
13+
rm COPYING Dockerfile *.sh examples *.spec include lib tests *.pyc gentle *.py *.bkp webdata \
14+
.git* .travis.yml .DS_Store
15+
cd ../../../../
16+
17+
hdiutil create dist/gentle.dmg -volname "Gentle" -srcfolder dist/gentle.app/

0 commit comments

Comments
 (0)