1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-15 06:43:53 -05:00

Compare commits

...

35 Commits

Author SHA1 Message Date
Yamashita Yuu
8abefe1fcb v20150124 2015-01-24 00:45:03 +09:00
Yamashita Yuu
b22fcd9759 Add missing changelog of v20141211 2015-01-24 00:43:12 +09:00
Yamashita, Yuu
45df273592 Merge pull request #307 from cloudlite/patch-1
Update README.md - clone through https instead of git
2015-01-20 11:23:45 +09:00
cloudlite
dbd50e7bd9 Update README.md - clone through https instead of git
git:// protocol is blocked by a lot of servers, https works fine.
2015-01-19 20:51:18 -05:00
Yamashita Yuu
1c0a5d8264 Add IronPython 2.7.5 2015-01-18 20:24:47 +09:00
Yamashita Yuu
7c7cca8a26 Merge branch 'ruby-build-v20150112' 2015-01-15 23:40:23 +09:00
Yamashita Yuu
123b3af1a0 Import changes from ruby-build v20150112 2015-01-15 23:33:39 +09:00
Yamashita, Yuu
ba9c01ce77 Merge pull request #304 from jbrudvik/patch-1
Use better image for Travis build status
2015-01-14 13:44:51 +09:00
Jeremy Brudvik
7535efe031 Use better image for Travis build status 2015-01-13 19:53:29 -08:00
Yamashita, Yuu
995da2df89 Merge pull request #295 from radzinzki/master
Update README.md
2014-12-18 12:43:16 +09:00
Arnav Kumar
f28b3ee123 Update README.md
Made it consistent with the rbenv documentation by having the cloning step in the installation clone it directly into the home directory.
2014-12-18 11:41:25 +08:00
Yamashita, Yuu
97b957d5d5 Merge pull request #292 from s1341/master
add patches to stop '/Library/Python/X.X/site-packages' from being added to sys.path
2014-12-14 21:30:54 +09:00
srubenst
fe2412c95d add patches to stop '/Library/Python/X.X/site-packages' from being added to sys.path 2014-12-12 11:49:01 +02:00
Yamashita, Yuu
5114600c4d Merge pull request #289 from blueyed/unset-PYTHON_CFLAGS-in-tests
Unset PYTHON_CFLAGS for build tests
2014-12-12 10:02:10 +09:00
Daniel Hahler
96d3bd6379 Unset PYTHON_CFLAGS and PYTHON_CONFIGURE_OPTS for build tests 2014-12-12 01:36:37 +01:00
Yamashita Yuu
d320d74a07 v20141211 (fixes #288) 2014-12-11 22:39:38 +09:00
Yamashita Yuu
fc49f7e21e Fix building _dev_ versions 2014-12-11 22:35:12 +09:00
Yamashita Yuu
be4f5992d6 Add 3.5-dev (#287) 2014-12-11 21:46:22 +09:00
Yamashita Yuu
25a48694be Use 3.4 branch for 3.4-dev (fixes #287) 2014-12-11 21:45:37 +09:00
Yamashita, Yuu
9b7b2a6b40 Merge pull request #286 from joshfriend/ignore-bats
Ignore the bats/ directory cloned by tests
2014-12-11 12:50:24 +09:00
Yamashita, Yuu
f59729359a Merge pull request #285 from joshfriend/python-279
Add Python 2.7.9
2014-12-11 12:48:31 +09:00
Josh Friend
93ac0632c7 ignore bats/ directory cloned by tests 2014-12-10 22:20:56 -05:00
Josh Friend
7a21cf9c10 Add release version of 2.7.9 (fixes #284) 2014-12-10 21:51:52 -05:00
Josh Friend
720dee76af remove 2.7.9 release candidate 2014-12-10 18:16:54 -05:00
Yamashita, Yuu
db6a41c90f Merge pull request #280 from yyuu/rbenv-7e0e85bd
Import recent changes from rbenv
2014-12-01 22:53:51 +09:00
Yamashita Yuu
bfddc69120 Update Makefile. Use same path configuration as travis-ci. 2014-12-01 22:50:04 +09:00
Yamashita Yuu
acce3744e7 Add pip-rehash 2014-12-01 22:36:10 +09:00
Yamashita Yuu
5ca423c9f3 Revert a fix for #101 to fix broken tests relating to PYENV_NATIVE_EXT 2014-12-01 20:34:12 +09:00
Yamashita Yuu
f0e852553a Import rbenv changes at 7e0e85bdda 2014-12-01 00:29:26 +09:00
Yamashita Yuu
fc8597ca38 Rename build definitions of pypy nightly build 2014-11-29 17:22:39 +09:00
Yamashita Yuu
e7a68ad467 Update require_distro of pypy-2.4.0 on Linux x86/amd64 2014-11-29 11:21:08 +09:00
Yamashita Yuu
0fd1eaaeb5 Add pypy3-2.4.0-src (#277) 2014-11-29 11:16:44 +09:00
Yamashita Yuu
b986f8f93f Add PyPy nightly builds 2014-11-29 10:55:26 +09:00
Yamashita Yuu
60e1abe7fa Add PyPy3 2.4.0 (fixes #277) 2014-11-29 09:48:04 +09:00
Yamashita Yuu
afcf4f0c7c Move require_distro out from PyPy build definitions 2014-11-29 09:11:36 +09:00
64 changed files with 1344 additions and 318 deletions

7
.gitignore vendored
View File

@@ -1,6 +1,9 @@
/build
/cache
/shims /shims
/version /version
/versions /versions
/sources /sources
/cache
/libexec/*.dylib
/src/Makefile
/src/*.o
bats/

View File

@@ -1,6 +1,6 @@
install: git clone --depth 1 https://github.com/sstephenson/bats.git install: git clone https://github.com/sstephenson/bats.git
script: script/test script: make test
language: c language: c
notifications: env:
email: - PYENV_NATIVE_EXT=
on_success: never - PYENV_NATIVE_EXT=1

View File

@@ -1,5 +1,18 @@
## Version History ## Version History
#### 20150124
* python-build: Import recent changes from ruby-build v20150112
* python-build: Prevent adding `/Library/Python/X.X/site-packages` to `sys.path` whtn `--enable-framework` is enabled on OS X. Thanks @s1341 (#292)
* python-build: Add new IronPython release; 2.7.5
#### 20141211
* pyenv: Add bulit-in `pip-rehash` feature. You don't need to install [pyenv-pip-rehash](https://github.com/yyuu/pyenv-pip-rehash) anymore.
* python-build: Add new CPython release; 2.7.9 (#284)
* python-build: Add new PyPy releases; pypy3-2.4.0, pypy3-2.4.0-src (#277)
* python-build: Add build definitions of PyPy nightly build
#### 20141127 #### 20141127
* python-build: Add new CPython release candidates; 2.7.9rc1 (#276) * python-build: Add new CPython release candidates; 2.7.9rc1 (#276)

View File

@@ -1,8 +1,12 @@
test: build/bats/bin/bats
build/bats/bin/bats --tap test
cd plugins/python-build && $(PWD)/build/bats/bin/bats --tap test
build/bats/bin/bats:
git clone https://github.com/sstephenson/bats.git build/bats
.PHONY: test .PHONY: test
# Do not pass in user flags to build tests.
unexport PYTHON_CFLAGS
unexport PYTHON_CONFIGURE_OPTS
test: bats
PATH="./bats/bin:$$PATH" test/run
cd plugins/python-build && $(PWD)/bats/bin/bats $${CI:+--tap} test
bats:
git clone https://github.com/sstephenson/bats.git

View File

@@ -1,6 +1,6 @@
# Simple Python Version Management: pyenv # Simple Python Version Management: pyenv
[![Build Status](https://travis-ci.org/yyuu/pyenv.png)](https://travis-ci.org/yyuu/pyenv) [![Build Status](https://travis-ci.org/yyuu/pyenv.svg)](https://travis-ci.org/yyuu/pyenv)
pyenv lets you easily switch between multiple versions of Python. It's pyenv lets you easily switch between multiple versions of Python. It's
simple, unobtrusive, and follows the UNIX tradition of single-purpose simple, unobtrusive, and follows the UNIX tradition of single-purpose
@@ -171,8 +171,7 @@ easy to fork and contribute any changes back upstream.
1. **Check out pyenv where you want it installed.** 1. **Check out pyenv where you want it installed.**
A good place to choose is `$HOME/.pyenv` (but you can install it somewhere else). A good place to choose is `$HOME/.pyenv` (but you can install it somewhere else).
$ cd $ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ git clone git://github.com/yyuu/pyenv.git .pyenv
2. **Define environment variable `PYENV_ROOT`** to point to the path where 2. **Define environment variable `PYENV_ROOT`** to point to the path where

View File

@@ -12,14 +12,22 @@ if [ -n "$PYENV_DEBUG" ]; then
set -x set -x
fi fi
if enable -f "${0%/*}"/../libexec/pyenv-realpath.dylib realpath 2>/dev/null; then
abs_dirname() {
local path="$(realpath "$1")"
echo "${path%/*}"
}
else
if [ -n "$PYENV_NATIVE_EXT" ]; then
echo "pyenv: failed to load \`realpath' builtin" >&2
exit 1
fi
READLINK=$(type -p greadlink readlink | head -1) READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then if [ -z "$READLINK" ]; then
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2 echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1 exit 1
fi fi
unset GREP_OPTIONS
resolve_link() { resolve_link() {
$READLINK "$1" $READLINK "$1"
} }
@@ -37,6 +45,7 @@ abs_dirname() {
pwd pwd
cd "$cwd" cd "$cwd"
} }
fi
if [ -z "${PYENV_ROOT}" ]; then if [ -z "${PYENV_ROOT}" ]; then
PYENV_ROOT="${HOME}/.pyenv" PYENV_ROOT="${HOME}/.pyenv"
@@ -62,15 +71,20 @@ shopt -s nullglob
bin_path="$(abs_dirname "$0")" bin_path="$(abs_dirname "$0")"
for plugin_bin in "${PYENV_ROOT}/plugins/"*/bin; do for plugin_bin in "${PYENV_ROOT}/plugins/"*/bin; do
bin_path="${bin_path}:${plugin_bin}" PATH="${plugin_bin}:${PATH}"
done done
export PATH="${bin_path}:${PATH}" export PATH="${bin_path}:${PATH}"
hook_path="${PYENV_HOOK_PATH}:${PYENV_ROOT}/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks" PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${PYENV_ROOT}/pyenv.d"
if [ "${bin_path%/*}" != "$PYENV_ROOT" ]; then
# Add pyenv's own `pyenv.d` unless pyenv was cloned to PYENV_ROOT
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${bin_path%/*}/pyenv.d"
fi
PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks"
for plugin_hook in "${PYENV_ROOT}/plugins/"*/etc/pyenv.d; do for plugin_hook in "${PYENV_ROOT}/plugins/"*/etc/pyenv.d; do
hook_path="${hook_path}:${plugin_hook}" PYENV_HOOK_PATH="${PYENV_HOOK_PATH}:${plugin_hook}"
done done
export PYENV_HOOK_PATH="$hook_path" export PYENV_HOOK_PATH
shopt -u nullglob shopt -u nullglob

View File

@@ -12,7 +12,7 @@
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
version="20141127" version="20150124"
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)"

View File

@@ -18,7 +18,7 @@ set -e
# Provide pyenv completions # Provide pyenv completions
if [ "$1" = "--complete" ]; then if [ "$1" = "--complete" ]; then
exec pyenv shims --short exec pyenv-shims --short
fi fi
PYENV_VERSION="$(pyenv-version-name)" PYENV_VERSION="$(pyenv-version-name)"

View File

@@ -19,6 +19,11 @@ if [ -z "$PYENV_COMMAND" ]; then
exit 1 exit 1
fi fi
if ! enable -f "${BASH_SOURCE%/*}"/pyenv-realpath.dylib realpath 2>/dev/null; then
if [ -n "$PYENV_NATIVE_EXT" ]; then
echo "pyenv: failed to load \`realpath' builtin" >&2
exit 1
fi
READLINK=$(type -p greadlink readlink | head -1) READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then if [ -z "$READLINK" ]; then
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2 echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
@@ -42,13 +47,14 @@ realpath() {
echo "$(pwd)/$name" echo "$(pwd)/$name"
cd "$cwd" cd "$cwd"
} }
fi
IFS=: hook_paths=($PYENV_HOOK_PATH) IFS=: hook_paths=($PYENV_HOOK_PATH)
shopt -s nullglob shopt -s nullglob
for path in "${hook_paths[@]}"; do for path in "${hook_paths[@]}"; do
for script in "$path/$PYENV_COMMAND"/*.bash; do for script in "$path/$PYENV_COMMAND"/*.bash; do
echo $(realpath $script) realpath "$script"
done done
done done
shopt -u nullglob shopt -u nullglob

View File

@@ -28,31 +28,7 @@ if [ -z "$shell" ]; then
shell="$(basename "${shell:-$SHELL}")" shell="$(basename "${shell:-$SHELL}")"
fi fi
READLINK=$(type -p greadlink readlink | head -1) root="${0%/*}/.."
if [ -z "$READLINK" ]; then
echo "pyenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi
resolve_link() {
$READLINK "$1"
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
root="$(abs_dirname "$0")/.."
if [ -z "$print" ]; then if [ -z "$print" ]; then
case "$shell" in case "$shell" in
@@ -92,22 +68,13 @@ fi
mkdir -p "${PYENV_ROOT}/"{shims,versions} mkdir -p "${PYENV_ROOT}/"{shims,versions}
if [[ ":${PATH}:" != *:"${PYENV_ROOT}/shims":* ]]; then
case "$shell" in case "$shell" in
fish ) fish )
echo "setenv PATH '${PYENV_ROOT}/shims' \$PATH" echo "setenv PATH '${PYENV_ROOT}/shims' \$PATH"
;;
* )
echo 'export PATH="'${PYENV_ROOT}'/shims:${PATH}"'
;;
esac
fi
case "$shell" in
fish )
echo "setenv PYENV_SHELL $shell" echo "setenv PYENV_SHELL $shell"
;; ;;
* ) * )
echo 'export PATH="'${PYENV_ROOT}'/shims:${PATH}"'
echo "export PYENV_SHELL=$shell" echo "export PYENV_SHELL=$shell"
;; ;;
esac esac

View File

@@ -70,49 +70,47 @@ SH
# of the first shim in the shims directory, assume pyenv has been # of the first shim in the shims directory, assume pyenv has been
# upgraded and the existing shims need to be removed. # upgraded and the existing shims need to be removed.
remove_outdated_shims() { remove_outdated_shims() {
for shim in *; do local shim
for shim in "$SHIM_PATH"/*; do
if ! diff "$PROTOTYPE_SHIM_PATH" "$shim" >/dev/null 2>&1; then if ! diff "$PROTOTYPE_SHIM_PATH" "$shim" >/dev/null 2>&1; then
for shim in *; do rm -f "$shim"; done rm -f "$SHIM_PATH"/*
fi fi
break break
done done
} }
# List basenames of executables for every Python version
list_executable_names() {
local file
for file in "$PYENV_ROOT"/versions/*/bin/*; do
echo "${file##*/}"
done
}
# The basename of each argument passed to `make_shims` will be # The basename of each argument passed to `make_shims` will be
# registered for installation as a shim. In this way, plugins may call # registered for installation as a shim. In this way, plugins may call
# `make_shims` with a glob to register many shims at once. # `make_shims` with a glob to register many shims at once.
make_shims() { make_shims() {
local shims=("$@") local file shim
for file; do
for file in "${shims[@]}"; do shim="${file##*/}"
local shim="${file##*/}"
register_shim "$shim" register_shim "$shim"
done done
} }
# Create an empty array for the list of registered shims and an empty registered_shims=" "
# string to use as a search index.
registered_shims=()
registered_shims_index=""
# We will keep track of shims registered for installation with the # Registers the name of a shim to be generated.
# global `registered_shims` array and with a global search index
# string. The array will let us iterate over all registered shims. The
# index string will let us quickly check whether a shim with the given
# name has been registered or not.
register_shim() { register_shim() {
local shim="$@" registered_shims="${registered_shims}${1} "
registered_shims["${#registered_shims[@]}"]="$shim"
registered_shims_index="$registered_shims_index/$shim/"
} }
# To install all the registered shims, we iterate over the # Install all the shims registered via `make_shims` or `register_shim` directly.
# `registered_shims` array and create a link if one does not already
# exist.
install_registered_shims() { install_registered_shims() {
local shim local shim file
for shim in "${registered_shims[@]}"; do for shim in $registered_shims; do
[ -e "$shim" ] || ln -f "$PROTOTYPE_SHIM_PATH" "$shim" file="${SHIM_PATH}/${shim}"
[ -e "$file" ] || ln -f "$PROTOTYPE_SHIM_PATH" "$file"
done done
} }
@@ -122,26 +120,21 @@ install_registered_shims() {
# removed. # removed.
remove_stale_shims() { remove_stale_shims() {
local shim local shim
for shim in *; do for shim in "$SHIM_PATH"/*; do
if [[ "$registered_shims_index" != *"/$shim/"* ]]; then if [[ "$registered_shims" != *" ${shim##*/} "* ]]; then
rm -f "$shim" rm -f "$shim"
fi fi
done done
} }
# Change to the shims directory.
cd "$SHIM_PATH"
shopt -s nullglob shopt -s nullglob
# Create the prototype shim, then register shims for all known # Create the prototype shim, then register shims for all known
# executables. # executables.
create_prototype_shim create_prototype_shim
remove_outdated_shims remove_outdated_shims
make_shims ../versions/*/bin/* make_shims $(list_executable_names | sort -u)
# Restore the previous working directory.
cd "$OLDPWD"
# Allow plugins to register shims. # Allow plugins to register shims.
OLDIFS="$IFS" OLDIFS="$IFS"
@@ -152,8 +145,5 @@ for script in "${scripts[@]}"; do
source "$script" source "$script"
done done
# Change back to the shims directory to install the registered shims
# and remove stale shims.
cd "$SHIM_PATH"
install_registered_shims install_registered_shims
remove_stale_shims remove_stale_shims

View File

@@ -8,7 +8,7 @@ set -e
# Provide pyenv completions # Provide pyenv completions
if [ "$1" = "--complete" ]; then if [ "$1" = "--complete" ]; then
echo --path echo --path
exec pyenv shims --short exec pyenv-shims --short
fi fi
if [ "$1" = "--path" ]; then if [ "$1" = "--path" ]; then

View File

@@ -12,7 +12,7 @@ set -e
# Provide pyenv completions # Provide pyenv completions
if [ "$1" = "--complete" ]; then if [ "$1" = "--complete" ]; then
exec pyenv shims --short exec pyenv-shims --short
fi fi
remove_from_path() { remove_from_path() {

View File

@@ -106,6 +106,8 @@ for option in "${OPTIONS[@]}"; do
esac esac
done done
[ "${#ARGUMENTS[@]}" -le 1 ] || usage 1 >&2
unset VERSION_NAME unset VERSION_NAME
# The first argument contains the definition to install. If the # The first argument contains the definition to install. If the
@@ -114,8 +116,7 @@ unset VERSION_NAME
# version is not specified. # version is not specified.
DEFINITION="${ARGUMENTS[0]}" DEFINITION="${ARGUMENTS[0]}"
[ -n "$DEFINITION" ] || DEFINITION="$(pyenv-local 2>/dev/null || true)" [ -n "$DEFINITION" ] || DEFINITION="$(pyenv-local 2>/dev/null || true)"
[ -n "$DEFINITION" ] || usage 1 [ -n "$DEFINITION" ] || usage 1 >&2
# Define `before_install` and `after_install` functions that allow # Define `before_install` and `after_install` functions that allow
# plugin hooks to register a string of code for execution before or # plugin hooks to register a string of code for execution before or
@@ -191,11 +192,11 @@ if [[ "${VERSION_NAME}" == [23]"."* ]]; then
done done
fi fi
# PyPy requires existing Python 2.x to build # PyPy/PyPy3 requires existing Python 2.7 to build
if [[ "${VERSION_NAME}" == "pypy-"*"-src" ]]; then if [[ "${VERSION_NAME}" == "pypy-"*"-src" ]] || [[ "${VERSION_NAME}" == "pypy3-"*"-src" ]]; then
if [ -z "$PYENV_RPYTHON_VERSION" ]; then if [ -z "$PYENV_RPYTHON_VERSION" ]; then
for version in $(pyenv-versions --bare | sort -r); do for version in $(pyenv-versions --bare | sort -r); do
if [[ "$version" == 2.[567] ]] || [[ "$version" == 2.[567].* ]]; then if [[ "$version" == "2.7"* ]]; then
PYENV_RPYTHON_VERSION="$version" PYENV_RPYTHON_VERSION="$version"
fi fi
done done

View File

@@ -17,24 +17,32 @@ if [ "$1" = "--complete" ]; then
exec pyenv versions --bare exec pyenv versions --bare
fi fi
usage() {
# We can remove the sed fallback once pyenv 0.4.0 is widely available
pyenv-help uninstall 2>/dev/null || sed -ne '/^#/!q;s/.//;s/.//;1,4d;p' < "$0"
[ -z "$1" ] || exit "$1"
}
if [ -z "$PYENV_ROOT" ]; then if [ -z "$PYENV_ROOT" ]; then
PYENV_ROOT="${HOME}/.pyenv" PYENV_ROOT="${HOME}/.pyenv"
fi fi
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage 0
fi
unset FORCE unset FORCE
if [ "$1" = "-f" ] || [ "$1" = "--force" ]; then if [ "$1" = "-f" ] || [ "$1" = "--force" ]; then
FORCE=true FORCE=true
shift shift
fi fi
[ "$#" -eq 1 ] || usage 1 >&2
DEFINITION="$1" DEFINITION="$1"
case "$DEFINITION" in case "$DEFINITION" in
"" | -* ) "" | -* )
# We can remove the sed fallback once pyenv 0.4.0 is widely available. usage 1 >&2
{ pyenv-help uninstall 2>/dev/null ||
sed -ne '/^#/!q;s/.\{1,2\}//;1,4d;p' < "$0"
} >&2
exit 1
;; ;;
esac esac

View File

@@ -1,4 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Usage: python-build [-kvp] <definition> <prefix>
# python-build --definitions
#
# -k/--keep Do not remove source tree after installation
# -v/--verbose Verbose mode: print compilation status to stdout
# -p/--patch Apply a patch from stdin before building
# --definitions List all built-in definitions
# -g/--debug Build a debug version
#
PYTHON_BUILD_VERSION="20141028" PYTHON_BUILD_VERSION="20141028"
@@ -144,6 +154,10 @@ install_package() {
install_package_using "tarball" 1 "$@" install_package_using "tarball" 1 "$@"
} }
install_nightly_package() {
install_package_using "nightly_tarball" 2 "$@"
}
install_git() { install_git() {
install_package_using "git" 2 "$@" install_package_using "git" 2 "$@"
} }
@@ -358,6 +372,19 @@ fetch_tarball() {
} >&4 2>&1 } >&4 2>&1
} }
fetch_nightly_tarball() {
local package_name="$1"
local package_url="$2"
local package_pattern="$3"
fetch_tarball "$1" "$2"
if [ ! -e "${package_name}" ]; then
local nightly_package_name="$(echo ${package_pattern})"
if [ -e "${nightly_package_name}" ]; then
ln -fs "${nightly_package_name}" "${package_name}"
fi
fi
}
reuse_existing_tarball() { reuse_existing_tarball() {
local package_filename="$1" local package_filename="$1"
local checksum="$2" local checksum="$2"
@@ -478,7 +505,7 @@ fetch_svn() {
if type svn &>/dev/null; then if type svn &>/dev/null; then
svn co -r "$svn_rev" "$svn_url" "${package_name}" >&4 2>&1 svn co -r "$svn_rev" "$svn_url" "${package_name}" >&4 2>&1
else else
echo "error: please install \`svn\` and try again" >&2 echo "error: please install Subversion and try again" >&2
exit 1 exit 1
fi fi
} }
@@ -627,7 +654,6 @@ build_package_standard() {
local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]" local PACKAGE_MAKE_OPTS_ARRAY="${package_var_name}_MAKE_OPTS_ARRAY[@]"
local PACKAGE_MAKE_INSTALL_OPTS="${package_var_name}_MAKE_INSTALL_OPTS" local PACKAGE_MAKE_INSTALL_OPTS="${package_var_name}_MAKE_INSTALL_OPTS"
local PACKAGE_MAKE_INSTALL_OPTS_ARRAY="${package_var_name}_MAKE_INSTALL_OPTS_ARRAY[@]" local PACKAGE_MAKE_INSTALL_OPTS_ARRAY="${package_var_name}_MAKE_INSTALL_OPTS_ARRAY[@]"
local PACKAGE_MAKE_INSTALL_TARGET="${package_var_name}_MAKE_INSTALL_TARGET"
local PACKAGE_CFLAGS="${package_var_name}_CFLAGS" local PACKAGE_CFLAGS="${package_var_name}_CFLAGS"
[ "$package_var_name" = "PYTHON" ] && use_homebrew_readline || true [ "$package_var_name" = "PYTHON" ] && use_homebrew_readline || true
@@ -644,7 +670,7 @@ build_package_standard() {
) >&4 2>&1 ) >&4 2>&1
{ "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}" { "$MAKE" $MAKE_OPTS ${!PACKAGE_MAKE_OPTS} "${!PACKAGE_MAKE_OPTS_ARRAY}"
"$MAKE" "${!PACKAGE_MAKE_INSTALL_TARGET:-install}" $MAKE_INSTALL_OPTS ${!PACKAGE_MAKE_INSTALL_OPTS} "${!PACKAGE_MAKE_INSTALL_OPTS_ARRAY}" "$MAKE" install $MAKE_INSTALL_OPTS ${!PACKAGE_MAKE_INSTALL_OPTS} "${!PACKAGE_MAKE_INSTALL_OPTS_ARRAY}"
} >&4 2>&1 } >&4 2>&1
} }
@@ -834,21 +860,28 @@ pypy_architecture() {
esac esac
;; ;;
"CYGWIN"* | "MINGW"* ) echo "win32" ;; "CYGWIN"* | "MINGW"* ) echo "win32" ;;
"FreeBSD" )
case "$(uname -m)" in
"x86_64" ) echo "freebsd64" ;;
* ) return 1 ;;
esac
;;
* ) return 1 ;; * ) return 1 ;;
esac esac
} }
build_package_pypy() { build_package_pypy() {
build_package_copy build_package_copy
{ if [ ! -x "${PREFIX_PATH}/bin/python" ]; then mkdir -p "${PREFIX_PATH}/bin" "${PREFIX_PATH}/lib"
if [ -x "${PREFIX_PATH}/bin/pypy" ]; then local pypy libpypy
( cd "${PREFIX_PATH}/bin" && ln -fs "pypy" "python" ) shopt -s nullglob
else for pypy in "bin/pypy"*; do
echo "not a pypy binary distribution" 1>&3 ( cd "${PREFIX_PATH}/bin" && ln -fs "$(basename "${pypy}")" "$(basename "${pypy}" | sed -e 's/pypy/python/')" )
return 1 done
fi for libpypy in "bin/libpypy-c."*; do
fi ( cd "${PREFIX_PATH}/lib" && ln -fs "../bin/$(basename "${libpypy}")" "$(basename "${libpypy}")" )
} >&4 2>&1 done
shopt -u nullglob
} }
build_package_pypy_builder() { build_package_pypy_builder() {
@@ -865,7 +898,7 @@ build_package_pypy_builder() {
mv -f "pypy-c" "bin/pypy" mv -f "pypy-c" "bin/pypy"
fi fi
for libpypy in "libpypy-c."*; do for libpypy in "libpypy-c."*; do
mv -f "${libpypy}" "lib/" mv -f "${libpypy}" "bin/"
done done
} >&4 2>&1 } >&4 2>&1
build_package_pypy build_package_pypy
@@ -1074,7 +1107,15 @@ require_llvm() {
local llvm_version="$1" local llvm_version="$1"
if [ "$(uname -s)" = "Darwin" ] && [ "$(osx_version)" -ge 1010 ]; then if [ "$(uname -s)" = "Darwin" ] && [ "$(osx_version)" -ge 1010 ]; then
if [[ "$PYTHON_CONFIGURE_OPTS" != *--llvm-* ]]; then if [[ "$PYTHON_CONFIGURE_OPTS" != *--llvm-* ]]; then
if [ "$llvm_version" = "3.2" ]; then
package_option python configure --prebuilt-name="llvm-3.2-x86_64-apple-darwin13.tar.bz2" package_option python configure --prebuilt-name="llvm-3.2-x86_64-apple-darwin13.tar.bz2"
else
local llvm_prefix="$(brew --prefix llvm 2>/dev/null || true)"
local llvm_config="${llvm_prefix}/bin/llvm-config"
if [ -x "$llvm_config" ]; then
package_option python configure --llvm-config="$llvm_config"
fi
fi
fi fi
fi fi
} }
@@ -1096,6 +1137,21 @@ require_java() {
export JAVA="$java" export JAVA="$java"
} }
require_distro() {
for arg; do
if [[ "$(cat /etc/issue 2>/dev/null || true)" == "$1"* ]]; then
return 0
fi
done
{ echo
colorize 1 "WARNING"
echo ": This binary distribution is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
}
needs_yaml() { needs_yaml() {
[[ "$RUBY_CONFIGURE_OPTS" != *--with-libyaml-dir=* ]] && [[ "$RUBY_CONFIGURE_OPTS" != *--with-libyaml-dir=* ]] &&
! use_homebrew_yaml ! use_homebrew_yaml
@@ -1418,6 +1474,11 @@ build_package_verify_py34() {
build_package_verify_py33 "$1" "${2:-3.4}" build_package_verify_py33 "$1" "${2:-3.4}"
} }
# Post-install check for Python 3.5.x
build_package_verify_py35() {
build_package_verify_py34 "$1" "${2:-3.5}"
}
build_package_ez_setup() { build_package_ez_setup() {
local ez_setup="${BUILD_PATH}/ez_setup.py" local ez_setup="${BUILD_PATH}/ez_setup.py"
rm -f "${ez_setup}" rm -f "${ez_setup}"
@@ -1475,14 +1536,8 @@ version() {
} }
usage() { usage() {
{ version sed -ne '/^#/!q;s/.\{1,2\}//;1,2d;p' < "$0"
echo "usage: python-build [-k|--keep] [-v|--verbose] [-p|--patch] [-g|--debug] definition prefix" [ -z "$1" ] || exit "$1"
echo " python-build --definitions"
} >&2
if [ -z "$1" ]; then
exit 1
fi
} }
list_definitions() { list_definitions() {
@@ -1514,16 +1569,9 @@ parse_options "$@"
for option in "${OPTIONS[@]}"; do for option in "${OPTIONS[@]}"; do
case "$option" in case "$option" in
"h" | "help" ) "h" | "help" )
usage without_exiting version
{ echo
echo " -k/--keep Do not remove source tree after installation"
echo " -v/--verbose Verbose mode: print compilation status to stdout"
echo " -p/--patch Apply a patch from stdin before building"
echo " -g/--debug Build a debug version"
echo " --definitions List all built-in definitions"
echo echo
} >&2 usage 0
exit 0
;; ;;
"definitions" ) "definitions" )
list_definitions list_definitions
@@ -1548,9 +1596,11 @@ for option in "${OPTIONS[@]}"; do
esac esac
done done
[ "${#ARGUMENTS[@]}" -eq 2 ] || usage 1 >&2
DEFINITION_PATH="${ARGUMENTS[0]}" DEFINITION_PATH="${ARGUMENTS[0]}"
if [ -z "$DEFINITION_PATH" ]; then if [ -z "$DEFINITION_PATH" ]; then
usage usage 1 >&2
elif [ ! -f "$DEFINITION_PATH" ]; then elif [ ! -f "$DEFINITION_PATH" ]; then
for DEFINITION_DIR in "${PYTHON_BUILD_DEFINITIONS[@]}"; do for DEFINITION_DIR in "${PYTHON_BUILD_DEFINITIONS[@]}"; do
if [ -f "${DEFINITION_DIR}/${DEFINITION_PATH}" ]; then if [ -f "${DEFINITION_DIR}/${DEFINITION_PATH}" ]; then
@@ -1567,7 +1617,7 @@ fi
PREFIX_PATH="${ARGUMENTS[1]}" PREFIX_PATH="${ARGUMENTS[1]}"
if [ -z "$PREFIX_PATH" ]; then if [ -z "$PREFIX_PATH" ]; then
usage usage 1 >&2
elif [ "${PREFIX_PATH#/}" = "$PREFIX_PATH" ]; then elif [ "${PREFIX_PATH#/}" = "$PREFIX_PATH" ]; then
PREFIX_PATH="${PWD}/${PREFIX_PATH}" PREFIX_PATH="${PWD}/${PREFIX_PATH}"
fi fi
@@ -1731,11 +1781,17 @@ python_bin_suffix() {
case "$1" in case "$1" in
2.* | 3.* ) 2.* | 3.* )
version_name="$1" version_name="$1"
version_name="${version_name%-dev}"
version_name="${version_name%-rc*}"
version_name="${version_name%rc*}"
version_info=(${version_name//./ }) version_info=(${version_name//./ })
echo "${version_info[0]}.${version_info[1]}" echo "${version_info[0]}.${version_info[1]}"
;; ;;
stackless-2.* | stackless-3.* ) stackless-2.* | stackless-3.* )
version_name="${1#stackless-}" version_name="${1#stackless-}"
version_name="${version_name%-dev}"
version_name="${version_name%-rc*}"
version_name="${version_name%rc*}"
version_info=(${version_name//./ }) version_info=(${version_name//./ })
echo "${version_info[0]}.${version_info[1]}" echo "${version_info[0]}.${version_info[1]}"
;; ;;

View File

@@ -0,0 +1,3 @@
#require_gcc
install_package "readline-6.3" "http://ftpmirror.gnu.org/readline/readline-6.3.tar.gz#56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43" standard --if has_broken_mac_readline
install_package "Python-2.7.9" "https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz#c8bba33e66ac3201dabdc556f0ea7cfe6ac11946ec32d357c4c6f9b018c12c5b" ldflags_dirs standard verify_py27 ensurepip

View File

@@ -1,3 +0,0 @@
#require_gcc
install_package "readline-6.3" "http://ftpmirror.gnu.org/readline/readline-6.3.tar.gz#56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43" standard --if has_broken_mac_readline
install_package "Python-2.7.9rc1" "https://www.python.org/ftp/python/2.7.9/Python-2.7.9rc1.tgz#a24b21f54c1d3a8d70d8f993cd6689de395fd063e35a020cf353156c90270939" ldflags_dirs standard verify_py27 ensurepip

View File

@@ -1,3 +1,3 @@
#require_gcc #require_gcc
install_package "readline-6.3" "http://ftpmirror.gnu.org/readline/readline-6.3.tar.gz#56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43" standard --if has_broken_mac_readline install_package "readline-6.3" "http://ftpmirror.gnu.org/readline/readline-6.3.tar.gz#56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43" standard --if has_broken_mac_readline
install_hg "Python-3.4-dev" "https://bitbucket.org/mirror/cpython" "default" standard verify_py34 ensurepip install_hg "Python-3.4-dev" "https://bitbucket.org/mirror/cpython" "3.4" standard verify_py34 ensurepip

View File

@@ -0,0 +1,3 @@
#require_gcc
install_package "readline-6.3" "http://ftpmirror.gnu.org/readline/readline-6.3.tar.gz#56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43" standard --if has_broken_mac_readline
install_hg "Python-3.5-dev" "https://bitbucket.org/mirror/cpython" "default" standard verify_py35 ensurepip

View File

@@ -0,0 +1,2 @@
install_zip "IronPython-2.7.5" "https://github.com/IronLanguages/main/releases/download/ipy-2.7.5/IronPython-2.7.5.zip#d2651084a61a43379ce6c031f4f29c5e01ba96d1ff89a5282376dd4b84439b5b" ironpython
# FIXME: have not confirmed to install setuptools into IronPython yet

View File

@@ -0,0 +1,13 @@
Only in .: 003_system_library_path_in_sys_path.patch
diff -ur ../Python-2.7.2/Lib/site.py ./Lib/site.py
--- ../Python-2.7.2/Lib/site.py 2014-12-12 10:59:47.000000000 +0200
+++ ./Lib/site.py 2014-12-12 11:24:28.000000000 +0200
@@ -312,7 +312,7 @@
# locations.
from sysconfig import get_config_var
framework = get_config_var("PYTHONFRAMEWORK")
- if framework and "/%s.framework/"%(framework,) in prefix:
+ if False and framework and "/%s.framework/"%(framework,) in prefix:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))

View File

@@ -0,0 +1,13 @@
Only in .: 003_system_library_path_in_sys_path.patch
diff -ur ../Python-2.7.3/Lib/site.py ./Lib/site.py
--- ../Python-2.7.3/Lib/site.py 2012-04-10 02:07:31.000000000 +0300
+++ ./Lib/site.py 2014-12-12 11:35:33.000000000 +0200
@@ -312,7 +312,7 @@
# locations.
from sysconfig import get_config_var
framework = get_config_var("PYTHONFRAMEWORK")
- if framework:
+ if False and framework:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))

View File

@@ -0,0 +1,13 @@
Only in .: 003_system_library_path_in_sys_path.patch
diff -ur ../Python-2.7.3/Lib/site.py ./Lib/site.py
--- ../Python-2.7.3/Lib/site.py 2012-04-10 02:07:31.000000000 +0300
+++ ./Lib/site.py 2014-12-12 11:35:33.000000000 +0200
@@ -312,7 +312,7 @@
# locations.
from sysconfig import get_config_var
framework = get_config_var("PYTHONFRAMEWORK")
- if framework:
+ if False and framework:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))

View File

@@ -0,0 +1,13 @@
Only in .: 003_system_library_path_in_sys_path.patch
diff -ur ../Python-2.7.5/Lib/site.py ./Lib/site.py
--- ../Python-2.7.5/Lib/site.py 2013-05-12 06:32:44.000000000 +0300
+++ ./Lib/site.py 2014-12-12 11:29:29.000000000 +0200
@@ -300,7 +300,7 @@
# locations.
from sysconfig import get_config_var
framework = get_config_var("PYTHONFRAMEWORK")
- if framework:
+ if False and framework:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))

View File

@@ -0,0 +1,13 @@
Only in .: 003_system_library_path_in_sys_path.patch
diff -ur ../Python-2.7.5/Lib/site.py ./Lib/site.py
--- ../Python-2.7.5/Lib/site.py 2013-05-12 06:32:44.000000000 +0300
+++ ./Lib/site.py 2014-12-12 11:29:29.000000000 +0200
@@ -300,7 +300,7 @@
# locations.
from sysconfig import get_config_var
framework = get_config_var("PYTHONFRAMEWORK")
- if framework:
+ if False and framework:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))

View File

@@ -0,0 +1,13 @@
Only in .: 003_system_library_path_in_sys_path.patch
diff -ur ../Python-2.7.5/Lib/site.py ./Lib/site.py
--- ../Python-2.7.5/Lib/site.py 2013-05-12 06:32:44.000000000 +0300
+++ ./Lib/site.py 2014-12-12 11:29:29.000000000 +0200
@@ -300,7 +300,7 @@
# locations.
from sysconfig import get_config_var
framework = get_config_var("PYTHONFRAMEWORK")
- if framework:
+ if False and framework:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))

View File

@@ -0,0 +1,13 @@
Only in .: 003_system_library_path_in_sys_path.patch
diff -ur ../Python-2.7.8/Lib/site.py ./Lib/site.py
--- ../Python-2.7.8/Lib/site.py 2014-06-30 05:05:30.000000000 +0300
+++ ./Lib/site.py 2014-12-12 11:42:33.000000000 +0200
@@ -300,7 +300,7 @@
# locations.
from sysconfig import get_config_var
framework = get_config_var("PYTHONFRAMEWORK")
- if framework:
+ if False and framework:
sitepackages.append(
os.path.join("/Library", framework,
sys.version[:3], "site-packages"))

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -1,22 +1,10 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 12.04" "Ubuntu 12.10" "Ubuntu 13.04" "Ubuntu 13.10" "Ubuntu 14.04" || true
install_package "pypy-2.4.0-linux" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.4.0-linux.tar.bz2#a24adb366f87ac0eba829d7188a156a7d897e71893689fab06502c3f4152ac0e" "pypy" verify_py27 ensurepip install_package "pypy-2.4.0-linux" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.4.0-linux.tar.bz2#a24adb366f87ac0eba829d7188a156a7d897e71893689fab06502c3f4152ac0e" "pypy" verify_py27 ensurepip
;; ;;
"linux-armel" ) "linux-armel" )
require_distro "Ubuntu 12.04" || true require_distro "Ubuntu 12.04" "Ubuntu 12.10" "Ubuntu 13.04" "Ubuntu 13.10" "Ubuntu 14.04" || true
install_package "pypy-2.4.0-linux-armel" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.4.0-linux-armel.tar.bz2#8362d634bf86fbfb3b99b578b13c0a9fd673b2b7580d6d65b4a181934c659ccd" "pypy" verify_py27 ensurepip install_package "pypy-2.4.0-linux-armel" "https://bitbucket.org/pypy/pypy/downloads/pypy-2.4.0-linux-armel.tar.bz2#8362d634bf86fbfb3b99b578b13c0a9fd673b2b7580d6d65b4a181934c659ccd" "pypy" verify_py27 ensurepip
;; ;;
"linux-armhf" ) "linux-armhf" )

View File

@@ -0,0 +1,35 @@
case "$(pypy_architecture 2>/dev/null || true)" in
"linux" )
install_nightly_package "pypy-c-jit-latest-linux" "http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-linux.tar.bz2" "pypy-c-jit-*-linux" "pypy" verify_py27 ensurepip
;;
"linux-armel" )
install_nightly_package "pypy-c-jit-latest-linux-armel" "http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-linux-armel.tar.bz2" "pypy-c-jit-*-linux-armel" "pypy" verify_py27 ensurepip
;;
"linux-armhf" )
if [[ "$(cat /etc/issue 2>/dev/null || true)" == "Raspbian"* ]]; then
install_nightly_package "pypy-c-jit-latest-linux-armhf-raspbian" "http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-linux-armhf-raspbian.tar.bz2" "pypy-c-jit-*-linux-armhf-raspbian" "pypy" verify_py27 ensurepip
else
install_nightly_package "pypy-c-jit-latest-linux-armhf-raring" "http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-linux-armhf-raring.tar.bz2" "pypy-c-jit-*-linux-armhf-raring" "pypy" verify_py27 ensurepip
fi
;;
"linux64" )
install_nightly_package "pypy-c-jit-latest-linux64" "http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-linux64.tar.bz2" "pypy-c-jit-*-linux64" "pypy" verify_py27 ensurepip
;;
"osx64" )
install_nightly_package "pypy-c-jit-latest-osx64" "http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-osx64.tar.bz2" "pypy-c-jit-*-osx64" "pypy" verify_py27 ensurepip
;;
"freebsd64" )
install_nightly_package "pypy-c-jit-latest-freebsd64" "http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-freebsd64.tar.bz2" "pypy-c-jit-*-freebsd64" "pypy" verify_py27 ensurepip
;;
#"win32" )
# install_zip "pypy-c-jit-latest-win32" "http://buildbot.pypy.org/nightly/trunk/pypy-c-jit-latest-win32.zip" "pypy" verify_py27 ensurepip
# ;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,35 @@
case "$(pypy_architecture 2>/dev/null || true)" in
"linux" )
install_nightly_package "pypy-c-nojit-latest-linux" "http://buildbot.pypy.org/nightly/trunk/pypy-c-nojit-latest-linux.tar.bz2" "pypy-c-nojit-*-linux" "pypy" verify_py27 ensurepip
;;
"linux-armel" )
install_nightly_package "pypy-c-nojit-latest-linux-armel" "http://buildbot.pypy.org/nightly/trunk/pypy-c-nojit-latest-linux-armel.tar.bz2" "pypy-c-nojit-*-linux-armel" "pypy" verify_py27 ensurepip
;;
"linux-armhf" )
if [[ "$(cat /etc/issue 2>/dev/null || true)" == "Raspbian"* ]]; then
install_nightly_package "pypy-c-nojit-latest-linux-armhf-raspbian" "http://buildbot.pypy.org/nightly/trunk/pypy-c-nojit-latest-linux-armhf-raspbian.tar.bz2" "pypy-c-nojit-*-linux-armhf-raspbian" "pypy" verify_py27 ensurepip
else
install_nightly_package "pypy-c-nojit-latest-linux-armhf-raring" "http://buildbot.pypy.org/nightly/trunk/pypy-c-nojit-latest-linux-armhf-raring.tar.bz2" "pypy-c-nojit-*-linux-armhf-raring" "pypy" verify_py27 ensurepip
fi
;;
"linux64" )
install_nightly_package "pypy-c-nojit-latest-linux64" "http://buildbot.pypy.org/nightly/trunk/pypy-c-nojit-latest-linux64.tar.bz2" "pypy-c-nojit-*-linux64" "pypy" verify_py27 ensurepip
;;
"osx64" )
install_nightly_package "pypy-c-nojit-latest-osx64" "http://buildbot.pypy.org/nightly/trunk/pypy-c-nojit-latest-osx64.tar.bz2" "pypy-c-nojit-*-osx64" "pypy" verify_py27 ensurepip
;;
"freebsd64" )
install_nightly_package "pypy-c-nojit-latest-freebsd64" "http://buildbot.pypy.org/nightly/trunk/pypy-c-nojit-latest-freebsd64.tar.bz2" "pypy-c-nojit-*-freebsd64" "pypy" verify_py27 ensurepip
;;
#"win32" )
# install_zip "pypy-c-nojit-latest-win32" "http://buildbot.pypy.org/nightly/trunk/pypy-c-nojit-latest-win32.zip" "pypy" verify_py27 ensurepip
# ;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true)."
echo
} >&2
exit 1
;;
esac

View File

@@ -1,15 +1,3 @@
require_distro() {
if [[ "$(cat /etc/issue 2>/dev/null || true)" != "$1"* ]]; then
{ echo
colorize 1 "WARNING"
echo ": The binary distribution of PyPy is built for $1."
echo "installed binary may not run expectedly on other platforms."
echo
} >&2
return 1
fi
}
case "$(pypy_architecture 2>/dev/null || true)" in case "$(pypy_architecture 2>/dev/null || true)" in
"linux" ) "linux" )
require_distro "Ubuntu 10.04" || true require_distro "Ubuntu 10.04" || true

View File

@@ -0,0 +1,38 @@
case "$(pypy_architecture 2>/dev/null || true)" in
"linux" )
require_distro "Ubuntu 10.04" || true
install_package "pypy3-2.4.0-linux" "https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux.tar.bz2#108fdcccfddb9b2cb2fc3cbca5e6f7902ed3ab74a24c8ae29da7fbdadbab4345" "pypy" verify_py32 ensurepip
;;
"linux-armel" )
require_distro "Ubuntu 12.04" "Ubuntu 12.10" "Ubuntu 13.04" "Ubuntu 13.10" "Ubuntu 14.04" || true
install_package "pypy3-2.4.0-linux-armel" "https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux-armel.tar.bz2#322ddc863006a97d48edc302a73bb0981bbc142951237ed161ca0ca2cd02831f" "pypy" verify_py32 ensurepip
;;
"linux-armhf")
if [[ "$(cat /etc/issue 2>/dev/null || true)" == "Raspbian"* ]]; then
install_package "pypy3-2.4.0-linux-armhf-raspbian" "https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux-armhf-raspbian.tar.bz2#ad8f00255c85bf3c1012d56d5638c7aee12bc9f1ddcdaad35985bbd65a16c602" "pypy" verify_py32 ensurepip
else
require_distro "Ubuntu 13.04" || true
install_package "pypy3-2.4.0-linux-armhf-raring" "https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux-armhf-raring.tar.bz2#eb41a3ee62741199aeeab818553ded460db991911609acf36e5710f491e5ac0a" "pypy" verify_py32 ensurepip
fi
;;
"linux64" )
require_distro "Ubuntu 12.04" || true
install_package "pypy3-2.4.0-linux64" "https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-linux64.tar.bz2#24e680b1742af7361107876a421dd793f5ef852dd5f097546f84b1378f7f70cc" "pypy" verify_py32 ensurepip
;;
"osx64" )
install_package "pypy3-2.4.0-osx64" "https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-osx64.tar.bz2#dcd86bdb753e93dbf55e1f3af3ffa97eea328b8b77aa60e92ea2260a6258cedb" "pypy" verify_py32 ensurepip
;;
"win32" )
# FIXME: never tested on Windows
install_zip "pypy3-2.4.0-win32" "https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-win32.zip#7ea499993b07405898dee9435836220d8c7b8abfa1b1f760c4a1c04b43945797" "pypy" verify_py32 ensurepip
;;
* )
{ echo
colorize 1 "ERROR"
echo ": The binary distribution of PyPy is not available for $(pypy_architecture 2>/dev/null || true)."
echo "try 'pypy3-2.4.0-src' to build from soruce."
echo
} >&2
exit 1
;;
esac

View File

@@ -0,0 +1,2 @@
require_gcc
install_package "pypy3-2.4.0-src" "https://bitbucket.org/pypy/pypy/downloads/pypy3-2.4.0-src.tar.bz2#d9ba207d6eecf8a0dc4414e9f4e92db1abd143e8cc6ec4a6bdcac75b29f104f3" "pypy_builder" verify_py32 ensurepip

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bats
load test_helper
@test "not enought arguments for python-build" {
# use empty inline definition so nothing gets built anyway
local definition="${TMP}/build-definition"
echo '' > "$definition"
run python-build "$definition"
assert_failure
assert_output_contains 'Usage: python-build'
}
@test "extra arguments for python-build" {
# use empty inline definition so nothing gets built anyway
local definition="${TMP}/build-definition"
echo '' > "$definition"
run python-build "$definition" "${TMP}/install" ""
assert_failure
assert_output_contains 'Usage: python-build'
}

View File

@@ -5,6 +5,7 @@ export PYTHON_BUILD_CACHE_PATH="$TMP/cache"
export MAKE=make export MAKE=make
export MAKE_OPTS="-j 2" export MAKE_OPTS="-j 2"
export CC=cc export CC=cc
export -n PYTHON_CONFIGURE_OPTS
setup() { setup() {
mkdir -p "$INSTALL_ROOT" mkdir -p "$INSTALL_ROOT"
@@ -449,6 +450,18 @@ OUT
# nop # nop
} }
@test "JRuby Java 7 missing" {
# nop
}
@test "JRuby Java is outdated" {
# nop
}
@test "JRuby Java 7 up-to-date" {
# nop
}
@test "non-writable TMPDIR aborts build" { @test "non-writable TMPDIR aborts build" {
export TMPDIR="${TMP}/build" export TMPDIR="${TMP}/build"
mkdir -p "$TMPDIR" mkdir -p "$TMPDIR"

View File

@@ -5,8 +5,13 @@ export MAKE=make
export MAKE_OPTS='-j 2' export MAKE_OPTS='-j 2'
export -n CFLAGS export -n CFLAGS
export -n CC export -n CC
export -n PYTHON_CONFIGURE_OPTS
@test "require_gcc on OS X 10.9" { @test "require_gcc on OS X 10.9" {
# yyuu/pyenv#222
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5'
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.9.5' stub sw_vers '-productVersion : echo 10.9.5'
stub gcc '--version : echo 4.2.1' stub gcc '--version : echo 4.2.1'
@@ -24,6 +29,10 @@ OUT
} }
@test "require_gcc on OS X 10.10" { @test "require_gcc on OS X 10.10" {
# yyuu/pyenv#222
stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
stub uname '-s : echo Darwin' stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10' stub sw_vers '-productVersion : echo 10.10'
stub gcc '--version : echo 4.2.1' stub gcc '--version : echo 4.2.1'
@@ -36,7 +45,7 @@ DEF
assert_success assert_success
assert_output <<OUT assert_output <<OUT
CC=${TMP}/bin/gcc CC=${TMP}/bin/gcc
MACOSX_DEPLOYMENT_TARGET=10.10 MACOSX_DEPLOYMENT_TARGET=10.9
OUT OUT
} }

View File

@@ -146,3 +146,42 @@ ${PYENV_ROOT}/plugins/bar/share/python-build
${PYENV_ROOT}/plugins/foo/share/python-build ${PYENV_ROOT}/plugins/foo/share/python-build
OUT OUT
} }
@test "not enough arguments for pyenv-install" {
stub_python_build
run pyenv-install
assert_failure
assert_output_contains 'Usage: pyenv install'
}
@test "too many arguments for pyenv-install" {
stub_python_build
run pyenv-install 3.4.1 3.4.2
assert_failure
assert_output_contains 'Usage: pyenv install'
}
@test "show help for pyenv-install" {
stub_python_build
run pyenv-install -h
assert_success
assert_output_contains 'Usage: pyenv install'
}
@test "not enough arguments pyenv-uninstall" {
run pyenv-uninstall
assert_failure
assert_output_contains 'Usage: pyenv uninstall'
}
@test "too many arguments for pyenv-uninstall" {
run pyenv-uninstall 3.4.1 3.4.2
assert_failure
assert_output_contains 'Usage: pyenv uninstall'
}
@test "show help for pyenv-uninstall" {
run pyenv-uninstall -h
assert_success
assert_output_contains 'Usage: pyenv uninstall'
}

View File

@@ -115,6 +115,10 @@ assert_output() {
assert_output_contains() { assert_output_contains() {
local expected="$1" local expected="$1"
if [ -z "$expected" ]; then
echo "assert_output_contains needs an argument" >&2
return 1
fi
echo "$output" | $(type -p ggrep grep | head -1) -F "$expected" >/dev/null || { echo "$output" | $(type -p ggrep grep | head -1) -F "$expected" >/dev/null || {
{ echo "expected output to contain $expected" { echo "expected output to contain $expected"
echo "actual: $output" echo "actual: $output"

View File

@@ -0,0 +1,5 @@
PYENV_PIP_REHASH_ROOT="${BASH_SOURCE[0]%/*}/pip-rehash"
if [ -x "${PYENV_PIP_REHASH_ROOT}/${PYENV_COMMAND##*/}" ]; then
PYENV_COMMAND_PATH="${PYENV_PIP_REHASH_ROOT}/${PYENV_COMMAND##*/}"
PYENV_BIN_PATH="${PYENV_PIP_REHASH_ROOT}"
fi

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Remove pyenv-pip-rehash/libexec from PATH to avoid infinite loops in `pyenv-which` (yyuu/pyenv#146)
_PATH=":${PATH}:"
_HERE="$(dirname "${BASH_SOURCE[0]}")" # remove this from PATH
_PATH="${_PATH//:${_HERE}:/:}"
_PATH="${_PATH#:}"
_PATH="${_PATH%:}"
PATH="${_PATH}"
PYENV_COMMAND_PATH="$(pyenv-which "$(basename "$0")")"
PYENV_BIN_PATH="${PYENV_COMMAND_PATH%/*}"
export PATH="${PYENV_BIN_PATH}:${PATH}"
STATUS=0
"$PYENV_COMMAND_PATH" "$@" || STATUS="$?"
# Run `pyenv-rehash` after a successful installation.
if [ "$STATUS" == "0" ]; then
pyenv-rehash
fi
exit "$STATUS"

29
pyenv.d/exec/pip-rehash/pip Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Remove pyenv-pip-rehash/libexec from PATH to avoid infinite loops in `pyenv-which` (yyuu/pyenv#146)
_PATH=":${PATH}:"
_HERE="$(dirname "${BASH_SOURCE[0]}")" # remove this from PATH
_PATH="${_PATH//:${_HERE}:/:}"
_PATH="${_PATH#:}"
_PATH="${_PATH%:}"
PATH="${_PATH}"
PYENV_COMMAND_PATH="$(pyenv-which "$(basename "$0")")"
PYENV_BIN_PATH="${PYENV_COMMAND_PATH%/*}"
export PATH="${PYENV_BIN_PATH}:${PATH}"
STATUS=0
"$PYENV_COMMAND_PATH" "$@" || STATUS="$?"
# Run `pyenv-rehash` after a successful installation.
if [ "$STATUS" == "0" ]; then
case "$1" in
"install" | "uninstall" ) pyenv-rehash;;
esac
fi
exit "$STATUS"

View File

@@ -1,20 +0,0 @@
#!/usr/bin/env bash
set -e
[ -d ./bats/bin ] && export PATH="$(pwd)"/bats/bin:"$PATH"
STATUS=0
bats -t test && ( cd plugins/python-build && bats -t test ) || STATUS="$?"
#if [ "$TRAVIS_PULL_REQUEST" != "false" ] && [ -z "$TRAVIS_COMMIT_RANGE" ]; then
# first_sha="$(curl -fsSL https://github.com/${TRAVIS_REPO_SLUG}/pull/${TRAVIS_PULL_REQUEST}.patch | head -1 | awk '{print $2}')"
# export TRAVIS_COMMIT_RANGE="${first_sha}^..${TRAVIS_COMMIT}"
#fi
#if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then
# ./script/mirror update "$TRAVIS_COMMIT_RANGE"
#elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
# ./script/mirror verify "$TRAVIS_COMMIT_RANGE"
#fi
exit "$STATUS"

25
src/Makefile.in Normal file
View File

@@ -0,0 +1,25 @@
CC = @CC@
CFLAGS = @CFLAGS@
LOCAL_CFLAGS = @LOCAL_CFLAGS@
DEFS = @DEFS@
LOCAL_DEFS = @LOCAL_DEFS@
CCFLAGS = $(DEFS) $(LOCAL_DEFS) $(LOCAL_CFLAGS) $(CFLAGS)
SHOBJ_CC = @SHOBJ_CC@
SHOBJ_CFLAGS = @SHOBJ_CFLAGS@
SHOBJ_LD = @SHOBJ_LD@
SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
SHOBJ_LIBS = @SHOBJ_LIBS@
SHOBJ_STATUS = @SHOBJ_STATUS@
.c.o:
$(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) -c -o $@ $<
../libexec/pyenv-realpath.dylib: realpath.o
$(SHOBJ_LD) $(SHOBJ_LDFLAGS) $(SHOBJ_XLDFLAGS) -o $@ realpath.o $(SHOBJ_LIBS)
clean:
rm -f *.o ../libexec/*.dylib

31
src/bash.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef __BASH_H__
#define __BASH_H__
#define EXECUTION_SUCCESS 0
#define EXECUTION_FAILURE 1
#define EX_USAGE 258
#define BUILTIN_ENABLED 1
typedef struct word_desc {
char *word;
int flags;
} WORD_DESC;
typedef struct word_list {
struct word_list *next;
WORD_DESC *word;
} WORD_LIST;
typedef int sh_builtin_func_t(WORD_LIST *);
struct builtin {
char *name;
sh_builtin_func_t *function;
int flags;
char * const *long_doc;
const char *short_doc;
char *unused;
};
#endif

46
src/configure vendored Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env bash
set -e
src_dir="${0%/*}"
if [ -z "$CC" ]; then
if type -p gcc >/dev/null; then
CC=gcc
else
echo "warning: gcc not found; using CC=cc" >&2
CC=cc
fi
fi
if ! type -p "$CC" >/dev/null; then
echo "aborted: compiler not found: $CC" >&2
exit 1
fi
case "$(uname -s)" in
Darwin* )
host_os="darwin$(uname -r)"
;;
OpenBSD* )
host_os="openbsd$(uname -r)"
;;
* )
host_os="linux-gnu"
esac
eval "$("$src_dir"/shobj-conf -C "$CC" -o "$host_os")"
sed "
s,@CC@,${CC},
s,@CFLAGS@,${CFLAGS},
s,@LOCAL_CFLAGS@,${LOCAL_CFLAGS},
s,@DEFS@,${DEFS},
s,@LOCAL_DEFS@,${LOCAL_DEFS},
s,@SHOBJ_CC@,${SHOBJ_CC},
s,@SHOBJ_CFLAGS@,${SHOBJ_CFLAGS},
s,@SHOBJ_LD@,${SHOBJ_LD},
s,@SHOBJ_LDFLAGS@,${SHOBJ_LDFLAGS//,/\,},
s,@SHOBJ_XLDFLAGS@,${SHOBJ_XLDFLAGS//,/\,},
s,@SHOBJ_LIBS@,${SHOBJ_LIBS},
s,@SHOBJ_STATUS@,${SHOBJ_STATUS},
" "$src_dir"/Makefile.in > "$src_dir"/Makefile

43
src/realpath.c Normal file
View File

@@ -0,0 +1,43 @@
#include "bash.h"
#include <stdlib.h>
#include <stdio.h>
int realpath_builtin(list)
WORD_LIST *list;
{
int es;
char *realbuf, *p;
if (list == 0) {
// builtin_usage();
return (EX_USAGE);
}
for (es = EXECUTION_SUCCESS; list; list = list->next) {
p = list->word->word;
realbuf = realpath(p, NULL);
if (realbuf == NULL) {
es = EXECUTION_FAILURE;
// builtin_error("%s: cannot resolve: %s", p, strerror(errno));
} else {
printf("%s\n", realbuf);
free(realbuf);
}
}
return es;
}
char *realpath_doc[] = {
"Display each PATHNAME argument, resolving symbolic links. The exit status",
"is 0 if each PATHNAME was resolved; non-zero otherwise.",
(char *)NULL
};
struct builtin realpath_struct = {
"realpath",
realpath_builtin,
BUILTIN_ENABLED,
realpath_doc,
"realpath pathname [pathname...]",
0
};

558
src/shobj-conf Executable file
View File

@@ -0,0 +1,558 @@
#! /bin/sh
#
# shobj-conf -- output a series of variable assignments to be substituted
# into a Makefile by configure which specify system-dependent
# information for creating shared objects that may be loaded
# into bash with `enable -f'
#
# usage: shobj-conf [-C compiler] -c host_cpu -o host_os -v host_vendor
#
# Chet Ramey
# chet@po.cwru.edu
# Copyright (C) 1996-2002 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
#
# defaults
#
SHOBJ_STATUS=supported
SHLIB_STATUS=supported
SHOBJ_CC=cc
SHOBJ_CFLAGS=
SHOBJ_LD=
SHOBJ_LDFLAGS=
SHOBJ_XLDFLAGS=
SHOBJ_LIBS=
SHLIB_XLDFLAGS=
SHLIB_LIBS=
SHLIB_DOT='.'
SHLIB_LIBPREF='lib'
SHLIB_LIBSUFF='so'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF)'
SHLIB_DLLVERSION='$(SHLIB_MAJOR)'
PROGNAME=`basename $0`
USAGE="$PROGNAME [-C compiler] -c host_cpu -o host_os -v host_vendor"
while [ $# -gt 0 ]; do
case "$1" in
-C) shift; SHOBJ_CC="$1"; shift ;;
-c) shift; host_cpu="$1"; shift ;;
-o) shift; host_os="$1"; shift ;;
-v) shift; host_vendor="$1"; shift ;;
*) echo "$USAGE" >&2 ; exit 2;;
esac
done
case "${host_os}-${SHOBJ_CC}" in
sunos4*-*gcc*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD=/usr/bin/ld
SHOBJ_LDFLAGS='-assert pure-text'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
sunos4*)
SHOBJ_CFLAGS=-pic
SHOBJ_LD=/usr/bin/ld
SHOBJ_LDFLAGS='-assert pure-text'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
sunos5*-*gcc*|solaris2*-*gcc*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
ld_used=`gcc -print-prog-name=ld`
if ${ld_used} -V 2>&1 | grep GNU >/dev/null 2>&1; then
# This line works for the GNU ld
SHOBJ_LDFLAGS='-shared -Wl,-h,$@'
else
# This line works for the Solaris linker in /usr/ccs/bin/ld
SHOBJ_LDFLAGS='-shared -Wl,-i -Wl,-h,$@'
fi
# SHLIB_XLDFLAGS='-R $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sunos5*|solaris2*)
SHOBJ_CFLAGS='-K pic'
SHOBJ_LD=/usr/ccs/bin/ld
SHOBJ_LDFLAGS='-G -dy -z text -i -h $@'
# SHLIB_XLDFLAGS='-R $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
# All versions of Linux or the semi-mythical GNU Hurd.
linux*-*|gnu*-*|k*bsd*-gnu-*)
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir) -Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
freebsd2* | netbsd*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-x -Bshareable'
SHLIB_XLDFLAGS='-R$(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
# FreeBSD-3.x ELF
freebsd[3-9]*|freebsdelf[3-9]*|freebsdaout[3-9]*|dragonfly*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
if [ -x /usr/bin/objformat ] && [ "`/usr/bin/objformat`" = "elf" ]; then
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
else
SHOBJ_LDFLAGS='-shared'
SHLIB_XLDFLAGS='-R$(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
fi
;;
# Darwin/MacOS X
darwin1*)
SHOBJ_STATUS=supported
SHLIB_STATUS=supported
SHOBJ_CFLAGS=''
SHLIB_LIBSUFF='dylib'
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-dynamiclib'
;;
darwin8*)
SHOBJ_STATUS=supported
SHLIB_STATUS=supported
SHOBJ_CFLAGS='-fno-common'
SHOBJ_LD='MACOSX_DEPLOYMENT_TARGET=10.3 ${CC}'
SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
SHLIB_LIBSUFF='dylib'
SHOBJ_LDFLAGS='-undefined dynamic_lookup'
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
;;
darwin*|macosx*)
SHOBJ_STATUS=unsupported
SHLIB_STATUS=supported
SHOBJ_CFLAGS='-fno-common'
SHOBJ_LD='${CC}'
SHLIB_LIBVERSION='$(SHLIB_MAJOR)$(SHLIB_MINOR).$(SHLIB_LIBSUFF)'
SHLIB_LIBSUFF='dylib'
case "${host_os}" in
darwin[78]*) SHOBJ_LDFLAGS=''
SHLIB_XLDFLAGS='-dynamiclib -arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
;;
*) SHOBJ_LDFLAGS='-dynamic'
SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/$@ -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
;;
esac
SHLIB_LIBS='-lncurses' # see if -lcurses works on MacOS X 10.1
;;
openbsd*)
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
SHLIB_XLDFLAGS='-R$(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
bsdi2*)
SHOBJ_CC=shlicc2
SHOBJ_CFLAGS=
SHOBJ_LD=ld
SHOBJ_LDFLAGS=-r
SHOBJ_LIBS=-lc_s.2.1.0
# BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
# the ass -- they require changing {/usr/lib,etc}/shlib.map on
# each system, and the library creation process is byzantine
SHLIB_STATUS=unsupported
;;
bsdi3*)
SHOBJ_CC=shlicc2
SHOBJ_CFLAGS=
SHOBJ_LD=ld
SHOBJ_LDFLAGS=-r
SHOBJ_LIBS=-lc_s.3.0.0
# BSD/OS 2.x and 3.x `shared libraries' are too much of a pain in
# the ass -- they require changing {/usr/lib,etc}/shlib.map on
# each system, and the library creation process is byzantine
SHLIB_STATUS=unsupported
;;
bsdi4*)
# BSD/OS 4.x now supports ELF and SunOS-style dynamically-linked
# shared libraries. gcc 2.x is the standard compiler, and the
# `normal' gcc options should work as they do in Linux.
SHOBJ_CFLAGS=-fPIC
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
SHLIB_XLDFLAGS='-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)$(SHLIB_MINOR)'
;;
osf*-*gcc*)
# Fix to use gcc linker driver from bfischer@TechFak.Uni-Bielefeld.DE
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
SHLIB_XLDFLAGS='-rpath $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
osf*)
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-shared -soname $@ -expect_unresolved "*"'
SHLIB_XLDFLAGS='-rpath $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
aix4.[2-9]*-*gcc*) # lightly tested by jik@cisco.com
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='ld'
SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
SHOBJ_XLDFLAGS='-G'
SHLIB_XLDFLAGS='-bM:SRE'
SHLIB_LIBS='-lcurses -lc'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
aix4.[2-9]*)
SHOBJ_CFLAGS=-K
SHOBJ_LD='ld'
SHOBJ_LDFLAGS='-bdynamic -bnoentry -bexpall'
SHOBJ_XLDFLAGS='-G'
SHLIB_XLDFLAGS='-bM:SRE'
SHLIB_LIBS='-lcurses -lc'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
#
# THE FOLLOWING ARE UNTESTED -- and some may not support the dlopen interface
#
irix[56]*-*gcc*)
SHOBJ_CFLAGS='-fpic'
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-soname,$@'
SHLIB_XLDFLAGS='-Wl,-rpath,$(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
irix[56]*)
SHOBJ_CFLAGS='-K PIC'
SHOBJ_LD=ld
# SHOBJ_LDFLAGS='-call_shared -hidden_symbol -no_unresolved -soname $@'
# Change from David Kaelbling <drk@sgi.com>. If you have problems,
# remove the `-no_unresolved'
SHOBJ_LDFLAGS='-shared -no_unresolved -soname $@'
SHLIB_XLDFLAGS='-rpath $(libdir)'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
hpux9*-*gcc*)
# must use gcc; the bundled cc cannot compile PIC code
SHOBJ_CFLAGS='-fpic'
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
SHLIB_LIBSUFF='sl'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
hpux9*)
SHOBJ_STATUS=unsupported
SHLIB_STATUS=unsupported
# If you are using the HP ANSI C compiler, you can uncomment and use
# this code (I have not tested it)
# SHOBJ_STATUS=supported
# SHLIB_STATUS=supported
#
# SHOBJ_CFLAGS='+z'
# SHOBJ_LD='ld'
# SHOBJ_LDFLAGS='-b +s'
#
# SHLIB_XLDFLAGS='+b $(libdir)'
# SHLIB_LIBSUFF='sl'
# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
hpux10*-*gcc*)
# must use gcc; the bundled cc cannot compile PIC code
SHOBJ_CFLAGS='-fpic'
SHOBJ_LD='${CC}'
# if you have problems linking here, moving the `-Wl,+h,$@' from
# SHLIB_XLDFLAGS to SHOBJ_LDFLAGS has been reported to work
SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,+s'
SHLIB_XLDFLAGS='-Wl,+h,$@ -Wl,+b,$(libdir)'
SHLIB_LIBSUFF='sl'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
hpux10*)
SHOBJ_STATUS=unsupported
SHLIB_STATUS=unsupported
# If you are using the HP ANSI C compiler, you can uncomment and use
# this code (I have not tested it)
# SHOBJ_STATUS=supported
# SHLIB_STATUS=supported
#
# SHOBJ_CFLAGS='+z'
# SHOBJ_LD='ld'
# SHOBJ_LDFLAGS='-b +s +h $@'
#
# SHLIB_XLDFLAGS='+b $(libdir)'
# SHLIB_LIBSUFF='sl'
# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
hpux11*-*gcc*)
# must use gcc; the bundled cc cannot compile PIC code
SHOBJ_CFLAGS='-fpic'
SHOBJ_LD='${CC}'
# SHOBJ_LDFLAGS='-shared -Wl,-b -Wl,-B,symbolic -Wl,+s -Wl,+std -Wl,+h,$@'
SHOBJ_LDFLAGS='-shared -fpic -Wl,-b -Wl,+s -Wl,+h,$@'
SHLIB_XLDFLAGS='-Wl,+b,$(libdir)'
SHLIB_LIBSUFF='sl'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
hpux11*)
SHOBJ_STATUS=unsupported
SHLIB_STATUS=unsupported
# If you are using the HP ANSI C compiler, you can uncomment and use
# this code (I have not tested it)
# SHOBJ_STATUS=supported
# SHLIB_STATUS=supported
#
# SHOBJ_CFLAGS='+z'
# SHOBJ_LD='ld'
# SHOBJ_LDFLAGS='-b +s +h $@'
#
# SHLIB_XLDFLAGS='+b $(libdir)'
# SHLIB_LIBSUFF='sl'
# SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sysv4*-*gcc*)
SHOBJ_CFLAGS=-shared
SHOBJ_LDFLAGS='-shared -h $@'
SHOBJ_LD='${CC}'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sysv4*)
SHOBJ_CFLAGS='-K PIC'
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-dy -z text -G -h $@'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sco3.2v5*-*gcc*)
SHOBJ_CFLAGS='-fpic' # DEFAULTS TO ELF
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sco3.2v5*)
SHOBJ_CFLAGS='-K pic -b elf'
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-G -b elf -dy -z text -h $@'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sysv5uw7*-*gcc*)
SHOBJ_CFLAGS='-fpic'
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sysv5uw7*)
SHOBJ_CFLAGS='-K PIC'
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-G -dy -z text -h $@'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sysv5UnixWare*-*gcc*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sysv5UnixWare*)
SHOBJ_CFLAGS='-K PIC'
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-G -dy -z text -h $@'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sysv5OpenUNIX*-*gcc*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
sysv5OpenUNIX*)
SHOBJ_CFLAGS='-K PIC'
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-G -dy -z text -h $@'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
dgux*-*gcc*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
dgux*)
SHOBJ_CFLAGS='-K pic'
SHOBJ_LD=ld
SHOBJ_LDFLAGS='-G -dy -h $@'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
msdos*)
SHOBJ_STATUS=unsupported
SHLIB_STATUS=unsupported
;;
cygwin*)
SHOBJ_LD='$(CC)'
SHOBJ_LDFLAGS='-shared -Wl,--enable-auto-import -Wl,--enable-auto-image-base -Wl,--export-all -Wl,--out-implib=$(@).a'
SHLIB_LIBPREF='cyg'
SHLIB_LIBSUFF='dll'
SHLIB_LIBVERSION='$(SHLIB_DLLVERSION).$(SHLIB_LIBSUFF)'
SHLIB_LIBS='$(TERMCAP_LIB)'
SHLIB_DOT=
# For official cygwin releases, DLLVERSION will be defined in the
# environment of configure, and will be incremented any time the API
# changes in a non-backwards compatible manner. Otherwise, it is just
# SHLIB_MAJOR.
if [ -n "$DLLVERSION" ] ; then
SHLIB_DLLVERSION="$DLLVERSION"
fi
;;
#
# Rely on correct gcc configuration for everything else
#
*-*gcc*)
SHOBJ_CFLAGS=-fpic
SHOBJ_LD='${CC}'
SHOBJ_LDFLAGS='-shared'
SHLIB_LIBVERSION='$(SHLIB_LIBSUFF).$(SHLIB_MAJOR)'
;;
*)
SHOBJ_STATUS=unsupported
SHLIB_STATUS=unsupported
;;
esac
echo SHOBJ_CC=\'"$SHOBJ_CC"\'
echo SHOBJ_CFLAGS=\'"$SHOBJ_CFLAGS"\'
echo SHOBJ_LD=\'"$SHOBJ_LD"\'
echo SHOBJ_LDFLAGS=\'"$SHOBJ_LDFLAGS"\'
echo SHOBJ_XLDFLAGS=\'"$SHOBJ_XLDFLAGS"\'
echo SHOBJ_LIBS=\'"$SHOBJ_LIBS"\'
echo SHLIB_XLDFLAGS=\'"$SHLIB_XLDFLAGS"\'
echo SHLIB_LIBS=\'"$SHLIB_LIBS"\'
echo SHLIB_DOT=\'"$SHLIB_DOT"\'
echo SHLIB_LIBPREF=\'"$SHLIB_LIBPREF"\'
echo SHLIB_LIBSUFF=\'"$SHLIB_LIBSUFF"\'
echo SHLIB_LIBVERSION=\'"$SHLIB_LIBVERSION"\'
echo SHLIB_DLLVERSION=\'"$SHLIB_DLLVERSION"\'
echo SHOBJ_STATUS=\'"$SHOBJ_STATUS"\'
echo SHLIB_STATUS=\'"$SHLIB_STATUS"\'
exit 0

View File

@@ -21,7 +21,7 @@ load test_helper
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)" root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
run pyenv-init - bash run pyenv-init - bash
assert_success assert_success
assert_line "source '${root}/libexec/../completions/pyenv.bash'" assert_line "source '${root}/test/../libexec/../completions/pyenv.bash'"
} }
@test "detect parent shell" { @test "detect parent shell" {
@@ -35,7 +35,7 @@ load test_helper
root="$(cd $BATS_TEST_DIRNAME/.. && pwd)" root="$(cd $BATS_TEST_DIRNAME/.. && pwd)"
run pyenv-init - fish run pyenv-init - fish
assert_success assert_success
assert_line ". '${root}/libexec/../completions/pyenv.fish'" assert_line ". '${root}/test/../libexec/../completions/pyenv.fish'"
} }
@test "fish instructions" { @test "fish instructions" {
@@ -68,7 +68,7 @@ load test_helper
export PATH="${PYENV_ROOT}/shims:$PATH" export PATH="${PYENV_ROOT}/shims:$PATH"
run pyenv-init - bash run pyenv-init - bash
assert_success assert_success
refute_line 'export PATH="'${PYENV_ROOT}'/shims:${PATH}"' assert_line 0 'export PATH="'${PYENV_ROOT}'/shims:${PATH}"'
} }
@test "doesn't add shims to PATH more than once (fish)" { @test "doesn't add shims to PATH more than once (fish)" {
@@ -77,3 +77,20 @@ load test_helper
assert_success assert_success
refute_line 'setenv PATH "'${PYENV_ROOT}'/shims" $PATH ;' refute_line 'setenv PATH "'${PYENV_ROOT}'/shims" $PATH ;'
} }
@test "outputs sh-compatible syntax" {
run pyenv-init - bash
assert_success
assert_line ' case "$command" in'
run pyenv-init - zsh
assert_success
assert_line ' case "$command" in'
}
@test "outputs fish-specific syntax (fish)" {
run pyenv-init - fish
assert_success
assert_line ' switch "$command"'
refute_line ' case "$command" in'
}

View File

@@ -1,2 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
eval "echo \$$1" # Usage: pyenv echo [-F<char>] VAR
if [[ $1 == -F* ]]; then
sep="${1:2}"
echo "${!2}" | tr "${sep:-:}" $'\n'
else
echo "${!1}"
fi

View File

@@ -1,2 +0,0 @@
#!/usr/bin/env bash
grep -E "$@"

View File

@@ -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 20141127" ] assert [ "${lines[0]}" == "pyenv 20150124" ]
} }
@test "invalid command" { @test "invalid command" {
@@ -45,3 +45,31 @@ 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 "adds its own libexec to PATH" {
run pyenv echo "PATH"
assert_success "${BATS_TEST_DIRNAME%/*}/libexec:$PATH"
}
@test "adds plugin bin dirs to PATH" {
mkdir -p "$PYENV_ROOT"/plugins/python-build/bin
mkdir -p "$PYENV_ROOT"/plugins/pyenv-each/bin
run pyenv echo -F: "PATH"
assert_success
assert_line 0 "${BATS_TEST_DIRNAME%/*}/libexec"
assert_line 1 "${PYENV_ROOT}/plugins/python-build/bin"
assert_line 2 "${PYENV_ROOT}/plugins/pyenv-each/bin"
}
@test "PYENV_HOOK_PATH preserves value from environment" {
PYENV_HOOK_PATH=/my/hook/path:/other/hooks run pyenv echo -F: "PYENV_HOOK_PATH"
assert_success
assert_line 0 "/my/hook/path"
assert_line 1 "/other/hooks"
assert_line 2 "${PYENV_ROOT}/pyenv.d"
}
@test "PYENV_HOOK_PATH includes pyenv built-in plugins" {
run pyenv echo "PYENV_HOOK_PATH"
assert_success ":${PYENV_ROOT}/pyenv.d:${BATS_TEST_DIRNAME%/*}/pyenv.d:/usr/local/etc/pyenv.d:/etc/pyenv.d:/usr/lib/pyenv/hooks"
}

View File

@@ -1,11 +1,3 @@
#!/usr/bin/env bats #!/usr/bin/env bats
load test_helper 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"
}

9
test/run Executable file
View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e
if [ -n "$PYENV_NATIVE_EXT" ]; then
src/configure
make -C src
fi
exec bats ${CI:+--tap} test

View File

@@ -1,7 +1,15 @@
unset PYENV_VERSION unset PYENV_VERSION
unset PYENV_DIR unset PYENV_DIR
if enable -f "${BATS_TEST_DIRNAME}"/../libexec/pyenv-realpath.dylib realpath 2>/dev/null; then
PYENV_TEST_DIR="$(realpath "$BATS_TMPDIR")/pyenv"
else
if [ -n "$PYENV_NATIVE_EXT" ]; then
echo "pyenv: failed to load \`realpath' builtin" >&2
exit 1
fi
PYENV_TEST_DIR="${BATS_TMPDIR}/pyenv" PYENV_TEST_DIR="${BATS_TMPDIR}/pyenv"
fi
# guard against executing this block twice due to bats internals # guard against executing this block twice due to bats internals
if [ "$PYENV_ROOT" != "${PYENV_TEST_DIR}/root" ]; then if [ "$PYENV_ROOT" != "${PYENV_TEST_DIR}/root" ]; then