From 77d59c8016183b29c411ac851e1d194782a9ec5e Mon Sep 17 00:00:00 2001 From: Gabriel Niziolek Date: Wed, 24 Jan 2024 23:15:30 -0300 Subject: [PATCH 1/6] Bump pyinstaller version to 5.13 --- Dockerfiles/Dockerfile-py3.10-win64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/Dockerfile-py3.10-win64 b/Dockerfiles/Dockerfile-py3.10-win64 index b950a53..3dcd93d 100644 --- a/Dockerfiles/Dockerfile-py3.10-win64 +++ b/Dockerfiles/Dockerfile-py3.10-win64 @@ -4,7 +4,7 @@ ENV DEBIAN_FRONTEND noninteractive ARG WINE_VERSION=winehq-staging ARG PYTHON_VERSION=3.10.1 -ARG PYINSTALLER_VERSION=5.3 +ARG PYINSTALLER_VERSION=5.13 # we need wine for this all to work, so we'll use the PPA RUN set -x \ From c1a1d219579ad2bda466359d460f7f602a2d18db Mon Sep 17 00:00:00 2001 From: Gabriel Niziolek Date: Thu, 25 Jan 2024 09:28:50 -0300 Subject: [PATCH 2/6] change docker image --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 40c02e4..bf9ecb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM jackmckew/pyinstaller-windows +FROM ganiziolek/pyinstaller-windows:3.10 COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh From 0ce759f0a343319728a928d8100c93887fd29436 Mon Sep 17 00:00:00 2001 From: Gabriel Niziolek Date: Thu, 25 Jan 2024 10:16:59 -0300 Subject: [PATCH 3/6] add `add_data_dirs` input --- action.yml | 11 +++++++++++ entrypoint.sh | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d913458..833f962 100644 --- a/action.yml +++ b/action.yml @@ -9,22 +9,32 @@ inputs: description: 'Directory containing source code (optional requirements.txt).' required: True default: src + pypi_url: description: 'Specify a custom URL for PYPI' required: False default: https://pypi.python.org/ + pypi_index_url: description: 'Specify a custom URL for PYPI Index' required: False default: https://pypi.python.org/simple + spec: description: 'Specify a file path for .spec file' required: False default: "" + requirements: description: 'Specify a file path for requirements.txt file' required: False default: "requirements.txt" + + add_data_dirs: + description: 'Specify a list of directories to add to the `--add-data` flag, the dirs must be separated by a blank space' + required: False + default: "" + outputs: output: description: 'The output of PyInstaller' @@ -38,3 +48,4 @@ runs: - ${{ inputs.pypi_index_url }} - ${{ inputs.spec }} - ${{ inputs.requirements }} + - ${{ inputs.add_data_dirs }} diff --git a/entrypoint.sh b/entrypoint.sh index 63e443f..1a4c0c8 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,6 +19,8 @@ WORKDIR=${SRCDIR:-/src} SPEC_FILE=${4:-*.spec} +ADD_DATA_DIRS=$6 + python -m pip install --upgrade pip wheel setuptools # @@ -46,9 +48,23 @@ if [ -f $5 ]; then fi # [ -f $5 ] +ADD_DATA="" + +# ADD_DATA_DIRS is empty or not provided +if [ ! -z "$ADD_DATA_DIRS" ]; then + + # Process every directory in the ADD_DATA_DIRS string + for dir in $ADD_DATA_DIRS; do + # Add the formatted directory to the output string + ADD_DATA+="--add-data $SRCDIR/$dir:$dir " + done + + # Remove the extra space at the end of the output string + ADD_DATA=${ADD_DATA::-1} +fi # if [[ "$@" == "" ]]; then -pyinstaller --clean -y --dist ./dist/windows --workpath /tmp $SPEC_FILE +pyinstaller --clean -y $ADD_DATA --dist ./dist/windows --workpath /tmp $SPEC_FILE chown -R --reference=. ./dist/windows # else # sh -c "$@" From d224f5c898ad9e79102ce6ffbaa9e8e7d30b41d2 Mon Sep 17 00:00:00 2001 From: Gabriel Niziolek Date: Thu, 25 Jan 2024 10:31:49 -0300 Subject: [PATCH 4/6] --add-data must be separated by semicolon --- entrypoint.sh | 2 +- test.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 test.sh diff --git a/entrypoint.sh b/entrypoint.sh index 1a4c0c8..16fde76 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -56,7 +56,7 @@ if [ ! -z "$ADD_DATA_DIRS" ]; then # Process every directory in the ADD_DATA_DIRS string for dir in $ADD_DATA_DIRS; do # Add the formatted directory to the output string - ADD_DATA+="--add-data $SRCDIR/$dir:$dir " + ADD_DATA+="--add-data \"$SRCDIR/$dir;$dir\" " done # Remove the extra space at the end of the output string diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..f9d3390 --- /dev/null +++ b/test.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Fail on errors. +set -e + +SRCDIR=$1 + +DIRS=$2 + +# DIRS will receive a list of directories to be processed in +# the form of a string, e.g. "dir1 dir2/subdir2 file1.txt dir3/file3.txt" +# those can be separated by comas or newlines. +# the output need to be in the format: "--add-data $SRCDIR/$dir1/:dir1/" +# so that pyinstaller can process it correctly. +# the output will be in the form of a string, e.g. +# "--add-data /src/dir1/:dir1/ --add-data /src/dir2/subdir2/:dir2/subdir2/ --add-data /src/file1.txt:file1.txt" + +# A string de saída +OUTPUT="" + +# Verifica se DIRS está vazio ou não fornecido +if [ ! -z "$DIRS" ]; then + + # Processa cada diretório na string DIRS + for dir in $DIRS; do + # Adiciona o diretório formatado à string de saída + OUTPUT+="--add-data $SRCDIR/$dir:$dir " + done + # Remove o espaço extra no final da string de saída + OUTPUT=${OUTPUT::-1} +fi + + +# Imprime a string de saída +echo $OUTPUT \ No newline at end of file From bd5c434b9b8582603878c7b03985e8876a01981e Mon Sep 17 00:00:00 2001 From: Gabriel Niziolek Date: Thu, 25 Jan 2024 10:53:43 -0300 Subject: [PATCH 5/6] Revert "--add-data must be separated by semicolon" This reverts commit d224f5c898ad9e79102ce6ffbaa9e8e7d30b41d2. --- entrypoint.sh | 2 +- test.sh | 35 ----------------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) delete mode 100755 test.sh diff --git a/entrypoint.sh b/entrypoint.sh index 16fde76..1a4c0c8 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -56,7 +56,7 @@ if [ ! -z "$ADD_DATA_DIRS" ]; then # Process every directory in the ADD_DATA_DIRS string for dir in $ADD_DATA_DIRS; do # Add the formatted directory to the output string - ADD_DATA+="--add-data \"$SRCDIR/$dir;$dir\" " + ADD_DATA+="--add-data $SRCDIR/$dir:$dir " done # Remove the extra space at the end of the output string diff --git a/test.sh b/test.sh deleted file mode 100755 index f9d3390..0000000 --- a/test.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Fail on errors. -set -e - -SRCDIR=$1 - -DIRS=$2 - -# DIRS will receive a list of directories to be processed in -# the form of a string, e.g. "dir1 dir2/subdir2 file1.txt dir3/file3.txt" -# those can be separated by comas or newlines. -# the output need to be in the format: "--add-data $SRCDIR/$dir1/:dir1/" -# so that pyinstaller can process it correctly. -# the output will be in the form of a string, e.g. -# "--add-data /src/dir1/:dir1/ --add-data /src/dir2/subdir2/:dir2/subdir2/ --add-data /src/file1.txt:file1.txt" - -# A string de saída -OUTPUT="" - -# Verifica se DIRS está vazio ou não fornecido -if [ ! -z "$DIRS" ]; then - - # Processa cada diretório na string DIRS - for dir in $DIRS; do - # Adiciona o diretório formatado à string de saída - OUTPUT+="--add-data $SRCDIR/$dir:$dir " - done - # Remove o espaço extra no final da string de saída - OUTPUT=${OUTPUT::-1} -fi - - -# Imprime a string de saída -echo $OUTPUT \ No newline at end of file From e40854d22c1ed441bc8cbab4449c2682d6940729 Mon Sep 17 00:00:00 2001 From: Gabriel Niziolek Date: Thu, 25 Jan 2024 10:53:51 -0300 Subject: [PATCH 6/6] Revert "add `add_data_dirs` input" This reverts commit 0ce759f0a343319728a928d8100c93887fd29436. --- action.yml | 11 ----------- entrypoint.sh | 18 +----------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/action.yml b/action.yml index 833f962..d913458 100644 --- a/action.yml +++ b/action.yml @@ -9,32 +9,22 @@ inputs: description: 'Directory containing source code (optional requirements.txt).' required: True default: src - pypi_url: description: 'Specify a custom URL for PYPI' required: False default: https://pypi.python.org/ - pypi_index_url: description: 'Specify a custom URL for PYPI Index' required: False default: https://pypi.python.org/simple - spec: description: 'Specify a file path for .spec file' required: False default: "" - requirements: description: 'Specify a file path for requirements.txt file' required: False default: "requirements.txt" - - add_data_dirs: - description: 'Specify a list of directories to add to the `--add-data` flag, the dirs must be separated by a blank space' - required: False - default: "" - outputs: output: description: 'The output of PyInstaller' @@ -48,4 +38,3 @@ runs: - ${{ inputs.pypi_index_url }} - ${{ inputs.spec }} - ${{ inputs.requirements }} - - ${{ inputs.add_data_dirs }} diff --git a/entrypoint.sh b/entrypoint.sh index 1a4c0c8..63e443f 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,8 +19,6 @@ WORKDIR=${SRCDIR:-/src} SPEC_FILE=${4:-*.spec} -ADD_DATA_DIRS=$6 - python -m pip install --upgrade pip wheel setuptools # @@ -48,23 +46,9 @@ if [ -f $5 ]; then fi # [ -f $5 ] -ADD_DATA="" - -# ADD_DATA_DIRS is empty or not provided -if [ ! -z "$ADD_DATA_DIRS" ]; then - - # Process every directory in the ADD_DATA_DIRS string - for dir in $ADD_DATA_DIRS; do - # Add the formatted directory to the output string - ADD_DATA+="--add-data $SRCDIR/$dir:$dir " - done - - # Remove the extra space at the end of the output string - ADD_DATA=${ADD_DATA::-1} -fi # if [[ "$@" == "" ]]; then -pyinstaller --clean -y $ADD_DATA --dist ./dist/windows --workpath /tmp $SPEC_FILE +pyinstaller --clean -y --dist ./dist/windows --workpath /tmp $SPEC_FILE chown -R --reference=. ./dist/windows # else # sh -c "$@"