-
Notifications
You must be signed in to change notification settings - Fork 20
/
build.sh
executable file
·39 lines (29 loc) · 1.04 KB
/
build.sh
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
#!/usr/bin/env bash
# Builds the squeeze-alexa codebase:
# * compiling translations
# * copying source, config, docs and scripting to a dist/ folder
# * extracting and cleaning runtime dependencies (using pip)
set -e
root=$(readlink -f "$(dirname $0)/..")
includes="handler.py squeezealexa/ locale/ etc/ metadata/ bin docs/ README.md"
pushd "$root" >/dev/null
dist_dir="$PWD/dist"
echo "Building to $dist_dir"
echo "Installing Dev dependencies..."
poetry install >/dev/null
echo "Installing runtime dependencies with pip..."
# TODO: safer / prettier way of generating requirements.txt
poetry show --no-dev | sed -r 's/(\S+)\s+(\S+).*/\1==\2/' > requirements.txt
[ -e "$dist_dir" ] && rm -rf "$dist_dir"
mkdir "$dist_dir" && cd "$dist_dir"
poetry run pip install -q -r "$root/requirements.txt" -t ./
echo "Cleaning up..."
rm "$root"/requirements*.txt
rm -rf ./*.dist-info/
echo "Copying source and config..."
for inc in $includes; do
cp -r "$root/$inc" "./$inc"
done
echo "Compiling translations..."
"$root/bin/compile-translations"
popd >/dev/null