Skip to content

Commit 9c35675

Browse files
committed
Resolved issue if a local Python source is referenced
Also added the PIP_OPTIONS to the pip upgrade call; otherwise the upgrade might fail if the user needs a special configuration to reach the package index (e.g. coproprate proxy...).
1 parent 8b48c09 commit 9c35675

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

linuxdeploy-plugin-python.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,22 @@ cd "${PYTHON_BUILD_DIR}"
111111

112112

113113
# Install Python from sources
114-
source_dir=$(basename "${PYTHON_SOURCE}")
114+
source_file=$(basename "${PYTHON_SOURCE}")
115115
if [[ "${PYTHON_SOURCE}" == http* ]] || [[ "${PYTHON_SOURCE}" == ftp* ]]; then
116116
wget -c --no-check-certificate "${PYTHON_SOURCE}"
117117
else
118-
cp -r "${source_dir}" "."
118+
cp -r "${PYTHON_SOURCE}" "."
119119
fi
120-
if [[ "${source_dir}" == *.tgz ]] || [[ "${source_dir}" == *.tar.gz ]]; then
121-
filename="${source_dir%.*}"
122-
[[ -f $filename ]] || tar -xzf "${source_dir}"
123-
source_dir="$filename"
120+
if [[ "${source_file}" == *.tgz ]] || [[ "${source_file}" == *.tar.gz ]]; then
121+
if [[ "${source_file}" == *.tgz ]]; then
122+
dirname="${source_file%.*}"
123+
else
124+
dirname="${source_file%.*.*}"
125+
fi
126+
[[ -f $dirname ]] || tar -xzf "${source_file}"
127+
source_dir="$dirname"
128+
else
129+
source_dir="$source_file"
124130
fi
125131

126132
prefix="usr/python"
@@ -133,7 +139,7 @@ HOME="${PYTHON_BUILD_DIR}" make -j"$NPROC" DESTDIR="$APPDIR" install
133139
if [ ! -z "${PIP_REQUIREMENTS}" ]; then
134140
cd "${APPDIR}/${prefix}/bin"
135141
pythons=( "python"?"."? )
136-
HOME="${PYTHON_BUILD_DIR}" PYTHONHOME=$(readlink -f ${PWD}/..) ./${pythons[0]} -m pip install --upgrade pip
142+
HOME="${PYTHON_BUILD_DIR}" PYTHONHOME=$(readlink -f ${PWD}/..) ./${pythons[0]} -m pip install ${PIP_OPTIONS} --upgrade pip
137143
HOME="${PYTHON_BUILD_DIR}" PYTHONHOME=$(readlink -f ${PWD}/..) ./${pythons[0]} -m pip install ${PIP_OPTIONS} ${PIP_REQUIREMENTS}
138144
fi
139145

0 commit comments

Comments
 (0)