mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-15 06:43:53 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8761ae8f7c | ||
|
|
3d401ebcd2 | ||
|
|
268f965421 | ||
|
|
ff0f8a140b | ||
|
|
6c2d234e55 | ||
|
|
c6dd3b9468 | ||
|
|
8fee82e456 |
@@ -1,5 +1,10 @@
|
|||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
|
#### 20141118
|
||||||
|
|
||||||
|
* python-build: Fix broken `setup_builtin_patches` (#270)
|
||||||
|
* python-build: Add a patch to allow building 2.6.9 on OS X 10.9 with `--enable-framework` (#269, #271)
|
||||||
|
|
||||||
#### 20141106
|
#### 20141106
|
||||||
|
|
||||||
* pyenv: Optimize pyenv-which. Thanks to @blueyed (#129)
|
* pyenv: Optimize pyenv-which. Thanks to @blueyed (#129)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
version="20141106"
|
version="20141118"
|
||||||
|
|
||||||
if cd "$PYENV_ROOT" 2>/dev/null; then
|
if cd "$PYENV_ROOT" 2>/dev/null; then
|
||||||
git_revision="$(git describe --tags HEAD 2>/dev/null || true)"
|
git_revision="$(git describe --tags HEAD 2>/dev/null || true)"
|
||||||
|
|||||||
@@ -911,15 +911,12 @@ after_install_package() {
|
|||||||
|
|
||||||
setup_builtin_patches() {
|
setup_builtin_patches() {
|
||||||
local package_name="$1"
|
local package_name="$1"
|
||||||
local package_patch_path="${PYTHON_BUILD_ROOT}/share/python-build/patches/${DEFINITION_PATH##*/}/${package_name}"
|
local package_patch_path="${DEFINITION_PATH%/*}/patches/${DEFINITION_PATH##*/}/${package_name}"
|
||||||
|
|
||||||
ORIG_HAS_PATCH="$HAS_PATCH"
|
ORIG_HAS_PATCH="$HAS_PATCH"
|
||||||
# Apply built-in patches if patch was not given from stdin
|
# Apply built-in patches if patch was not given from stdin
|
||||||
if [ -z "$HAS_PATCH" ] && [ -d "${package_patch_path}" ]; then
|
if [ -z "$HAS_PATCH" ] && [ -d "${package_patch_path}" ]; then
|
||||||
local patch
|
{ find "${package_patch_path}" -maxdepth 1 -type f
|
||||||
{ for patch in "${package_patch_path}"/*; do
|
|
||||||
[ -f "${patch}" ] && echo "${patch}"
|
|
||||||
done
|
|
||||||
} 2>/dev/null | sort | xargs cat 1>"${package_name}.patch"
|
} 2>/dev/null | sort | xargs cat 1>"${package_name}.patch"
|
||||||
exec <&-
|
exec <&-
|
||||||
exec <"${package_name}.patch"
|
exec <"${package_name}.patch"
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
diff -ru ../Python-2.6.9/configure ./configure
|
||||||
|
--- ../Python-2.6.9/configure 2013-10-29 17:04:39.000000000 +0200
|
||||||
|
+++ ./configure 2014-11-14 11:33:00.000000000 +0200
|
||||||
|
@@ -7227,7 +7227,7 @@
|
||||||
|
#ARCH_RUN_32BIT="true"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}"
|
||||||
|
+ LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -arch_only ${MACOSX_DEFAULT_ARCH}"
|
||||||
|
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
|
||||||
|
LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
|
||||||
|
esac
|
||||||
140
plugins/python-build/test/pyenv_ext.bats
Normal file
140
plugins/python-build/test/pyenv_ext.bats
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load test_helper
|
||||||
|
export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
|
||||||
|
export MAKE=make
|
||||||
|
export MAKE_OPTS="-j 2"
|
||||||
|
export CC=cc
|
||||||
|
|
||||||
|
export TMP_FIXTURES="$TMP/fixtures"
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
mkdir -p "$INSTALL_ROOT"
|
||||||
|
stub md5 false
|
||||||
|
stub curl false
|
||||||
|
}
|
||||||
|
|
||||||
|
executable() {
|
||||||
|
local file="$1"
|
||||||
|
mkdir -p "${file%/*}"
|
||||||
|
cat > "$file"
|
||||||
|
chmod +x "$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
cached_tarball() {
|
||||||
|
mkdir -p "$PYTHON_BUILD_CACHE_PATH"
|
||||||
|
pushd "$PYTHON_BUILD_CACHE_PATH" >/dev/null
|
||||||
|
tarball "$@"
|
||||||
|
popd >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
tarball() {
|
||||||
|
local name="$1"
|
||||||
|
local path="$PWD/$name"
|
||||||
|
local configure="$path/configure"
|
||||||
|
shift 1
|
||||||
|
|
||||||
|
executable "$configure" <<OUT
|
||||||
|
#!$BASH
|
||||||
|
echo "$name: CPPFLAGS=\\"\$CPPFLAGS\\" LDFLAGS=\\"\$LDFLAGS\\"" >> build.log
|
||||||
|
echo "$name: \$@" \${PYTHONOPT:+PYTHONOPT=\$PYTHONOPT} >> build.log
|
||||||
|
OUT
|
||||||
|
|
||||||
|
for file; do
|
||||||
|
mkdir -p "$(dirname "${path}/${file}")"
|
||||||
|
touch "${path}/${file}"
|
||||||
|
done
|
||||||
|
|
||||||
|
tar czf "${path}.tar.gz" -C "${path%/*}" "$name"
|
||||||
|
}
|
||||||
|
|
||||||
|
stub_make_install() {
|
||||||
|
stub "$MAKE" \
|
||||||
|
" : echo \"$MAKE \$@\" >> build.log" \
|
||||||
|
"install : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'"
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_build_log() {
|
||||||
|
run cat "$INSTALL_ROOT/build.log"
|
||||||
|
assert_output
|
||||||
|
}
|
||||||
|
|
||||||
|
install_patch() {
|
||||||
|
local name="$1"
|
||||||
|
local patch="$2"
|
||||||
|
[ -n "$patch" ] || patch="python.patch"
|
||||||
|
|
||||||
|
mkdir -p "${TMP_FIXTURES}/${name%/*}/patches/${name##*/}/${patch%/*}"
|
||||||
|
cat > "${TMP_FIXTURES}/${name%/*}/patches/${name##*/}/${patch}"
|
||||||
|
}
|
||||||
|
|
||||||
|
install_tmp_fixture() {
|
||||||
|
local args
|
||||||
|
|
||||||
|
while [ "${1#-}" != "$1" ]; do
|
||||||
|
args="$args $1"
|
||||||
|
shift 1
|
||||||
|
done
|
||||||
|
|
||||||
|
local name="$1"
|
||||||
|
local destination="$2"
|
||||||
|
[ -n "$destination" ] || destination="$INSTALL_ROOT"
|
||||||
|
|
||||||
|
# Copy fixture to temporary path
|
||||||
|
mkdir -p "${TMP_FIXTURES}/${name%/*}"
|
||||||
|
cp "${FIXTURE_ROOT}/${name}" "${TMP_FIXTURES}/${name}"
|
||||||
|
|
||||||
|
run python-build $args "$TMP_FIXTURES/$name" "$destination"
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "apply built-in python patch before building" {
|
||||||
|
cached_tarball "Python-3.2.1"
|
||||||
|
|
||||||
|
stub brew false
|
||||||
|
stub_make_install
|
||||||
|
stub patch ' : echo patch "$@" | sed -E "s/\.[[:alnum:]]+$/.XXX/" >> build.log'
|
||||||
|
|
||||||
|
echo | install_patch definitions/vanilla-python "Python-3.2.1/empty.patch"
|
||||||
|
|
||||||
|
TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
assert_build_log <<OUT
|
||||||
|
patch -p0 --force -i $TMP/python-patch.XXX
|
||||||
|
Python-3.2.1: CPPFLAGS="-I${TMP}/install/include " LDFLAGS="-L${TMP}/install/lib "
|
||||||
|
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
|
||||||
|
make -j 2
|
||||||
|
make install
|
||||||
|
OUT
|
||||||
|
|
||||||
|
unstub make
|
||||||
|
unstub patch
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "apply built-in python patches should be sorted by its name" {
|
||||||
|
cached_tarball "Python-3.2.1"
|
||||||
|
|
||||||
|
stub brew false
|
||||||
|
stub_make_install
|
||||||
|
stub patch ' : for arg; do [[ "$arg" == "-"* ]] || sed -e "s/^/patch: /" "$arg"; done >> build.log'
|
||||||
|
|
||||||
|
echo "foo" | install_patch definitions/vanilla-python "Python-3.2.1/foo.patch"
|
||||||
|
echo "bar" | install_patch definitions/vanilla-python "Python-3.2.1/bar.patch"
|
||||||
|
echo "baz" | install_patch definitions/vanilla-python "Python-3.2.1/baz.patch"
|
||||||
|
|
||||||
|
TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null
|
||||||
|
assert_success
|
||||||
|
|
||||||
|
assert_build_log <<OUT
|
||||||
|
patch: bar
|
||||||
|
patch: baz
|
||||||
|
patch: foo
|
||||||
|
Python-3.2.1: CPPFLAGS="-I${TMP}/install/include " LDFLAGS="-L${TMP}/install/lib "
|
||||||
|
Python-3.2.1: --prefix=$INSTALL_ROOT --libdir=$INSTALL_ROOT/lib
|
||||||
|
make -j 2
|
||||||
|
make install
|
||||||
|
OUT
|
||||||
|
|
||||||
|
unstub make
|
||||||
|
unstub patch
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ load test_helper
|
|||||||
@test "blank invocation" {
|
@test "blank invocation" {
|
||||||
run pyenv
|
run pyenv
|
||||||
assert_success
|
assert_success
|
||||||
assert [ "${lines[0]}" == "pyenv 20141106" ]
|
assert [ "${lines[0]}" == "pyenv 20141118" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "invalid command" {
|
@test "invalid command" {
|
||||||
@@ -45,11 +45,3 @@ load test_helper
|
|||||||
assert_failure
|
assert_failure
|
||||||
assert_output "pyenv: cannot change working directory to \`$dir'"
|
assert_output "pyenv: cannot change working directory to \`$dir'"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "conflicting GREP_OPTIONS" {
|
|
||||||
file="${BATS_TMPDIR}/hello"
|
|
||||||
echo "hello" > "$file"
|
|
||||||
GREP_OPTIONS="-F" run pyenv grep "hell." "$file"
|
|
||||||
assert_success
|
|
||||||
assert_output "hello"
|
|
||||||
}
|
|
||||||
|
|||||||
11
test/pyenv_ext.bats
Normal file
11
test/pyenv_ext.bats
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load test_helper
|
||||||
|
|
||||||
|
@test "conflicting GREP_OPTIONS" {
|
||||||
|
file="${BATS_TMPDIR}/hello"
|
||||||
|
echo "hello" > "$file"
|
||||||
|
GREP_OPTIONS="-F" run pyenv grep "hell." "$file"
|
||||||
|
assert_success
|
||||||
|
assert_output "hello"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user