1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-08 11:33:49 -05:00

Compare commits

...

30 Commits

Author SHA1 Message Date
Yamashita Yuu
b520475b22 release 0.1.2 2012-10-23 15:24:41 +09:00
Yamashita Yuu
ffa2505450 add install script 2012-10-23 15:23:48 +09:00
Yamashita Yuu
d73e945329 "rbx-1.2.4" is a variant of rubies, not a python 2012-10-19 22:14:24 +09:00
Yamashita Yuu
779aacbf07 I am not Sam. 2012-10-19 22:12:31 +09:00
Yamashita Yuu
2ed400bfc6 use default CC to build CPython and Stackless. require_gcc was
imported from ruby-build and is for rubies, not for pythons.
2012-10-16 16:07:19 +09:00
Yamashita Yuu
e8ad78f837 add pyenv push and pyenv pop to manage version stack 2012-10-03 12:19:42 +09:00
Yamashita Yuu
aede700619 update README 2012-10-03 11:31:10 +09:00
Yamashita Yuu
ffa5fb0ea0 add CPython 3.3.0 release 2012-10-02 16:30:59 +09:00
Yamashita Yuu
42079cf3fb fix typo in README 2012-09-28 20:17:26 +09:00
Yamashita Yuu
d14eda2c1a ignore plugins other than python-build 2012-09-27 13:00:07 +09:00
Yamashita Yuu
579d44203f add 3.3.0rc2 and 3.3.0rc3 2012-09-27 12:50:42 +09:00
Yamashita, Yuu
a7695aa5d3 Merge pull request #1 from f440/master
Fix undiscovered function problem
2012-09-09 05:55:25 -07:00
FUSE Yoshio
f3ae8fd904 fix typo in function name 2012-09-09 21:45:44 +09:00
Yamashita Yuu
4174749b24 replace tr by shell's IFS 2012-09-07 20:10:10 +09:00
Yamashita Yuu
e89ae3a4a9 show all enabled versions (maybe multiple) in pyenv versions 2012-09-07 19:56:55 +09:00
Yamashita Yuu
13122ca9bf fixed to read multiple versions from PYENV_VERSION environment variable 2012-09-07 19:16:42 +09:00
Yamashita Yuu
34a4a532b2 0.1.2git 2012-09-03 19:40:49 +09:00
Yamashita Yuu
d08fcc522e release 0.1.1 2012-09-03 19:40:30 +09:00
Yamashita Yuu
f0ff5a416e added 3.3.0rc1 2012-09-03 19:36:04 +09:00
Yamashita Yuu
e66ca60340 updated screenshot 2012-08-31 21:05:18 +09:00
Yamashita Yuu
71e5cd962e updated README 2012-08-31 20:59:24 +09:00
Yamashita Yuu
da659739d2 fixed pyenv shell. we cannot carry out bash array via envvars. 2012-08-31 20:12:26 +09:00
Yamashita Yuu
dff57ae35d s/PYENV_VERSIONS/PYENV_VERSION/ for backward compatibility. 2012-08-31 19:39:29 +09:00
Yamashita Yuu
2856f81bb9 added more pythons 2012-08-31 19:11:29 +09:00
Yamashita Yuu
5224641f1a added CPython 2.5.6 2012-08-31 17:20:31 +09:00
Yamashita Yuu
a4c02082cb pypy installation doesn't require gcc 2012-08-31 17:18:47 +09:00
Yamashita Yuu
80c0dce7b2 Merge branch 'version-stack' 2012-08-31 16:50:57 +09:00
Yamashita Yuu
de25a84dc2 fixed build error on Mac OS X 2012-08-31 16:50:24 +09:00
Yamashita Yuu
8187bc84e3 search commands from python version stack.
users can use multiple python versions at once.
2012-08-31 16:09:46 +09:00
Yamashita Yuu
880ea61dd8 0.1.1git 2012-08-31 15:59:36 +09:00
48 changed files with 638 additions and 110 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,3 @@
#/plugins
/shims
/version
/versions

250
README.md
View File

