mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-13 13:53:53 -05:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d320d74a07 | ||
|
|
fc49f7e21e | ||
|
|
be4f5992d6 | ||
|
|
25a48694be | ||
|
|
9b7b2a6b40 | ||
|
|
f59729359a | ||
|
|
93ac0632c7 | ||
|
|
7a21cf9c10 | ||
|
|
720dee76af | ||
|
|
db6a41c90f | ||
|
|
bfddc69120 | ||
|
|
acce3744e7 | ||
|
|
5ca423c9f3 | ||
|
|
f0e852553a | ||
|
|
fc8597ca38 | ||
|
|
e7a68ad467 | ||
|
|
0fd1eaaeb5 | ||
|
|
b986f8f93f | ||
|
|
60e1abe7fa | ||
|
|
afcf4f0c7c | ||
|
|
c0aff27842 | ||
|
|
e172eb2818 | ||
|
|
8761ae8f7c | ||
|
|
3d401ebcd2 | ||
|
|
268f965421 | ||
|
|
ff0f8a140b | ||
|
|
6c2d234e55 | ||
|
|
c6dd3b9468 | ||
|
|
8fee82e456 |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,6 +1,9 @@
|
|||||||
/build
|
|
||||||
/cache
|
|
||||||
/shims
|
/shims
|
||||||
/version
|
/version
|
||||||
/versions
|
/versions
|
||||||
/sources
|
/sources
|
||||||
|
/cache
|
||||||
|
/libexec/*.dylib
|
||||||
|
/src/Makefile
|
||||||
|
/src/*.o
|
||||||
|
bats/
|
||||||
|
|||||||
10
.travis.yml
10
.travis.yml
@@ -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
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
|
#### 20141127
|
||||||
|
|
||||||
|
* python-build: Add new CPython release candidates; 2.7.9rc1 (#276)
|
||||||
|
|
||||||
|
#### 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)
|
||||||
|
|||||||
14
Makefile
14
Makefile
@@ -1,8 +1,8 @@
|
|||||||
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
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
version="20141106"
|
version="20141211"
|
||||||
|
|
||||||
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)"
|
||||||
|
|||||||
@@ -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)"
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
|
||||||
fish )
|
|
||||||
echo "setenv PATH '${PYENV_ROOT}/shims' \$PATH"
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
echo 'export PATH="'${PYENV_ROOT}'/shims:${PATH}"'
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
|
echo "setenv PATH '${PYENV_ROOT}/shims' \$PATH"
|
||||||
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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
@@ -191,11 +191,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
|
||||||
|
|||||||
@@ -144,6 +144,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 +362,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"
|
||||||
@@ -834,21 +851,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 +889,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
|
||||||
@@ -911,15 +935,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"
|
||||||
@@ -1099,6 +1120,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
|
||||||
@@ -1421,6 +1457,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}"
|
||||||
@@ -1734,11 +1775,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]}"
|
||||||
;;
|
;;
|
||||||
|
|||||||
3
plugins/python-build/share/python-build/2.7.9
Normal file
3
plugins/python-build/share/python-build/2.7.9
Normal 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
|
||||||
@@ -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
|
||||||
|
|||||||
3
plugins/python-build/share/python-build/3.5-dev
Normal file
3
plugins/python-build/share/python-build/3.5-dev
Normal 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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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" )
|
||||||
|
|||||||
35
plugins/python-build/share/python-build/pypy-c-jit-latest
Normal file
35
plugins/python-build/share/python-build/pypy-c-jit-latest
Normal 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
|
||||||
35
plugins/python-build/share/python-build/pypy-c-nojit-latest
Normal file
35
plugins/python-build/share/python-build/pypy-c-nojit-latest
Normal 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
|
||||||
@@ -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
|
||||||
|
|||||||
38
plugins/python-build/share/python-build/pypy3-2.4.0
Normal file
38
plugins/python-build/share/python-build/pypy3-2.4.0
Normal 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
|
||||||
2
plugins/python-build/share/python-build/pypy3-2.4.0-src
Normal file
2
plugins/python-build/share/python-build/pypy3-2.4.0-src
Normal 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
|
||||||
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
pyenv.d/exec/pip-rehash.bash
Normal file
5
pyenv.d/exec/pip-rehash.bash
Normal 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
|
||||||
27
pyenv.d/exec/pip-rehash/easy_install
Executable file
27
pyenv.d/exec/pip-rehash/easy_install
Executable 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
29
pyenv.d/exec/pip-rehash/pip
Executable 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"
|
||||||
20
script/test
20
script/test
@@ -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
25
src/Makefile.in
Normal 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
31
src/bash.h
Normal 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
46
src/configure
vendored
Executable 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
43
src/realpath.c
Normal 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
558
src/shobj-conf
Executable 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
|
||||||
@@ -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'
|
||||||
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
grep -E "$@"
|
|
||||||
@@ -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 20141211" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "invalid command" {
|
@test "invalid command" {
|
||||||
@@ -46,10 +46,30 @@ load test_helper
|
|||||||
assert_output "pyenv: cannot change working directory to \`$dir'"
|
assert_output "pyenv: cannot change working directory to \`$dir'"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "conflicting GREP_OPTIONS" {
|
@test "adds its own libexec to PATH" {
|
||||||
file="${BATS_TMPDIR}/hello"
|
run pyenv echo "PATH"
|
||||||
echo "hello" > "$file"
|
assert_success "${BATS_TEST_DIRNAME%/*}/libexec:$PATH"
|
||||||
GREP_OPTIONS="-F" run pyenv grep "hell." "$file"
|
}
|
||||||
assert_success
|
|
||||||
assert_output "hello"
|
@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"
|
||||||
}
|
}
|
||||||
|
|||||||
3
test/pyenv_ext.bats
Normal file
3
test/pyenv_ext.bats
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bats
|
||||||
|
|
||||||
|
load test_helper
|
||||||
9
test/run
Executable file
9
test/run
Executable 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
|
||||||
@@ -1,7 +1,15 @@
|
|||||||
unset PYENV_VERSION
|
unset PYENV_VERSION
|
||||||
unset PYENV_DIR
|
unset PYENV_DIR
|
||||||
|
|
||||||
PYENV_TEST_DIR="${BATS_TMPDIR}/pyenv"
|
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"
|
||||||
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user