From e0afd396788fd2b302e230407c71640eee027a8b Mon Sep 17 00:00:00 2001 From: Hari Sekhon Date: Fri, 11 Oct 2019 12:16:10 +0100 Subject: [PATCH] updated python_pyinstaller.sh --- python_pyinstaller.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/python_pyinstaller.sh b/python_pyinstaller.sh index 0f4a23b0..bc9bbbd9 100755 --- a/python_pyinstaller.sh +++ b/python_pyinstaller.sh @@ -13,7 +13,7 @@ # https://www.linkedin.com/in/harisekhon # -# Rough sketch of +# Creates PyInstaller self-contained bundles of all python files given as args or all python files in the current and first subdirectory (to avoid creating bundles of libraries) set -u [ -n "${DEBUG:-}" ] && set -x @@ -37,17 +37,24 @@ section "Compiling and bundling Python code using PyInstaller" start_time="$(start_timer)" -opts="-y" +opts="${PYINSTALLER_OPTS:-}" + +opts="$opts -y" if [ -d pylib ]; then opts="$opts --paths pylib" + if [ -d pylib/resources ]; then + for filename in pylib/resources/*; do + opts="$opts --add-data $filename:resources" + done + fi fi -for x in $filelist; do - type isExcluded &>/dev/null && isExcluded "$x" && continue - echo "compiling => $x" +for filename in $filelist; do + type isExcluded &>/dev/null && isExcluded "$filename" && continue + echo "compiling $filename => dist/$filename" # want opt expansion # shellcheck disable=SC2086 - pyinstaller $opts --hidden-import ConfigParser "$x" + pyinstaller $opts "$filename" echo done