mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Add list_patches()
to sort patches by their names
This commit is contained in:
parent
008a5a1ff9
commit
b70dcb9f2d
1 changed files with 29 additions and 13 deletions
|
@ -163,31 +163,47 @@ install_package_using() {
|
|||
apply_patches() {
|
||||
local package_name="$1"
|
||||
|
||||
# Support PYTHON_PATCH_PATH, PYTHON_PATCH_OPTS, etc.
|
||||
# Support PYTHON_PATCH, PYTHON_PATCH_OPTS, 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_OPTS="${package_var_name}_PATCH_OPTS"
|
||||
|
||||
if [ -z "${PATCH_OPTS+defined}" ] && [ -z "${!PACKAGE_PATCH_OPTS+defined}" ]; then
|
||||
local PATCH_OPTS="-p0"
|
||||
fi
|
||||
|
||||
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}"
|
||||
|
||||
# FIXME: patches should be sorted in their names
|
||||
local patch
|
||||
for patch in "${patch_path}"/*; do
|
||||
if [ -f "$patch" ]; then
|
||||
for patch in $(list_patches "${package_name}"); do
|
||||
echo "Applying ${patch##*/} to ${package_name}..." >&2
|
||||
{ ${!PACKAGE_PATCH:-patch} $PATCH_OPTS ${!PACKAGE_PATCH_OPTS} < "$patch"
|
||||
} >&4 2>&1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
list_patches() {
|
||||
local package_name="$1"
|
||||
|
||||
# Support PYTHON_PATCH_PATH, etc.
|
||||
local package_var_name="$(capitalize "${package_name%%-*}")"
|
||||
local PACKAGE_PATCH_PATH="${package_var_name}_PATCH_PATH"
|
||||
|
||||
if [ "${!PACKAGE_PATCH_PATH+defined}" ]; then
|
||||
# patch path may be given in relative from working directory
|
||||
if [[ "${!PACKAGE_PATCH_PATH}" != /* ]]; then
|
||||
local patch_path="${CWD}/${!PACKAGE_PATCH_PATH}"
|
||||
else
|
||||
local patch_path="${!PACKAGE_PATCH_PATH}"
|
||||
fi
|
||||
else
|
||||
local patch_path="${PYTHON_BUILD_PATCH_PATH}/${package_name}"
|
||||
fi
|
||||
|
||||
{ for patch in "${patch_path}"/*; do
|
||||
[ -f "${patch}" ] && echo "${patch}"
|
||||
done
|
||||
} | sort
|
||||
}
|
||||
|
||||
make_package() {
|
||||
local package_name="$1"
|
||||
shift
|
||||
|
|
Loading…
Reference in a new issue