Make build script support multiple scripts
parent
06430cd24d
commit
fbb594b0b5
20
build.sh
20
build.sh
|
@ -5,10 +5,22 @@ set -eE
|
|||
./setup.sh
|
||||
source .venv/bin/activate
|
||||
pip install pyinstaller
|
||||
pyinstaller -y precise.engine.spec
|
||||
|
||||
out_name="precise-engine_$(precise-engine --version 2>&1)_$(uname -m).tar.gz"
|
||||
rm -rf dist/
|
||||
|
||||
for script in listen train calc_threshold; do
|
||||
tmp_name=$(mktemp).spec
|
||||
cat "precise.template.spec" | sed -e 's/%%SCRIPT%%/'"$script"'/gm' > "$tmp_name"
|
||||
pyinstaller -y "$tmp_name"
|
||||
done
|
||||
|
||||
items=dist/*
|
||||
for i in $items; do
|
||||
mkdir -p dist/precise
|
||||
cp -R $i/* dist/precise
|
||||
done
|
||||
|
||||
out_name="precise_$(precise-engine --version 2>&1)_$(uname -m).tar.gz"
|
||||
cd dist
|
||||
tar czvf "$out_name" "precise-engine"
|
||||
tar czvf "$out_name" "precise"
|
||||
echo "Wrote to dist/$out_name"
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
# -*- mode: python -*-
|
||||
block_cipher = None
|
||||
|
||||
a = Analysis(['precise/scripts/engine.py'],
|
||||
pathex=['.'],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=['prettyparse', 'speechpy'],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=['PySide', 'PyQt4', 'PyQt5', 'matplotlib'],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher)
|
||||
|
||||
pyz = PYZ(a.pure, a.zipped_data,
|
||||
cipher=block_cipher)
|
||||
|
||||
exe = EXE(pyz,
|
||||
a.scripts,
|
||||
exclude_binaries=True,
|
||||
name='precise-engine',
|
||||
debug=False,
|
||||
strip=True,
|
||||
upx=True,
|
||||
console=True,)
|
||||
|
||||
coll = COLLECT(exe,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
strip=True,
|
||||
upx=True,
|
||||
name='precise-engine')
|
|
@ -0,0 +1,53 @@
|
|||
# -*- mode: python -*-
|
||||
block_cipher = None
|
||||
|
||||
from glob import iglob
|
||||
from os.path import basename, dirname, abspath
|
||||
|
||||
script_name = '%%SCRIPT%%'
|
||||
strip = False
|
||||
site_packages = '.venv/lib/python3.6/site-packages/'
|
||||
print('PATH:', abspath('precise/scripts/{}.py'.format(script_name)))
|
||||
|
||||
a = Analysis(
|
||||
[abspath('precise/scripts/{}.py'.format(script_name))],
|
||||
pathex=['.'],
|
||||
binaries=[
|
||||
(abspath(i), dirname(i.replace(site_packages, '')))
|
||||
for i in iglob(site_packages + "tensorflow/**/*.so", recursive=True)
|
||||
],
|
||||
datas=[],
|
||||
hiddenimports=['prettyparse', 'speechpy'],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=['PySide', 'PyQt4', 'PyQt5', 'matplotlib'],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher
|
||||
)
|
||||
|
||||
pyz = PYZ(
|
||||
a.pure, a.zipped_data,
|
||||
cipher=block_cipher
|
||||
)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
exclude_binaries=True,
|
||||
name='precise-{}'.format(script_name.replace('_', '-')),
|
||||
debug=False,
|
||||
strip=strip,
|
||||
upx=True,
|
||||
console=True
|
||||
)
|
||||
|
||||
coll = COLLECT(
|
||||
exe,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
strip=strip,
|
||||
upx=True,
|
||||
name='precise-{}'.format(script_name.replace('_', '-'))
|
||||
)
|
Loading…
Reference in New Issue