@@ -106,21 +106,34 @@ else
106106 mkdir -p " ${PYTHON_BUILD_DIR} "
107107fi
108108
109+ # check if the given sources are a local file or directory; if yes,
110+ # "save" the full path. It might've been given relative to the current
111+ # directory.
112+ if [ -e " ${PYTHON_SOURCE} " ]; then
113+ PYTHON_SOURCE=$( readlink -f " ${PYTHON_SOURCE} " )
114+ fi
115+
109116cd " ${PYTHON_BUILD_DIR} "
110117
111118
112119
113120# Install Python from sources
114- source_dir =$( basename " ${PYTHON_SOURCE} " )
121+ source_file =$( basename " ${PYTHON_SOURCE} " )
115122if [[ " ${PYTHON_SOURCE} " == http* ]] || [[ " ${PYTHON_SOURCE} " == ftp* ]]; then
116123 wget -c --no-check-certificate " ${PYTHON_SOURCE} "
117124else
118- cp -r " ${source_dir } " " ."
125+ cp -r " ${PYTHON_SOURCE } " " ."
119126fi
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 "
127+ if [[ " ${source_file} " == * .tgz ]] || [[ " ${source_file} " == * .tar.gz ]]; then
128+ if [[ " ${source_file} " == * .tgz ]]; then
129+ dirname=" ${source_file% .* } "
130+ else
131+ dirname=" ${source_file% .* .* } "
132+ fi
133+ [[ -f $dirname ]] || tar -xzf " ${source_file} "
134+ source_dir=" $dirname "
135+ else
136+ source_dir=" $source_file "
124137fi
125138
126139prefix=" usr/python"
@@ -133,7 +146,7 @@ HOME="${PYTHON_BUILD_DIR}" make -j"$NPROC" DESTDIR="$APPDIR" install
133146if [ ! -z " ${PIP_REQUIREMENTS} " ]; then
134147 cd " ${APPDIR} /${prefix} /bin"
135148 pythons=( " python" ? " ." ? )
136- HOME=" ${PYTHON_BUILD_DIR} " PYTHONHOME=$( readlink -f ${PWD} /..) ./${pythons[0]} -m pip install --upgrade pip
149+ HOME=" ${PYTHON_BUILD_DIR} " PYTHONHOME=$( readlink -f ${PWD} /..) ./${pythons[0]} -m pip install ${PIP_OPTIONS} --upgrade pip
137150 HOME=" ${PYTHON_BUILD_DIR} " PYTHONHOME=$( readlink -f ${PWD} /..) ./${pythons[0]} -m pip install ${PIP_OPTIONS} ${PIP_REQUIREMENTS}
138151fi
139152
0 commit comments