mirror of
https://github.com/pyenv/pyenv.git
synced 2024-12-22 16:33:34 +00:00
Search extra patches from given directory then apply it during build (#91)
``` $ env PYTHON_PATCH_PATH="./patches" PYTHON_PATCH_OPTS="-p1" pyenv install 2.7.6 ```
This commit is contained in:
parent
3d5156ed1d
commit
75559df89d
1 changed files with 18 additions and 5 deletions
|
@ -162,17 +162,24 @@ install_package_using() {
|
|||
|
||||
apply_patches() {
|
||||
local package_name="$1"
|
||||
local patches_path="${PYTHON_BUILD_ROOT}/share/python-build/patches/${DEFINITION_PATH##*/}"
|
||||
|
||||
# Support PYTHON_PATCH_STRIP, etc.
|
||||
local package_var_name="$(capitalize "${package_name%%-*}")"
|
||||
local PACKAGE_PATCH="${package_var_name}_PATCH"
|
||||
local PACKAGE_PATCH_PATH="${package_var_name}_PATCH_PATH"
|
||||
local PACKAGE_PATCH_STRIP="${package_var_name}_PATCH_STRIP"
|
||||
local PACKAGE_PATCH_OPTS="${package_var_name}_PATCH_OPTS"
|
||||
local PACKAGE_PATCH_OPTS_ARRAY="${package_var_name}_PATCH_OPTS_ARRAY[@]"
|
||||
|
||||
for patch in "${patches_path}/${package_name}/"*; do
|
||||
local patch_path="${!PACKAGE_PATCH_PATH:-${PYTHON_BUILD_PATCH_PATH}/${package_name}}"
|
||||
# path may be given in relative from working directory
|
||||
[ -e "${patch_path}" ] || patch_path="${CWD}/${patch_path}"
|
||||
|
||||
local patch
|
||||
for patch in "${patch_path}"/*; do
|
||||
if [ -f "$patch" ]; then
|
||||
{
|
||||
echo "Applying ${patch##*/} to ${package_name}..."
|
||||
patch "-p${!PACKAGE_PATCH_STRIP:-0}" < "$patch"
|
||||
echo "Applying ${patch##*/} to ${package_name}..." >&2
|
||||
{ ${!PACKAGE_PATCH:-patch} "-p${!PACKAGE_PATCH_STRIP:-0}" $PATCH_OPTS ${!PACKAGE_PATCH_OPTS} "${!PACKAGE_PATCH_OPTS_ARRAY}" < "$patch"
|
||||
} >&4 2>&1
|
||||
fi
|
||||
done
|
||||
|
@ -1253,6 +1260,12 @@ elif [ ! -e "$DEFINITION_PATH" ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$PYTHON_BUILD_PATCH_PATH" ]; then
|
||||
PYTHON_BUILD_PATCH_PATH="${DEFINITION_PATH%/*}/patches/${DEFINITION_PATH##*/}"
|
||||
else
|
||||
PYTHON_BUILD_PATCH_PATH="${PYTHON_BUILD_PATCH_PATH%/}"
|
||||
fi
|
||||
|
||||
PREFIX_PATH="${ARGUMENTS[1]}"
|
||||
if [ -z "$PREFIX_PATH" ]; then
|
||||
usage
|
||||
|
|
Loading…
Reference in a new issue