mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Merge branch 'apply-extra-patches'
This commit is contained in:
commit
1a05d9a8cd
3 changed files with 23 additions and 6 deletions
|
@ -104,6 +104,10 @@ process.
|
||||||
* `PYTHON_CONFIGURE_OPTS` and `PYTHON_MAKE_OPTS` allow you to specify
|
* `PYTHON_CONFIGURE_OPTS` and `PYTHON_MAKE_OPTS` allow you to specify
|
||||||
configure and make options for buildling CPython. These variables will
|
configure and make options for buildling CPython. These variables will
|
||||||
be passed to Python only, not any dependent packages (e.g. libyaml).
|
be passed to Python only, not any dependent packages (e.g. libyaml).
|
||||||
|
* `PYTHON_PATCH_PATH` allows you to specify a directory that contains
|
||||||
|
the patches for building CPython. All patches should be created
|
||||||
|
as same strip number (default `-p0`). `PYTHON_PATCH_OPTS` allows
|
||||||
|
you to override the options for `patch`.
|
||||||
|
|
||||||
### Checksum verification
|
### Checksum verification
|
||||||
|
|
||||||
|
|
|
@ -162,17 +162,24 @@ install_package_using() {
|
||||||
|
|
||||||
apply_patches() {
|
apply_patches() {
|
||||||
local package_name="$1"
|
local package_name="$1"
|
||||||
local patches_path="${PYTHON_BUILD_ROOT}/share/python-build/patches/${DEFINITION_PATH##*/}"
|
|
||||||
|
|
||||||
# Support PYTHON_PATCH_STRIP, etc.
|
# Support PYTHON_PATCH_STRIP, etc.
|
||||||
local package_var_name="$(capitalize "${package_name%%-*}")"
|
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_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
|
if [ -f "$patch" ]; then
|
||||||
{
|
echo "Applying ${patch##*/} to ${package_name}..." >&2
|
||||||
echo "Applying ${patch##*/} to ${package_name}..."
|
{ ${!PACKAGE_PATCH:-patch} "-p${!PACKAGE_PATCH_STRIP:-0}" $PATCH_OPTS ${!PACKAGE_PATCH_OPTS} "${!PACKAGE_PATCH_OPTS_ARRAY}" < "$patch"
|
||||||
patch "-p${!PACKAGE_PATCH_STRIP:-0}" < "$patch"
|
|
||||||
} >&4 2>&1
|
} >&4 2>&1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -1253,6 +1260,12 @@ elif [ ! -e "$DEFINITION_PATH" ]; then
|
||||||
fi
|
fi
|
||||||
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]}"
|
PREFIX_PATH="${ARGUMENTS[1]}"
|
||||||
if [ -z "$PREFIX_PATH" ]; then
|
if [ -z "$PREFIX_PATH" ]; then
|
||||||
usage
|
usage
|
||||||
|
|
|
@ -17,4 +17,4 @@ SHARE_PATH="${PREFIX}/share/python-build"
|
||||||
mkdir -p "$BIN_PATH" "$SHARE_PATH"
|
mkdir -p "$BIN_PATH" "$SHARE_PATH"
|
||||||
|
|
||||||
install -p bin/* "$BIN_PATH"
|
install -p bin/* "$BIN_PATH"
|
||||||
install -p share/python-build/* "$SHARE_PATH"
|
cp -RPp share/python-build/* "$SHARE_PATH"
|
||||||
|
|
Loading…
Reference in a new issue