@@ -4,15 +4,34 @@ pyenv lets you easily switch between multiple versions of Python. It's
simple, unobtrusive, and follows the UNIX tradition of single-purpose
tools that do one thing well.
This project was forked from [rbenv](https://github.com/sstephenson/rbenv) and.
[ruby-build](https://github.com/sstephenson/ruby-build) and modified for Python.
This project was forked from [rbenv](https://github.com/sstephenson/rbenv) and
[ruby-build](https://github.com/sstephenson/ruby-build), and modified for Python.
### pyenv _does…_
<img src="http://gyazo.com/9c829fafdf5e58880c820349c4e9197e.png?1346414267" width="849" height="454">
### pyenv _does..._
* Let you **change the global Python version** on a per-user basis.
* Provide support for **per-project Python versions**.
* Allow you to **override the Python version** with an environment
variable.
* Search commands from **multiple versions of Python at a time**.
This may be helpful to test across Python versions with [tox](http://pypi.python.org/pypi/tox).
### In contrast with pythonbrew and pythonz, pyenv _does not..._
* **Depending on Python itself.** pyenv was made from pure shell scripts.
There is no bootstrap problem of Python.
* **Need to be loaded into your shell.** Instead, pyenv's shim
approach works by adding a directory to your `$PATH`.
* **Have a configuration file.** There's nothing to configure except
which version of Python you want to use.
* **Manage virtualenv.** Of course, you can create [virtualenv](http://pypi.python.org/pypi/virtualenv)
yourself, or [python-virtualenv](https://github.com/yyuu/python-virtualenv)
to automate the process.
* **Prompt you with warnings when you switch to a project.** Instead
of executing arbitrary code, pyenv reads just the version name
from each project. There's nothing to "trust."
## Table of Contents
@@ -20,7 +39,16 @@ This project was forked from [rbenv](https://github.com/sstephenson/rbenv) and.
* [2 Installation](#section_2)
* [2.1 Basic GitHub Checkout](#section_2.1)
* [2.1.1 Upgrading](#section_2.1.1)
* [2.2 Neckbeard Configuration](#section_2.3)
* [3 Usage](#section_3)
* [3.1 pyenv global](#section_3.1)
* [3.2 pyenv local](#section_3.2)
* [3.3 pyenv shell](#section_3.3)
* [3.4 pyenv versions](#section_3.4)
* [3.5 pyenv version](#section_3.5)
* [3.6 pyenv rehash](#section_3.6)
* [3.7 pyenv which](#section_3.7)
* [3.8 pyenv whence](#section_3.8)
* [4 Development](#section_4)
* [4.1 Version History](#section_4.1)
* [4.2 License](#section_4.2)
@@ -103,13 +131,207 @@ tag:
$ git fetch
$ git tag
v0.1.0
v0.1.1
v0.1.2
v0.2.0
$ git checkout v0.2.0
$ git checkout v0.1.0
### <a name="section_2.2"></a> 2.2 Neckbeard Configuration
Skip this section unless you must know what every line in your shell
profile is doing.
`pyenv init` is the only command that crosses the line of loading
extra commands into your shell. Coming from rvm, some of you might be
opposed to this idea. Here's what `pyenv init` actually does:
1. Sets up your shims path. This is the only requirement for pyenv to
function properly. You can do this by hand by prepending
`~/.pyenv/shims` to your `$PATH`.
2. Installs autocompletion. This is entirely optional but pretty
useful. Sourcing `~/.pyenv/completions/pyenv.bash` will set that
up. There is also a `~/.pyenv/completions/pyenv.zsh` for Zsh
users.
3. Rehashes shims. From time to time you'll need to rebuild your
shim files. Doing this on init makes sure everything is up to
date. You can always run `pyenv rehash` manually.
4. Installs the sh dispatcher. This bit is also optional, but allows
pyenv and plugins to change variables in your current shell, making
commands like `pyenv shell` possible. The sh dispatcher doesn't do
anything crazy like override `cd` or hack your shell prompt, but if
for some reason you need `pyenv` to be a real script rather than a
shell function, you can safely skip it.
Run `pyenv init -` for yourself to see exactly what happens under the
hood.
## <a name="section_3"></a> 3 Usage
Like `git`, the `pyenv` command delegates to subcommands based on its
first argument. The most common subcommands are:
### <a name="section_3.1"></a> 3.1 pyenv global
Sets the global version of Python to be used in all shells by writing
the version name to the `~/.pyenv/version` file. This version can be
overridden by a per-project `.pyenv-version` file, or by setting the
`PYENV_VERSION` environment variable.
$ pyenv global 2.7.3
The special version name `system` tells pyenv to use the system Python
(detected by searching your `$PATH`).
When run without a version number, `pyenv global` reports the
currently configured global version.
And also, you can specify multiple versions as global Python. Commands
within these Python versions are searched by specified order.
$ pyenv global 2.7.3 3.2.3
$ pyenv global
2.7.3
3.2.3
$ pyenv which python2.7
/home/yyuu/.pyenv/versions/2.7.3/bin/python2.7
$ pyenv which python3.2
/home/yyuu/.pyenv/versions/3.2.3/bin/python3.2
$ pyenv which python
/home/yyuu/.pyenv/versions/2.7.3/bin/python
You can manage your version stack by `pyenv push` and `pyenv pop`.
$ pyenv global
2.7.3
3.2.3
$ pyenv push 3.3.0
$ pyenv global
2.7.3
3.2.3
3.3.0
$ pyenv pop
2.7.3
3.2.3
### <a name="section_3.2"></a> 3.2 pyenv local
Sets a local per-project Python version by writing the version name to
an `.pyenv-version` file in the current directory. This version
overrides the global, and can be overridden itself by setting the
`PYENV_VERSION` environment variable or with the `pyenv shell`
command.
$ pyenv local 2.7.3
When run without a version number, `pyenv local` reports the currently
configured local version. You can also unset the local version:
$ pyenv local --unset
And also, you can specify multiple versions as local Python. Commands
within these Python versions are searched by specified order.
$ pyenv local 2.7.3 3.2.3
$ pyenv local
2.7.3
3.2.3
$ pyenv which python2.7
/home/yyuu/.pyenv/versions/2.7.3/bin/python2.7
$ pyenv which python3.2
/home/yyuu/.pyenv/versions/3.2.3/bin/python3.2
$ pyenv which python
/home/yyuu/.pyenv/versions/2.7.3/bin/python
You can manage your version stack by `pyenv push` and `pyenv pop`.
$ pyenv local
2.7.3
3.2.3
$ pyenv push 3.3.0
$ pyenv local
2.7.3
3.2.3
3.3.0
$ pyenv pop
2.7.3
3.2.3
### <a name="section_3.3"></a> 3.3 pyenv shell
Sets a shell-specific Python version by setting the `PYENV_VERSION`
environment variable in your shell. This version overrides both
project-specific versions and the global version.
$ pyenv shell pypy-1.9
When run without a version number, `pyenv shell` reports the current
value of `PYENV_VERSION`. You can also unset the shell version:
$ pyenv shell --unset
Note that you'll need pyenv's shell integration enabled (step 3 of
the installation instructions) in order to use this command. If you
prefer not to use shell integration, you may simply set the
`PYENV_VERSION` variable yourself:
$ export PYENV_VERSION=pypy-1.9
And also, you can specify multiple versions via `PYENV_VERSION`
environment variable in your shell.
$ pyenv shell pypy-1.9 2.7.3
$ echo $PYENV_VERSION
pypy-1.9:2.7.3
$ pyenv version
pypy-1.9 (set by PYENV_VERSION environment variable)
2.7.3 (set by PYENV_VERSION environment variable)
### <a name="section_3.4"></a> 3.4 pyenv versions
Lists all Python versions known to pyenv, and shows an asterisk next to
the currently active version.
$ pyenv versions
2.5.6
2.6.8
* 2.7.3 (set by /home/yyuu/.pyenv/version)
3.2.3
jython-2.5.3
pypy-1.9
### <a name="section_3.5"></a> 3.5 pyenv version
Displays the currently active Python version, along with information on
how it was set.
$ pyenv version
2.7.3 (set by /home/yyuu/.pyenv/version)
### <a name="section_3.6"></a> 3.6 pyenv rehash
Installs shims for all Python binaries known to pyenv (i.e.,
`~/.pyenv/versions/*/bin/*`). Run this command after you install a new
version of Python, or install a gem that provides binaries.
$ pyenv rehash
### <a name="section_3.7"></a> 3.7 pyenv which
Displays the full path to the binary that pyenv will execute when you
run the given command.
$ pyenv which python3.2
/home/yyuu/.pyenv/versions/3.2.3/bin/python3.2
### <a name="section_3.8"></a> 3.8 pyenv whence
Lists all Python versions with the given command installed.
$ pyenv whence 2to3
2.6.8
2.7.3
3.2.3
## <a name="section_4"></a> 4 Development
The pyenv source code is [hosted on
@@ -121,6 +343,16 @@ tracker](https://github.com/yyuu/pyenv/issues).
### <a name="section_4.1"></a> 4.1 Version History
**0.1.2** (October 23, 2012)
* Add push/pop for version stack management.
* Support multiple versions via environment variable.
* Now GCC is not a requirement to build CPython and Stackless.
**0.1.1** (September 3, 2012)
* Support multiple versions of Python at a time.
**0.1.0** (August 31, 2012)
* Initial public release.
@@ -129,8 +361,8 @@ tracker](https://github.com/yyuu/pyenv/issues).
(The MIT license)
Copyright (c) 2011 Sam Stephenson
Copyright (c) 2012 Yamashita, Yuu
* Copyright (c) 2011 Sam Stephenson
* Copyright (c) 2012 Yamashita, Yuu
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@@ -60,7 +60,7 @@ shopt -u nullglob
command="$1"
case "$command" in
"" | "-h" | "--help" )
echo -e "pyenv 0.1.0\n$(pyenv-help)" >&2
echo -e "pyenv 0.1.2\n$(pyenv-help)" >&2
;;
* )
command_path="$(command -v "pyenv-$command" || true)"

View File

@@ -8,14 +8,19 @@ if [ "$1" = "--complete" ]; then
exec pyenv-versions --bare
fi
PYENV_VERSION="$1"
versions=($@)
PYENV_VERSION_FILE="${PYENV_ROOT}/version"
if [ -n "$PYENV_VERSION" ]; then
pyenv-version-file-write "$PYENV_VERSION_FILE" "$PYENV_VERSION"
if [ -n "$versions" ]; then
pyenv-version-file-write "$PYENV_VERSION_FILE" "${versions[@]}"
else
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
pyenv-version-file-read "${PYENV_ROOT}/global" ||
pyenv-version-file-read "${PYENV_ROOT}/default" ||
echo system
IFS=: versions=($(
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
pyenv-version-file-read "${PYENV_ROOT}/global" ||
pyenv-version-file-read "${PYENV_ROOT}/default" ||
echo system
))
for version in "${versions[@]}"; do
echo "$version"
done
fi

View File

@@ -9,16 +9,21 @@ if [ "$1" = "--complete" ]; then
exec pyenv-versions --bare
fi
PYENV_VERSION="$1"
versions=($@)
PYENV_VERSION_FILE=".pyenv-version"
if [ "$PYENV_VERSION" = "--unset" ]; then
if [ "$versions" = "--unset" ]; then
rm -f "$PYENV_VERSION_FILE"
elif [ -n "$PYENV_VERSION" ]; then
pyenv-version-file-write "$PYENV_VERSION_FILE" "$PYENV_VERSION"
elif [ -n "$versions" ]; then
pyenv-version-file-write "$PYENV_VERSION_FILE" "${versions[@]}"
else
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
{ echo "pyenv: no local version configured for this directory"
exit 1
} >&2
IFS=: versions=($(
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
{ echo "pyenv: no local version configured for this directory"
exit 1
} >&2
))
for version in "${versions[@]}"; do
echo "$version"
done
fi

View File

@@ -9,21 +9,28 @@ if [ "$1" = "--complete" ]; then
fi
if [ -n "$1" ]; then
export PYENV_VERSION="$1"
elif [ -z "$PYENV_VERSION" ]; then
PYENV_VERSION="$(pyenv-version-name)"
versions=($@)
IFS=: PYENV_VERSION="${versions[*]}"
export PYENV_VERSION
else
IFS=: versions=($(pyenv-version-name))
fi
if [ "$PYENV_VERSION" = "system" ]; then
if [ "$versions" = "system" ]; then
PYTHON_PATH="$(pyenv-which python)"
echo "${PYTHON_PATH%/*}"
exit
fi
PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}"
if [ ! -d "$PYENV_PREFIX_PATH" ]; then
echo "pyenv: version \`${PYENV_VERSION}' not installed" >&2
exit 1
fi
PYENV_PREFIX_PATHS=()
for version in "${versions[@]}"; do
PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${version}"
if [ -d "$PYENV_PREFIX_PATH" ]; then
PYENV_PREFIX_PATHS=("${PYENV_PREFIX_PATHS[@]}" "$PYENV_PREFIX_PATH")
else
echo "pyenv: version \`${version}' not installed" >&2
exit 1
fi
done
echo "$PYENV_PREFIX_PATH"
IFS=: echo "${PYENV_PREFIX_PATHS[*]}"

18
libexec/pyenv-sh-pop Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
IFS=: versions=($(pyenv-version-name))
length="${#versions[@]}"
PYENV_VERSION_NAMES=()
for ((i=0; i<length-1; i++)); do
PYENV_VERSION_NAMES=("${PYENV_VERSION_NAMES[@]}" "${versions[$i]}")
done
if [ -n "$PYENV_VERSION" ]; then
IFS=: PYENV_VERSION="${PYENV_VERSION_NAMES[*]}"
echo "export PYENV_VERSION=\"${PYENV_VERSION}\""
else
pyenv-version-file-write "$(pyenv-version-file)" "${PYENV_VERSION_NAMES[@]}"
fi

14
libexec/pyenv-sh-push Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name))
versions=("$@")
PYENV_VERSION_NAMES=("${PYENV_VERSION_NAMES[@]}" "${versions[@]}")
if [ -n "$PYENV_VERSION" ]; then
IFS=: PYENV_VERSION="${PYENV_VERSION_NAMES[*]}"
echo "export PYENV_VERSION=\"${PYENV_VERSION}\""
else
pyenv-version-file-write "$(pyenv-version-file)" "${PYENV_VERSION_NAMES[@]}"
fi

View File

@@ -9,9 +9,9 @@ if [ "$1" = "--complete" ]; then
exec pyenv-versions --bare
fi
version="$1"
versions=("$@")
if [ -z "$version" ]; then
if [ -z "$versions" ]; then
if [ -z "$PYENV_VERSION" ]; then
echo "pyenv: no shell-specific version configured" >&2
exit 1
@@ -21,12 +21,13 @@ if [ -z "$version" ]; then
fi
fi
if [ "$version" = "--unset" ]; then
if [ "$versions" = "--unset" ]; then
echo "unset PYENV_VERSION"
exit 1
fi
# Make sure the specified version is installed.
pyenv-prefix "$version" >/dev/null
pyenv-prefix "${versions[@]}" >/dev/null
echo "export PYENV_VERSION=\"${version}\""
IFS=: PYENV_VERSION="${versions[*]}"
echo "export PYENV_VERSION=\"${PYENV_VERSION}\""

View File

@@ -2,4 +2,8 @@
set -e
[ -n "$PYENV_DEBUG" ] && set -x
echo "$(pyenv-version-name) (set by $(pyenv-version-origin))"
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name))
for PYENV_VERSION_NAME in "${PYENV_VERSION_NAMES[@]}"; do
echo "$PYENV_VERSION_NAME (set by $(pyenv-version-origin))"
done

View File

@@ -7,16 +7,20 @@ VERSION_FILE="$1"
if [ -e "$VERSION_FILE" ]; then
# Read and print the first non-whitespace word from the specified
# version file.
version=""
versions=()
while read -a words; do
word="${words[0]}"
if [ -z "$version" ] && [ -n "$word" ]; then
version="$word"
if [ -n "$word" ]; then
length="${#versions[@]}"
versions=("${versions[@]}" "$word")
fi
done < <( cat "$VERSION_FILE" && echo )
if [ -n "$version" ]; then
echo "$version"
if [ -n "$versions" ]; then
{
IFS=:
echo "${versions[*]}"
}
exit
fi
fi

View File

@@ -3,15 +3,19 @@ set -e
[ -n "$PYENV_DEBUG" ] && set -x
PYENV_VERSION_FILE="$1"
PYENV_VERSION="$2"
shift
versions=("$@")
if [ -z "$PYENV_VERSION" ] || [ -z "$PYENV_VERSION_FILE" ]; then
echo "usage: pyenv write-version-file FILENAME VERSION" >&2
if [ -z "$versions" ] || [ -z "$PYENV_VERSION_FILE" ]; then
echo "usage: pyenv write-version-file FILENAME VERSIONS..." >&2
exit 1
fi
# Make sure the specified version is installed.
pyenv-prefix "$PYENV_VERSION" >/dev/null
pyenv-prefix "${vesions[@]}" >/dev/null
# Write the version out to disk.
echo "$PYENV_VERSION" > "$PYENV_VERSION_FILE"
rm -f "$PYENV_VERSION_FILE"
for version in "${versions[@]}"; do
echo "$version" >> "$PYENV_VERSION_FILE"
done

View File

@@ -2,21 +2,27 @@
set -e
[ -n "$PYENV_DEBUG" ] && set -x
if [ -z "$PYENV_VERSION" ]; then
if [ -n "$PYENV_VERSION" ]; then
IFS=: versions=($(echo "${PYENV_VERSION}"))
else
PYENV_VERSION_FILE="$(pyenv-version-file)"
PYENV_VERSION="$(pyenv-version-file-read "$PYENV_VERSION_FILE" || true)"
IFS=: versions=($(pyenv-version-file-read "$PYENV_VERSION_FILE" || true))
IFS=: PYENV_VERSION="${versions[*]}"
export PYENV_VERSION
fi
if [ -z "$PYENV_VERSION" ] || [ "$PYENV_VERSION" = "system" ]; then
if [ -z "$versions" ] || [ "$versions" = "system" ] ; then
echo "system"
exit
fi
PYENV_VERSION_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}"
for version in "${versions[@]}"; do
PYENV_VERSION_PATH="${PYENV_ROOT}/versions/${version}"
if [ ! -d "$PYENV_VERSION_PATH" ]; then
echo "pyenv: version \`$version' is not installed" >&2
exit 1
fi
done
if [ -d "$PYENV_VERSION_PATH" ]; then
echo "$PYENV_VERSION"
else
echo "pyenv: version \`$PYENV_VERSION' is not installed" >&2
exit 1
fi
echo "${PYENV_VERSION}"

View File

@@ -2,24 +2,33 @@
set -e
[ -n "$PYENV_DEBUG" ] && set -x
PYENV_VERSION_NAME="$(pyenv-version-name)"
array_exists() {
local x car="$1"
shift
for x in "$@"; do
[ "${x}" = "${car}" ] && return 0
done
return 1
}
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name))
if [ "$1" = "--bare" ]; then
hit_prefix=""
miss_prefix=""
print_version="$PYENV_VERSION_NAME"
version_origin=""
else
hit_prefix="* "
miss_prefix=" "
print_version="$(pyenv-version)"
version_origin=" (set by $(pyenv-version-origin))"
fi
for path in "${PYENV_ROOT}/versions/"*; do
if [ -d "$path" ]; then
version="${path##*/}"
if [ "$version" == "$PYENV_VERSION_NAME" ]; then
echo "${hit_prefix}${print_version}"
if array_exists "$version" "${PYENV_VERSION_NAMES[@]}"; then
echo "${hit_prefix}${version}${version_origin}"
else
echo "${miss_prefix}${version}"
fi

View File

@@ -40,7 +40,8 @@ remove_from_path() {
echo "${result%:}"
}
PYENV_VERSION="$(pyenv-version-name)"
IFS=: versions=($(pyenv-version-name))
IFS=: PYENV_VERSION="${versions[*]}"
PYENV_COMMAND="$1"
if [ -z "$PYENV_COMMAND" ]; then
@@ -48,12 +49,17 @@ if [ -z "$PYENV_COMMAND" ]; then
exit 1
fi
if [ "$PYENV_VERSION" = "system" ]; then
PATH="$(remove_from_path "${PYENV_ROOT}/shims")"
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND")"
else
PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}/bin/${PYENV_COMMAND}"
fi
for version in "${versions[@]}"; do
if [ "$version" = "system" ]; then
PATH="$(remove_from_path "${PYENV_ROOT}/shims")"
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND")"
else
PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${version}/bin/${PYENV_COMMAND}"
if [ -x "$PYENV_COMMAND_PATH" ]; then
break
fi
fi
done
for script in $(pyenv-hooks which); do
source "$script"
@@ -63,15 +69,5 @@ if [ -x "$PYENV_COMMAND_PATH" ]; then
echo "$PYENV_COMMAND_PATH"
else
echo "pyenv: $PYENV_COMMAND: command not found" >&2
versions="$(pyenv-whence "$PYENV_COMMAND" || true)"
if [ -n "$versions" ]; then
{ echo
echo "The \`$1' command exists in these Python versions:"
echo "$versions" | sed 's/^/ /g'
echo
} >&2
fi
exit 127
fi

3
plugins/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
/*
!/.gitignore
!/python-build

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
PYTHON_BUILD_VERSION="20120815"
PYTHON_BUILD_VERSION="20121023"
set -E
exec 3<&2 # preserve original stderr at fd 3
@@ -284,19 +284,6 @@ require_gcc() {
echo "${esc}[1mDETAILS${esc}[0m: Apple no longer includes the official GCC compiler with Xcode"
echo "as of version 4.2. Instead, the \`gcc\` executable is a symlink to"
echo "\`llvm-gcc\`, a modified version of GCC which outputs LLVM bytecode."
echo
echo "For most programs the \`llvm-gcc\` compiler works fine. However,"
echo "versions of Python older than 1.9.3-p125 are incompatible with"
echo "\`llvm-gcc\`. To build older versions of Python you must have the official"
echo "GCC compiler installed on your system."
echo
echo "${esc}[1mTO FIX THE PROBLEM${esc}[0m: Install the official GCC compiler using these"
echo "packages: ${esc}[4mhttps://github.com/kennethreitz/osx-gcc-installer/downloads${esc}[0m"
echo
echo "You will need to install the official GCC compiler to build older"
echo "versions of Python even if you have installed Apple's Command Line Tools"
echo "for Xcode package. The Command Line Tools for Xcode package only"
echo "includes \`llvm-gcc\`."
fi
} >&3
return 1
@@ -346,10 +333,6 @@ verify_gcc() {
return 1
fi
if echo "$version" | grep LLVM >/dev/null; then
return 1
fi
echo "$gcc"
}

23
plugins/python-build/install.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/sh
set -e
if [ -z "${PREFIX}" ]; then
PREFIX="/usr/local"
fi
BIN_PATH="${PREFIX}/bin"
SHARE_PATH="${PREFIX}/share/python-build"
mkdir -p "${BIN_PATH}"
mkdir -p "${SHARE_PATH}"
for file in bin/*; do
cp "${file}" "${BIN_PATH}"
done
for file in share/python-build/*; do
cp "${file}" "${SHARE_PATH}"
done
echo "Installed python-build at ${PREFIX}"

View File

@@ -0,0 +1,13 @@
case "$OSTYPE" in
linux*)
case $(uname -m) in
x86_64)
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu" # to fix build on Debian amd64
;;
esac
;;
esac
install_package "Python-2.5" "http://www.python.org/ftp/python/2.5/Python-2.5.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
case "$OSTYPE" in
linux*)
case $(uname -m) in
x86_64)
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu" # to fix build on Debian amd64
;;
esac
;;
esac
install_package "Python-2.5.1" "http://www.python.org/ftp/python/2.5.1/Python-2.5.1.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
case "$OSTYPE" in
linux*)
case $(uname -m) in
x86_64)
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu" # to fix build on Debian amd64
;;
esac
;;
esac
install_package "Python-2.5.2" "http://www.python.org/ftp/python/2.5.2/Python-2.5.2.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
case "$OSTYPE" in
linux*)
case $(uname -m) in
x86_64)
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu" # to fix build on Debian amd64
;;
esac
;;
esac
install_package "Python-2.5.3" "http://www.python.org/ftp/python/2.5.3/Python-2.5.3.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
case "$OSTYPE" in
linux*)
case $(uname -m) in
x86_64)
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu" # to fix build on Debian amd64
;;
esac
;;
esac
install_package "Python-2.5.4" "http://www.python.org/ftp/python/2.5.4/Python-2.5.4.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
case "$OSTYPE" in
linux*)
case $(uname -m) in
x86_64)
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu" # to fix build on Debian amd64
;;
esac
;;
esac
install_package "Python-2.5.5" "http://www.python.org/ftp/python/2.5.5/Python-2.5.5.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
case "$OSTYPE" in
linux*)
case $(uname -m) in
x86_64)
export LDFLAGS="-L/usr/lib/x86_64-linux-gnu" # to fix build on Debian amd64
;;
esac
;;
esac
install_package "Python-2.5.6" "http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
fetch_url "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" > setup.patch
patch -p0 < setup.patch
;;
esac
}
install_package "Python-2.6.6" "http://www.python.org/ftp/python/2.6.6/Python-2.6.6.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
fetch_url "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" > setup.patch
patch -p0 < setup.patch
;;
esac
}
install_package "Python-2.6.7" "http://www.python.org/ftp/python/2.6.7/Python-2.6.7.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -8,7 +8,6 @@ before_install_package() {
esac
}
require_gcc
install_package "Python-2.6.8" "http://www.python.org/ftp/python/2.6.8/Python-2.6.8.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
fetch_url "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" > setup.patch
patch -p0 < setup.patch
;;
esac
}
install_package "Python-2.7" "http://www.python.org/ftp/python/2.7/Python-2.7.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
fetch_url "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" > setup.patch
patch -p0 < setup.patch
;;
esac
}
install_package "Python-2.7.1" "http://www.python.org/ftp/python/2.7.1/Python-2.7.1.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,3 @@
install_package "Python-2.7.2" "http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -1,4 +1,3 @@
require_gcc
install_package "Python-2.7.3" "http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -8,7 +8,6 @@ before_install_package() {
esac
}
require_gcc
install_package "Python-3.0.1" "http://www.python.org/ftp/python/3.0.1/Python-3.0.1.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
fetch_url "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" > setup.patch
patch -p0 < setup.patch
;;
esac
}
install_package "Python-3.1.3" "http://www.python.org/ftp/python/3.1.3/Python-3.1.3.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,3 @@
install_package "Python-3.1.4" "http://www.python.org/ftp/python/3.1.4/Python-3.1.4.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -1,4 +1,3 @@
require_gcc
install_package "Python-3.1.5" "http://www.python.org/ftp/python/3.1.5/Python-3.1.5.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
fetch_url "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/python32/patch-setup.py.diff" > setup.patch
patch -p0 < setup.patch
;;
esac
}
install_package "Python-3.2" "http://www.python.org/ftp/python/3.2/Python-3.2.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,3 @@
install_package "Python-3.2.1" "http://www.python.org/ftp/python/3.2.1/Python-3.2.1.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,3 @@
install_package "Python-3.2.2" "http://www.python.org/ftp/python/3.2.2/Python-3.2.2.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -1,4 +1,3 @@
require_gcc
install_package "Python-3.2.3" "http://www.python.org/ftp/python/3.2.3/Python-3.2.3.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,3 @@
install_package "Python-3.3.0" "http://python.org/ftp/python/3.3.0/Python-3.3.0.tgz"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,4 @@
require_java
install_jar "Jython-2.5.0" "https://downloads.sourceforge.net/project/jython/jython/2.5.0/jython_installer-2.5.0.jar" jython
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,4 @@
require_java
install_jar "Jython-2.5.1" "https://downloads.sourceforge.net/project/jython/jython/2.5.1/jython_installer-2.5.1.jar" jython
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,4 @@
require_java
install_jar "Jython-2.5.3" "http://search.maven.org/remotecontent?filepath=org/python/jython-installer/2.5.3/jython-installer-2.5.3.jar" jython
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -0,0 +1,24 @@
case "$OSTYPE" in
darwin*)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-osx64.tar.bz2"
;;
linux*)
case $(uname -m) in
i386|i486|i586|i686)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux.tar.bz2"
;;
x86_64)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2"
;;
esac
;;
cygwin*|mingw*)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-win32.zip"
;;
esac
if [ -n "$PYPY_URL" ]; then
install_package "pypy-1.8" "$PYPY_URL" pypy
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python
fi

View File

@@ -1,5 +1,3 @@
require_gcc
case "$OSTYPE" in
darwin*)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-osx64.tar.bz2"

View File

@@ -0,0 +1,3 @@
install_package "stackless-272-export" "http://www.stackless.com/binaries/stackless-272-export.tar.bz2"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -1,4 +1,3 @@
require_gcc
install_package "stackless-322-export" "http://www.stackless.com/binaries/stackless-322-export.tar.bz2"
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python