Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions linuxdeploy-plugin-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,34 @@ else
mkdir -p "${PYTHON_BUILD_DIR}"
fi

# check if the given sources are a local file or directory; if yes,
# "save" the full path. It might've been given relative to the current
# directory.
if [ -e "${PYTHON_SOURCE}" ]; then
PYTHON_SOURCE=$( readlink -f "${PYTHON_SOURCE}" )
fi

cd "${PYTHON_BUILD_DIR}"



# Install Python from sources
source_dir=$(basename "${PYTHON_SOURCE}")
source_file=$(basename "${PYTHON_SOURCE}")
if [[ "${PYTHON_SOURCE}" == http* ]] || [[ "${PYTHON_SOURCE}" == ftp* ]]; then
wget -c --no-check-certificate "${PYTHON_SOURCE}"
else
cp -r "${source_dir}" "."
cp -r "${PYTHON_SOURCE}" "."
fi
if [[ "${source_dir}" == *.tgz ]] || [[ "${source_dir}" == *.tar.gz ]]; then
filename="${source_dir%.*}"
[[ -f $filename ]] || tar -xzf "${source_dir}"
source_dir="$filename"
if [[ "${source_file}" == *.tgz ]] || [[ "${source_file}" == *.tar.gz ]]; then
if [[ "${source_file}" == *.tgz ]]; then
dirname="${source_file%.*}"
else
dirname="${source_file%.*.*}"
fi
[[ -f $dirname ]] || tar -xzf "${source_file}"
source_dir="$dirname"
else
source_dir="$source_file"
fi

prefix="usr/python"
Expand All @@ -133,7 +146,7 @@ HOME="${PYTHON_BUILD_DIR}" make -j"$NPROC" DESTDIR="$APPDIR" install
if [ ! -z "${PIP_REQUIREMENTS}" ]; then
cd "${APPDIR}/${prefix}/bin"
pythons=( "python"?"."? )
HOME="${PYTHON_BUILD_DIR}" PYTHONHOME=$(readlink -f ${PWD}/..) ./${pythons[0]} -m pip install --upgrade pip
HOME="${PYTHON_BUILD_DIR}" PYTHONHOME=$(readlink -f ${PWD}/..) ./${pythons[0]} -m pip install ${PIP_OPTIONS} --upgrade pip
HOME="${PYTHON_BUILD_DIR}" PYTHONHOME=$(readlink -f ${PWD}/..) ./${pythons[0]} -m pip install ${PIP_OPTIONS} ${PIP_REQUIREMENTS}
fi

Expand Down