1
0
mirror of https://github.com/pyenv/pyenv.git synced 2025-11-09 12:03:49 -05:00

Compare commits

...

51 Commits

Author SHA1 Message Date
Yamashita Yuu
dbb1fb5a06 release 0.2.0 2013-02-18 12:39:35 +09:00
Yamashita Yuu
755c00e67c fix broken installation scripts for Jython and some of CPython.
replaced deprecated method calls of `fetch_url` by `http get`.
2013-02-07 17:48:23 +09:00
Yamashita Yuu
ad900ba436 fix some differences between ruby-build (refs #8) 2013-02-07 17:32:10 +09:00
Yamashita Yuu
ea7dc5f1e1 fix inverted result of checking version existence (refs #7) 2013-02-07 16:50:20 +09:00
Yamashita Yuu
be53bb8951 update README 2013-02-06 22:08:16 +09:00
Yamashita Yuu
167ff2a198 s/Ruby/Python/g; s/RBENV/PYENV/g 2013-02-06 16:05:29 +09:00
Yamashita Yuu
ee3c9bef5e fix typo; s/vesions/versions/
also this will fix https://github.com/yyuu/python-virtualenv/issues/1
2013-02-01 12:46:57 +09:00
Yamashita Yuu
6d307c6e11 import recent changes from ruby-build:
* verify checksum of downloaded archives.
* add PYTHON_BUILD_MIRROR_URL to use mirror site.
  But we don't have CloudFront setup as of now :-(
* rbenv 0.4.x style help messages
2013-01-31 13:27:39 +09:00
Yamashita Yuu
a0705cb86e fix shell syntax error. add missing `then'. 2013-01-28 12:53:18 +09:00
Yamashita Yuu
fca31c4307 import trivial changes from rbenv 0.4.0 2013-01-18 19:10:35 +09:00
Yamashita Yuu
684f7b7f21 add support for .python-version file to store local python version 2013-01-18 19:10:30 +09:00
Yamashita Yuu
da06998457 import rbenv-help from rbenv 0.4.0 2013-01-18 19:09:56 +09:00
Yamashita Yuu
f466679bd1 import pyenv---version from rbenv 2013-01-17 23:17:41 +09:00
Yamashita Yuu
4a217a0cd1 update distribute to 0.6.34 2013-01-11 13:41:40 +09:00
Yamashita Yuu
5b14236bac fix "system" handling 2012-12-19 23:58:39 +09:00
Yamashita Yuu
a16355fe33 fix wrong link to the README in the help message 2012-12-14 18:45:28 +09:00
Yamashita Yuu
c9575d7cb0 update distribute and pip versions
* distribute (0.6.28 -> 0.6.32)
* pip (1.1 -> 1.2.1)
2012-12-11 12:19:56 +09:00
Yamashita Yuu
252003f18e add pypy-2.0-beta1 2012-12-11 12:13:18 +09:00
Yamashita Yuu
7509b9fadf update feature list in README 2012-11-06 13:17:04 +09:00
Yamashita Yuu
f878896a77 ignore non files 2012-10-23 17:55:55 +09:00
Yamashita Yuu
d09af20897 0.1.3git 2012-10-23 15:25:18 +09:00
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
69 changed files with 1564 additions and 379 deletions

1
.gitignore vendored
View File

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

402
README.md
View File

@@ -4,50 +4,140 @@ pyenv lets you easily switch between multiple versions of Python. It's
simple, unobtrusive, and follows the UNIX tradition of single-purpose simple, unobtrusive, and follows the UNIX tradition of single-purpose
tools that do one thing well. tools that do one thing well.
This project was forked from [rbenv](https://github.com/sstephenson/rbenv) and. This project was forked from [rbenv](https://github.com/sstephenson/rbenv) and
[ruby-build](https://github.com/sstephenson/ruby-build) and modified for Python. [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. * Let you **change the global Python version** on a per-user basis.
* Provide support for **per-project Python versions**. * Provide support for **per-project Python versions**.
* Allow you to **override the Python version** with an environment * Allow you to **override the Python version** with an environment
variable. 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`.
* **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.
## Table of Contents ## Table of Contents
* [1 How It Works](#section_1) * [How It Works](#how-it-works)
* [2 Installation](#section_2) * [Understanding PATH](#understanding-path)
* [2.1 Basic GitHub Checkout](#section_2.1) * [Understanding Shims](#understanding-shims)
* [2.1.1 Upgrading](#section_2.1.1) * [Choosing the Python Version](#choosing-the-python-version)
* [3 Usage](#section_3) * [Locating the Python Installation](#locating-the-python-installation)
* [4 Development](#section_4) * [Installation](#installation)
* [4.1 Version History](#section_4.1) * [Basic GitHub Checkout](#basic-github-checkout)
* [4.2 License](#section_4.2) * [Upgrading](#upgrading)
* [Neckbeard Configuration](#neckbeard-configuration)
* [Uninstalling Python Versions](#uninstalling-python-versions)
* [Command Reference](#command-reference)
* [pyenv local](#pyenv-local)
* [pyenv global](#pyenv-global)
* [pyenv shell](#pyenv-shell)
* [pyenv versions](#pyenv-versions)
* [pyenv version](#pyenv-version)
* [pyenv rehash](#pyenv-rehash)
* [pyenv which](#pyenv-which)
* [pyenv whence](#pyenv-whence)
* [Development](#development)
* [Version History](#version-history)
* [License](#license)
## <a name="section_1"></a> 1 How It Works ## How It Works
pyenv operates on the per-user directory `~/.pyenv`. Version names in At a high level, pyenv intercepts Python commands using shim
pyenv correspond to subdirectories of `~/.pyenv/versions`. For executables injected into your `PATH`, determines which Python version
example, you might have `~/.pyenv/versions/2.7.3` and has been specified by your application, and passes your commands along
`~/.pyenv/versions/2.7.3`. to the correct Python installation.
Each version is a working tree with its own binaries, like ### Understanding PATH
`~/.pyenv/versions/2.7.3/bin/python2.7` and
`~/.pyenv/versions/3.2.3/bin/python3.2`. pyenv makes _shim binaries_
for every such binary across all installed versions of Python.
These shims are simple wrapper scripts that live in `~/.pyenv/shims` When you run a command like `python` or `pip`, your operating system
and detect which Python version you want to use. They insert the searches through a list of directories to find an executable file with
directory for the selected version at the beginning of your `$PATH` that name. This list of directories lives in an environment variable
and then execute the corresponding binary. called `PATH`, with each directory in the list separated by a colon:
Because of the simplicity of the shim approach, all you need to use /usr/local/bin:/usr/bin:/bin
pyenv is `~/.pyenv/shims` in your `$PATH`.
## <a name="section_2"></a> 2 Installation Directories in `PATH` are searched from left to right, so a matching
executable in a directory at the beginning of the list takes
precedence over another one at the end. In this example, the
`/usr/local/bin` directory will be searched first, then `/usr/bin`,
then `/bin`.
### <a name="section_2.1"></a> 2.1 Basic GitHub Checkout ### Understanding Shims
pyenv works by inserting a directory of _shims_ at the front of your
`PATH`:
~/.pyenv/shims:/usr/local/bin:/usr/bin:/bin
Through a process called _rehashing_, pyenv maintains shims in that
directory to match every Python command across every installed version
of Python—`python`, `pip`, and so on.
Shims are lightweight executables that simply pass your command along
to pyenv. So with pyenv installed, when you run, say, `pip`, your
operating system will do the following:
* Search your `PATH` for an executable file named `pip`
* Find the pyenv shim named `pip` at the beginning of your `PATH`
* Run the shim named `pip`, which in turn passes the command along to
pyenv
### Choosing the Python Version
When you execute a shim, pyenv determines which Python version to use by
reading it from the following sources, in this order:
1. The `PYENV_VERSION` environment variable, if specified. You can use
the [`pyenv shell`](#pyenv-shell) command to set this environment
variable in your current shell session.
2. The application-specific `.python-version` file in the current
directory, if present. You can modify the current directory's
`.python-version` file with the [`pyenv local`](#pyenv-local)
command.
3. The first `.python-version` file found by searching each parent
directory until reaching the root of your filesystem, if any.
4. The global `~/.pyenv/version` file. You can modify this file using
the [`pyenv global`](#pyenv-global) command. If the global version
file is not present, pyenv assumes you want to use the "system"
Python—i.e. whatever version would be run if pyenv weren't in your
path.
### Locating the Python Installation
Once pyenv has determined which version of Python your application has
specified, it passes the command along to the corresponding Python
installation.
Each Python version is installed into its own directory under
`~/.pyenv/versions`. For example, you might have these versions
installed:
* `~/.pyenv/versions/2.7.3/`
* `~/.pyenv/versions/3.3.0/`
* `~/.pyenv/versions/pypy-1.9/`
Version names to pyenv are simply the names of the directories in
`~/.pyenv/versions`.
## Installation
### Basic GitHub Checkout
This will get you going with the latest version of pyenv and make it This will get you going with the latest version of pyenv and make it
easy to fork and contribute any changes back upstream. easy to fork and contribute any changes back upstream.
@@ -82,11 +172,11 @@ easy to fork and contribute any changes back upstream.
6. Rebuild the shim binaries. You should do this any time you install 6. Rebuild the shim binaries. You should do this any time you install
a new Python binary (for example, when installing a new Python version, a new Python binary (for example, when installing a new Python version,
or when installing a gem that provides a binary). or when installing a package that provides a binary).
$ pyenv rehash $ pyenv rehash
#### <a name="section_2.1.1"></a> 2.1.1 Upgrading #### Upgrading
If you've installed pyenv using the instructions above, you can If you've installed pyenv using the instructions above, you can
upgrade your installation at any time using git. upgrade your installation at any time using git.
@@ -103,14 +193,232 @@ tag:
$ git fetch $ git fetch
$ git tag $ git tag
v0.1.0 v0.1.0
v0.1.1 $ git checkout v0.1.0
v0.1.2
v0.2.0
$ git checkout v0.2.0
## <a name="section_3"></a> 3 Usage ### Neckbeard Configuration
## <a name="section_4"></a> 4 Development 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.
### Uninstalling Python Versions
As time goes on, Python versions you install will accumulate in your
`~/.pyenv/versions` directory.
To remove old Python versions, `pyenv uninstall` command to automate
the removal process.
Or, simply `rm -rf` the directory of the
version you want to remove. You can find the directory of a particular
Python version with the `pyenv prefix` command, e.g. `pyenv prefix
2.6.8`.
## Command Reference
Like `git`, the `pyenv` command delegates to subcommands based on its
first argument. The most common subcommands are:
### pyenv local
Sets a local application-specific Python version by writing the version
name to a `.python-version` file in the current directory. This version
overrides the global version, 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
Previous versions of pyenv stored local version specifications in a
file named `.pyenv-version`. For backwards compatibility, pyenv will
read a local version specified in an `.pyenv-version` file, but a
`.python-version` file in the same directory will take precedence.
**pyenv feature**
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
### 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 an application-specific `.python-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.
**pyenv feature**
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
### pyenv shell
Sets a shell-specific Python version by setting the `PYENV_VERSION`
environment variable in your shell. This version overrides
application-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
**pyenv feature**
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)
### 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
### 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)
### 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 package that provides binaries.
$ pyenv rehash
### pyenv which
Displays the full path to the executable that pyenv will invoke when
you run the given command.
$ pyenv which python3.2
/home/yyuu/.pyenv/versions/3.2.3/bin/python3.2
### pyenv whence
Lists all Python versions with the given command installed.
$ pyenv whence 2to3
2.6.8
2.7.3
3.2.3
## Development
The pyenv source code is [hosted on The pyenv source code is [hosted on
GitHub](https://github.com/yyuu/pyenv). It's clean, modular, GitHub](https://github.com/yyuu/pyenv). It's clean, modular,
@@ -119,18 +427,32 @@ and easy to understand, even if you're not a shell hacker.
Please feel free to submit pull requests and file bugs on the [issue Please feel free to submit pull requests and file bugs on the [issue
tracker](https://github.com/yyuu/pyenv/issues). tracker](https://github.com/yyuu/pyenv/issues).
### <a name="section_4.1"></a> 4.1 Version History ### Version History
**0.2.0** (February 18, 2013)
* Import changes from rbenv 0.4.0.
**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) **0.1.0** (August 31, 2012)
* Initial public release. * Initial public release.
### <a name="section_4.2"></a> 4.2 License ### License
(The MIT license) (The MIT license)
Copyright (c) 2011 Sam Stephenson * Copyright (c) 2011 Sam Stephenson
Copyright (c) 2012 Yamashita, Yuu * Copyright (c) 2012 Yamashita, Yuu
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View File

@@ -13,4 +13,11 @@
set -e set -e
export PYENV_DIR="${1%/*}" export PYENV_DIR="${1%/*}"
[ -n "$PYENV_SILENCE_WARNINGS" ] || {
echo "pyenv: \`python-local-exec' is deprecated and will be removed in the next release."
echo " To upgrade: https://github.com/yyuu/pyenv/wiki/python-local-exec"
echo
} >&2
exec python "$@" exec python "$@"

View File

@@ -5,8 +5,10 @@ _pyenv() {
if [ "$COMP_CWORD" -eq 1 ]; then if [ "$COMP_CWORD" -eq 1 ]; then
COMPREPLY=( $(compgen -W "$(pyenv commands)" -- "$word") ) COMPREPLY=( $(compgen -W "$(pyenv commands)" -- "$word") )
else else
local command="${COMP_WORDS[1]}" local words=("${COMP_WORDS[@]}")
local completions="$(pyenv completions "$command")" unset words[0]
unset words[$COMP_CWORD]
local completions=$(pyenv completions "${words[@]}")
COMPREPLY=( $(compgen -W "$completions" -- "$word") ) COMPREPLY=( $(compgen -W "$completions" -- "$word") )
fi fi
} }

View File

@@ -5,14 +5,13 @@ fi
compctl -K _pyenv pyenv compctl -K _pyenv pyenv
_pyenv() { _pyenv() {
local word words completions local words completions
read -cA words read -cA words
word="${words[2]}"
if [ "${#words}" -eq 2 ]; then if [ "${#words}" -eq 2 ]; then
completions="$(pyenv commands)" completions="$(pyenv commands)"
else else
completions="$(pyenv completions "${word}")" completions="$(pyenv completions "${words[2,-1]}")"
fi fi
reply=("${(ps:\n:)completions}") reply=("${(ps:\n:)completions}")

View File

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

21
libexec/pyenv---version Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Summary: Display the version of pyenv
#
# Displays the version number of this pyenv release, including the
# current revision from git, if available.
#
# The format of the git revision is:
# <version>-<num_commits>-<git_sha>
# where `num_commits` is the number of commits since `version` was
# tagged.
set -e
[ -n "$PYENV_DEBUG" ] && set -x
version="0.2.0"
cd "$PYENV_ROOT"
git_revision="$(git describe --tags HEAD 2>/dev/null || true)"
git_revision="${git_revision#v}"
echo "pyenv ${git_revision:-$version}"

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: List all available pyenv commands
# Usage: pyenv commands [--sh|--no-sh]
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x

View File

@@ -1,10 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Usage: pyenv completions <command> [arg1 arg2...]
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
COMMAND="$1" COMMAND="$1"
if [ -z "$COMMAND" ]; then if [ -z "$COMMAND" ]; then
echo "usage: pyenv completions COMMAND [arg1 arg2...]" >&2 pyenv-help --usage completions >&2
exit 1 exit 1
fi fi

View File

@@ -1,4 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Summary: Run an executable with the selected Python version
#
# Usage: pyenv exec <command> [arg1 arg2...]
#
# Runs an executable by first preparing PATH so that the selected Python
# version's `bin' directory is at the front.
#
# For example, if the currently selected Python version is 2.7.7:
# pyenv exec pip install -rrequirements.txt
#
# is equivalent to:
# PATH="$PYENV_ROOT/versions/2.7.7/bin:$PATH" pip install -rrequirements.txt
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -7,9 +21,11 @@ if [ "$1" = "--complete" ]; then
exec pyenv shims --short exec pyenv shims --short
fi fi
export PYENV_VERSION="$(pyenv-version-name)"
PYENV_COMMAND="$1" PYENV_COMMAND="$1"
if [ -z "$PYENV_COMMAND" ]; then if [ -z "$PYENV_COMMAND" ]; then
echo "usage: pyenv exec COMMAND [arg1 arg2...]" >&2 pyenv-help --usage exec >&2
exit 1 exit 1
fi fi
@@ -21,5 +37,7 @@ for script in $(pyenv-hooks exec); do
done done
shift 1 shift 1
export PATH="${PYENV_BIN_PATH}:${PATH}" if [ "$PYENV_VERSION" != "system" ]; then
export PATH="${PYENV_BIN_PATH}:${PATH}"
fi
exec -a "$PYENV_COMMAND" "$PYENV_COMMAND_PATH" "$@" exec -a "$PYENV_COMMAND" "$PYENV_COMMAND_PATH" "$@"

View File

@@ -1,4 +1,17 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Summary: Set or show the global Python version
#
# Usage: pyenv global <version>
#
# Sets the global Python version. You can override the global version at
# any time by setting a directory-specific version with `pyenv local'
# or by setting the `PYENV_VERSION' environment variable.
#
# <version> should be a string matching a Python version known to pyenv.
# The special version string `system' will use your default system Python.
# Run `pyenv versions' for a list of available Python versions.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -8,14 +21,19 @@ if [ "$1" = "--complete" ]; then
exec pyenv-versions --bare exec pyenv-versions --bare
fi fi
PYENV_VERSION="$1" versions=($@)
PYENV_VERSION_FILE="${PYENV_ROOT}/version" PYENV_VERSION_FILE="${PYENV_ROOT}/version"
if [ -n "$PYENV_VERSION" ]; then if [ -n "$versions" ]; then
pyenv-version-file-write "$PYENV_VERSION_FILE" "$PYENV_VERSION" pyenv-version-file-write "$PYENV_VERSION_FILE" "${versions[@]}"
else else
IFS=: versions=($(
pyenv-version-file-read "$PYENV_VERSION_FILE" || pyenv-version-file-read "$PYENV_VERSION_FILE" ||
pyenv-version-file-read "${PYENV_ROOT}/global" || pyenv-version-file-read "${PYENV_ROOT}/global" ||
pyenv-version-file-read "${PYENV_ROOT}/default" || pyenv-version-file-read "${PYENV_ROOT}/default" ||
echo system echo system
))
for version in "${versions[@]}"; do
echo "$version"
done
fi fi

View File

@@ -1,99 +1,162 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Summary: Display help for a command
#
# Usage: pyenv help [--usage] COMMAND
#
# Parses and displays help contents from a command's source file.
#
# A command is considered documented if it starts with a comment block
# that has a `Summary:' or `Usage:' section. Usage instructions can
# span multiple lines as long as subsequent lines are indented.
# The remainder of the comment block is displayed as extended
# documentation.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
print_set_version() { command_path() {
echo "<version> should be a string matching a Python version known by pyenv." local command="$1"
command -v pyenv-"$command" || command -v pyenv-sh-"$command" || true
local versions="$(pyenv-versions --bare)"
if [ -z "$versions" ]; then
echo "There are currently no Python versions installed for pyenv."
else
echo "The currently installed Python versions are:"
echo "$versions" | sed 's/^/ /'
fi
echo
echo "The special version string 'system' will use your default system Python"
} }
case "$1" in extract_initial_comment_block() {
"") echo "usage: pyenv <command> [<args>] sed -ne "
/^#/ !{
q
}
Some useful pyenv commands are: s/^#$/# /
commands List all pyenv commands
rehash Rehash pyenv shims (run this after installing binaries)
global Set or show the global Python version
local Set or show the local directory-specific Python version
shell Set or show the shell-specific Python version
version Show the current Python version
versions List all Python versions known by pyenv
which Show the full path for the given Python command
whence List all Python versions with the given command
See 'pyenv help <command>' for information on a specific command. /^# / {
For full documentation, see: https://github.com/sstephenson/pyenv#readme" s/^# //
;; p
commands) echo "usage: pyenv commands }
pyenv commands --sh "
pyenv commands --no-sh }
List all pyenv commands." collect_documentation() {
;; awk '
global) echo "usage: pyenv global <version> /^Summary:/ {
summary = substr($0, 10)
next
}
Sets the global Python version. You can override the global version at /^Usage:/ {
any time by setting a directory-specific version with \`pyenv local' reading_usage = 1
or by setting the PYENV_VERSION environment variable. usage = usage "\n" $0
next
}
$(print_set_version)" /^( *$| )/ && reading_usage {
;; usage = usage "\n" $0
local) echo "usage: pyenv local <version> next
pyenv local --unset }
Sets the local directory-specific Python version by writing the version {
name to a file named '.pyenv-version'. reading_usage = 0
help = help "\n" $0
}
When you run a Python command, pyenv will look for an '.pyenv-version' function escape(str) {
file in the current directory and each parent directory. If no such gsub(/[`\\$"]/, "\\\\&", str)
file is found in the tree, pyenv will use the global Python version return str
specified with \`pyenv global', or the version specified in the }
PYENV_VERSION environment variable.
$(print_set_version)" function trim(str) {
;; gsub(/^\n*/, "", str)
shell) echo "usage: pyenv shell <version> gsub(/\n*$/, "", str)
pyenv shell --unset return str
}
Sets a shell-specific Python version by setting the 'PYENV_VERSION' END {
environment variable in your shell. This version overrides both if (usage || summary) {
project-specific versions and the global version. print "summary=\"" escape(summary) "\""
print "usage=\"" escape(trim(usage)) "\""
print "help=\"" escape(trim(help)) "\""
}
}
'
}
$(print_set_version)" documentation_for() {
;; local filename="$(command_path "$1")"
versions) echo "usage: pyenv versions if [ -n "$filename" ]; then
pyenv versions --bare extract_initial_comment_block < "$filename" | collect_documentation
Lists all Python versions known by pyenv."
;;
which) echo "usage: pyenv which <command>
Displays the full path to the binary that pyenv will execute when you
run the given command."
;;
whence) echo "usage: pyenv whence <command>
Lists all Python versions with the given command installed."
;;
*)
command_path="$(command -v "pyenv-$1" || true)"
if [ -n "$command_path" ]; then
echo "Sorry, the \`$1' command isn't documented yet."
echo
echo "You can view the command's source here:"
echo "$command_path"
echo
else
echo "pyenv: no such command \`$1'"
fi fi
esac }
print_summary() {
local command="$1"
local summary usage help
eval "$(documentation_for "$command")"
if [ -n "$summary" ]; then
printf " %-9s %s\n" "$command" "$summary"
fi
}
print_summaries() {
for command; do
print_summary "$command"
done
}
print_help() {
local command="$1"
local summary usage help
eval "$(documentation_for "$command")"
[ -n "$help" ] || help="$summary"
if [ -n "$usage" -o -n "$summary" ]; then
if [ -n "$usage" ]; then
echo "$usage"
else
echo "Usage: pyenv ${command}"
fi
if [ -n "$help" ]; then
echo
echo "$help"
echo
fi
else
echo "Sorry, this command isn't documented yet." >&2
return 1
fi
}
print_usage() {
local command="$1"
local summary usage help
eval "$(documentation_for "$command")"
[ -z "$usage" ] || echo "$usage"
}
unset usage
if [ "$1" = "--usage" ]; then
usage="1"
shift
fi
if [ -z "$1" ] || [ "$1" == "pyenv" ]; then
echo "Usage: pyenv <command> [<args>]"
[ -z "$usage" ] || exit
echo
echo "Some useful pyenv commands are:"
print_summaries commands local global shell install uninstall rehash version versions which whence
echo
echo "See \`pyenv help <command>' for information on a specific command."
echo "For full documentation, see: https://github.com/yyuu/pyenv#readme"
else
command="$1"
if [ -n "$(command_path "$command")" ]; then
if [ -n "$usage" ]; then
print_usage "$command"
else
print_help "$command"
fi
else
echo "pyenv: no such command \`$command'" >&2
exit 1
fi
fi

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: List hook scripts for a given pyenv command
# Usage: pyenv hooks <command>
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -12,7 +15,7 @@ fi
PYENV_COMMAND="$1" PYENV_COMMAND="$1"
if [ -z "$PYENV_COMMAND" ]; then if [ -z "$PYENV_COMMAND" ]; then
echo "usage: pyenv hooks COMMAND" >&2 pyenv-help --usage hooks >&2
exit 1 exit 1
fi fi

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Configure the shell environment for pyenv
# Usage: eval "$(pyenv init - [--no-rehash] [<shell>])"
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -82,11 +85,12 @@ if [ -z "$no_rehash" ]; then
echo 'pyenv rehash 2>/dev/null' echo 'pyenv rehash 2>/dev/null'
fi fi
commands=(`pyenv commands --sh`) commands=(`pyenv-commands --sh`)
IFS="|" IFS="|"
cat <<EOS cat <<EOS
pyenv() { pyenv() {
local command="\$1" typeset command
command="\$1"
if [ "\$#" -gt 0 ]; then if [ "\$#" -gt 0 ]; then
shift shift
fi fi

View File

@@ -1,4 +1,28 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Summary: Set or show the local application-specific Python version
#
# Usage: pyenv local <version>
# pyenv local --unset
#
# Sets the local application-specific Python version by writing the
# version name to a file named `.python-version'.
#
# When you run a Python command, pyenv will look for a `.python-version'
# file in the current directory and each parent directory. If no such
# file is found in the tree, pyenv will use the global Python version
# specified with `pyenv global'. A version specified with the
# `PYENV_VERSION' environment variable takes precedence over local
# and global versions.
#
# For backwards compatibility, pyenv will also read version
# specifications from `.pyenv-version' files, but a `.python-version'
# file in the same directory takes precedence.
#
# <version> should be a string matching a Python version known to pyenv.
# The special version string `system' will use your default system Python.
# Run `pyenv versions' for a list of available Python versions.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -9,16 +33,27 @@ if [ "$1" = "--complete" ]; then
exec pyenv-versions --bare exec pyenv-versions --bare
fi fi
PYENV_VERSION="$1" versions=($@)
PYENV_VERSION_FILE=".pyenv-version"
if [ "$PYENV_VERSION" = "--unset" ]; then if [ "$versions" = "--unset" ]; then
rm -f "$PYENV_VERSION_FILE" rm -f .python-version .pyenv-version
elif [ -n "$PYENV_VERSION" ]; then elif [ -n "$versions" ]; then
pyenv-version-file-write "$PYENV_VERSION_FILE" "$PYENV_VERSION" if [ "$(PYENV_VERSION= pyenv-version-origin)" -ef .pyenv-version ]; then
rm -f .pyenv-version
{ echo "pyenv: removed existing \`.pyenv-version' file and migrated"
echo " local version specification to \`.python-version' file"
} >&2
fi
pyenv-version-file-write .python-version "${versions[@]}"
else else
pyenv-version-file-read "$PYENV_VERSION_FILE" || IFS=: versions=($(
pyenv-version-file-read .python-version ||
pyenv-version-file-read .pyenv-version ||
{ echo "pyenv: no local version configured for this directory" { echo "pyenv: no local version configured for this directory"
exit 1 exit 1
} >&2 } >&2
))
for version in "${versions[@]}"; do
echo "$version"
done
fi fi

View File

@@ -1,4 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Display prefix for a Python version
# Usage: pyenv prefix [<version>]
#
# Displays the directory where a Python version is installed. If no
# version is given, `pyenv prefix' displays the location of the
# currently selected version.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -9,21 +16,27 @@ if [ "$1" = "--complete" ]; then
fi fi
if [ -n "$1" ]; then if [ -n "$1" ]; then
export PYENV_VERSION="$1" versions=($@)
elif [ -z "$PYENV_VERSION" ]; then IFS=: PYENV_VERSION="${versions[*]}"
PYENV_VERSION="$(pyenv-version-name)" export PYENV_VERSION
else
IFS=: versions=($(pyenv-version-name))
fi fi
if [ "$PYENV_VERSION" = "system" ]; then PYENV_PREFIX_PATHS=()
PYTHON_PATH="$(pyenv-which python)" for version in "${versions[@]}"; do
echo "${PYTHON_PATH%/*}" if [ "$version" = "system" ]; then
exit PYTHON_PATH="$(pyenv-which python || true)"
fi PYENV_PREFIX_PATH="${PYTHON_PATH%/*}"
else
PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}" PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${version}"
if [ ! -d "$PYENV_PREFIX_PATH" ]; then fi
echo "pyenv: version \`${PYENV_VERSION}' not installed" >&2 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 exit 1
fi fi
done
echo "$PYENV_PREFIX_PATH" IFS=: echo "${PYENV_PREFIX_PATHS[*]}"

View File

@@ -1,4 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Rehash pyenv shims (run this after installing executables)
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -30,19 +32,48 @@ remove_prototype_shim() {
# The prototype shim file is a script that re-execs itself, passing # The prototype shim file is a script that re-execs itself, passing
# its filename and any arguments to `pyenv exec`. This file is # its filename and any arguments to `pyenv exec`. This file is
# hard-linked for every binary and then removed. The linking technique # hard-linked for every executable and then removed. The linking
# is fast, uses less disk space than unique files, and also serves as # technique is fast, uses less disk space than unique files, and also
# a locking mechanism. # serves as a locking mechanism.
create_prototype_shim() { create_prototype_shim() {
cat > "$PROTOTYPE_SHIM_PATH" <<SH cat > "$PROTOTYPE_SHIM_PATH" <<SH
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
[ -n "\$PYENV_DEBUG" ] && set -x
program="\${0##*/}"
if [ "\$program" = "python" ]; then
for arg; do
case "\$arg" in
-c* | -- ) break ;;
*/* )
if [ -f "\$arg" ]; then
export PYENV_DIR="\${arg%/*}"
break
fi
;;
esac
done
fi
export PYENV_ROOT="$PYENV_ROOT" export PYENV_ROOT="$PYENV_ROOT"
exec pyenv exec "\${0##*/}" "\$@" exec "$(command -v pyenv)" exec "\$program" "\$@"
SH SH
chmod +x "$PROTOTYPE_SHIM_PATH" chmod +x "$PROTOTYPE_SHIM_PATH"
} }
# If the contents of the prototype shim file differ from the contents
# of the first shim in the shims directory, assume pyenv has been
# upgraded and the existing shims need to be removed.
remove_outdated_shims() {
for shim in *; do
if ! diff "$PROTOTYPE_SHIM_PATH" "$shim" >/dev/null 2>&1; then
for shim in *; do rm -f "$shim"; done
fi
break
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.
@@ -55,58 +86,27 @@ make_shims() {
done done
} }
# Create an empty array for the list of registered shims. # Create an empty array for the list of registered shims and an empty
# string to use as a search index.
registered_shims=() registered_shims=()
registered_shims_index=""
# We will keep track of shims registered for installation with the # We will keep track of shims registered for installation with the
# global `reigstered_shims` array and with a global variable for each # global `reigstered_shims` array and with a global search index
# shim. The array will let us iterate over all registered shims. The # string. The array will let us iterate over all registered shims. The
# global variables will let us quickly check whether a shim with the # index string will let us quickly check whether a shim with the given
# given name has been registered or not. # name has been registered or not.
register_shim() { register_shim() {
local shim="$@" local shim="$@"
local var="$(shim_variable_name "$shim")" registered_shims["${#registered_shims[@]}"]="$shim"
registered_shims_index="$registered_shims_index/$shim/"
if [ -z "${!var}" ]; then
registered_shims[${#registered_shims[*]}]="$shim"
eval "${var}=1"
fi
}
# To compute the global variable name for a given shim we must first
# escape any non-alphanumeric characters. If the shim name is
# alphanumeric (including a hyphen or underscore) we can take a
# shorter path. Otherwise, we must iterate over each character and
# escape the non-alphanumeric ones using `printf`.
shim_variable_name() {
local shim="$1"
local result="_shim_"
if [[ ! "$shim" =~ [^[:alnum:]_-] ]]; then
shim="${shim//_/_5f}"
shim="${shim//-/_2d}"
result="$result$shim"
else
local length="${#shim}"
local char i
for ((i=0; i<length; i++)); do
char="${shim:$i:1}"
if [[ "$char" =~ [[:alnum:]] ]]; then
result="$result$char"
else
result="$result$(printf "_%02x" \'"$char")"
fi
done
fi
echo "$result"
} }
# To install all the registered shims, we iterate over the # To install all the registered shims, we iterate over the
# `registered_shims` array and create a link if one does not already # `registered_shims` array and create a link if one does not already
# exist. # exist.
install_registered_shims() { install_registered_shims() {
local shim
for shim in "${registered_shims[@]}"; do for shim in "${registered_shims[@]}"; do
[ -e "$shim" ] || ln -f "$PROTOTYPE_SHIM_PATH" "$shim" [ -e "$shim" ] || ln -f "$PROTOTYPE_SHIM_PATH" "$shim"
done done
@@ -117,10 +117,9 @@ install_registered_shims() {
# in the directory but has not been registered as a shim should be # in the directory but has not been registered as a shim should be
# removed. # removed.
remove_stale_shims() { remove_stale_shims() {
local var local shim
for shim in *; do for shim in *; do
var="$(shim_variable_name "$shim")" if [[ "$registered_shims_index" != *"/$shim/"* ]]; then
if [ -z "${!var}" ]; then
rm -f "$shim" rm -f "$shim"
fi fi
done done
@@ -129,10 +128,12 @@ remove_stale_shims() {
# Change to the shims directory. # Change to the shims directory.
cd "$SHIM_PATH" cd "$SHIM_PATH"
# Create the prototype shim, then register shims for all known binaries.
create_prototype_shim
shopt -s nullglob shopt -s nullglob
# Create the prototype shim, then register shims for all known
# executables.
create_prototype_shim
remove_outdated_shims
make_shims ../versions/*/bin/* make_shims ../versions/*/bin/*
# Restore the previous working directory. # Restore the previous working directory.

View File

@@ -1,2 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Display the root directory where versions and shims are kept
echo $PYENV_ROOT echo $PYENV_ROOT

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

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Usage: pyenv pop <version>
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

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

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Usage: pyenv push <version>
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

13
libexec/pyenv-sh-rehash Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Provide pyenv completions
if [ "$1" = "--complete" ]; then
exec pyenv-rehash --complete
fi
# When pyenv shell integration is enabled, delegate to pyenv-rehash,
# then tell the shell to empty its command lookup cache.
pyenv-rehash
echo "hash -r"

View File

@@ -1,4 +1,18 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Summary: Set or show the shell-specific Python version
#
# Usage: pyenv shell <version>
# pyenv shell --unset
#
# Sets a shell-specific Python version by setting the `PYENV_VERSION'
# environment variable in your shell. This version overrides local
# application-specific versions and the global version.
#
# <version> should be a string matching a Python version known to pyenv.
# The special version string `system' will use your default system Python.
# Run `pyenv versions' for a list of available Python versions.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -9,9 +23,9 @@ if [ "$1" = "--complete" ]; then
exec pyenv-versions --bare exec pyenv-versions --bare
fi fi
version="$1" versions=("$@")
if [ -z "$version" ]; then if [ -z "$versions" ]; then
if [ -z "$PYENV_VERSION" ]; then if [ -z "$PYENV_VERSION" ]; then
echo "pyenv: no shell-specific version configured" >&2 echo "pyenv: no shell-specific version configured" >&2
exit 1 exit 1
@@ -21,12 +35,16 @@ if [ -z "$version" ]; then
fi fi
fi fi
if [ "$version" = "--unset" ]; then if [ "$versions" = "--unset" ]; then
echo "unset PYENV_VERSION" echo "unset PYENV_VERSION"
exit 1 exit
fi fi
# Make sure the specified version is installed. # Make sure the specified version is installed.
pyenv-prefix "$version" >/dev/null if pyenv-prefix "${versions[@]}" >/dev/null; then
IFS=: PYENV_VERSION="${versions[*]}"
echo "export PYENV_VERSION=\"${version}\"" echo "export PYENV_VERSION=\"${PYENV_VERSION}\""
else
echo "return 1"
exit 1
fi

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: List existing pyenv shims
# Usage: pyenv shims [--short]
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x

View File

@@ -1,5 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Show the current Python version and its origin
#
# Shows the currently selected Python version and how it was
# selected. To obtain only the version string, use `pyenv
# version-name'.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -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

@@ -1,15 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Detect the file that sets the current pyenv version
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
root="$PYENV_DIR" find_local_version_file() {
while [ -n "$root" ]; do local root="$1"
if [ -e "${root}/.pyenv-version" ]; then while [ -n "$root" ]; do
if [ -e "${root}/.python-version" ]; then
echo "${root}/.python-version"
exit
elif [ -e "${root}/.pyenv-version" ]; then
echo "${root}/.pyenv-version" echo "${root}/.pyenv-version"
exit exit
fi fi
root="${root%/*}" root="${root%/*}"
done done
}
find_local_version_file "$PYENV_DIR"
[ "$PYENV_DIR" = "$PWD" ] || find_local_version_file "$PWD"
global_version_file="${PYENV_ROOT}/version" global_version_file="${PYENV_ROOT}/version"

View File

@@ -1,22 +1,27 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Usage: pyenv version-file-read <file>
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
VERSION_FILE="$1" VERSION_FILE="$1"
if [ -e "$VERSION_FILE" ]; then if [ -e "$VERSION_FILE" ]; then
# Read and print the first non-whitespace word from the specified # Read the first non-whitespace word from the specified version file.
# version file. # Be careful not to load it whole in case there's something crazy in it.
version="" versions=()
while read -a words; do while read -a words; do
word="${words[0]}" word="${words[0]}"
if [ -z "$version" ] && [ -n "$word" ]; then if [ -n "$word" ]; then
version="$word" length="${#versions[@]}"
versions=("${versions[@]}" "$word")
fi fi
done < <( cat "$VERSION_FILE" && echo ) done < <( cat "$VERSION_FILE" && echo )
if [ -n "$version" ]; then if [ -n "$versions" ]; then
echo "$version" {
IFS=:
echo "${versions[*]}"
}
exit exit
fi fi
fi fi

View File

@@ -1,17 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Usage: pyenv version-file-write <file> <version>
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
PYENV_VERSION_FILE="$1" PYENV_VERSION_FILE="$1"
PYENV_VERSION="$2" shift
versions=("$@")
if [ -z "$PYENV_VERSION" ] || [ -z "$PYENV_VERSION_FILE" ]; then if [ -z "$versions" ] || [ -z "$PYENV_VERSION_FILE" ]; then
echo "usage: pyenv write-version-file FILENAME VERSION" >&2 pyenv-help --usage version-file-write >&2
exit 1 exit 1
fi fi
# Make sure the specified version is installed. # Make sure the specified version is installed.
pyenv-prefix "$PYENV_VERSION" >/dev/null pyenv-prefix "${versions[@]}" >/dev/null
# Write the version out to disk. # 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

@@ -1,22 +1,34 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Show the current Python version
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -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_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 fi
if [ -z "$PYENV_VERSION" ] || [ "$PYENV_VERSION" = "system" ]; then if [ -z "$versions" ]; then
echo "system" echo "system"
exit exit
fi fi
PYENV_VERSION_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}" version_exists() {
local version="$1"
[ -d "${PYENV_ROOT}/versions/${version}" ]
}
if [ -d "$PYENV_VERSION_PATH" ]; then for version in "${versions[@]}"; do
echo "$PYENV_VERSION" PYENV_VERSION_PATH="${PYENV_ROOT}/versions/${version}"
else
echo "pyenv: version \`$PYENV_VERSION' is not installed" >&2 if [ "$version" != "system" ] && ! version_exists "$version"; then
echo "pyenv: version \`$version' is not installed" >&2
exit 1 exit 1
fi fi
done
echo "${PYENV_VERSION}"

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: Explain how the current Python version is set
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x

View File

@@ -1,27 +1,50 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: List all Python versions available to pyenv
# Usage: pyenv versions [--bare]
#
# Lists all Python versions found in `$PYENV_ROOT/versions/*'.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
PYENV_VERSION_NAME="$(pyenv-version-name)"
if [ "$1" = "--bare" ]; then if [ "$1" = "--bare" ]; then
hit_prefix="" hit_prefix=""
miss_prefix="" miss_prefix=""
print_version="$PYENV_VERSION_NAME" IFS=: current_versions=()
version_origin=""
include_system=""
else else
hit_prefix="* " hit_prefix="* "
miss_prefix=" " miss_prefix=" "
print_version="$(pyenv-version)" IFS=: current_versions=($(pyenv-version-name || true))
version_origin=" (set by $(pyenv-version-origin))"
include_system="1"
fi
array_exists() {
local x car="$1"
shift
for x in "$@"; do
[ "${x}" = "${car}" ] && return 0
done
return 1
}
print_version() {
if array_exists "$1" "${current_versions[@]}"; then
echo "${hit_prefix}${1}${version_origin}"
else
echo "${miss_prefix}${1}"
fi
}
# Include "system" in the non-bare output, if it exists
if [ -n "$include_system" ] && PYENV_VERSION=system pyenv-which python >/dev/null 2>&1; then
print_version system
fi fi
for path in "${PYENV_ROOT}/versions/"*; do for path in "${PYENV_ROOT}/versions/"*; do
if [ -d "$path" ]; then if [ -d "$path" ]; then
version="${path##*/}" print_version "${path##*/}"
if [ "$version" == "$PYENV_VERSION_NAME" ]; then
echo "${hit_prefix}${print_version}"
else
echo "${miss_prefix}${version}"
fi
fi fi
done done

View File

@@ -1,4 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Summary: List all Python versions that contain the given executable
# Usage: pyenv whence [--path] <command>
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -27,7 +30,7 @@ whence() {
PYENV_COMMAND="$1" PYENV_COMMAND="$1"
if [ -z "$PYENV_COMMAND" ]; then if [ -z "$PYENV_COMMAND" ]; then
echo "usage: pyenv whence [--path] COMMAND" >&2 pyenv-help --usage whence >&2
exit 1 exit 1
fi fi

View File

@@ -1,4 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Summary: Display the full path to an executable
#
# Usage: pyenv which <command>
#
# Displays the full path to the executable that pyenv will invoke when
# you run the given command.
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -40,20 +48,26 @@ remove_from_path() {
echo "${result%:}" echo "${result%:}"
} }
PYENV_VERSION="$(pyenv-version-name)" IFS=: versions=($(pyenv-version-name))
IFS=: PYENV_VERSION="${versions[*]}"
PYENV_COMMAND="$1" PYENV_COMMAND="$1"
if [ -z "$PYENV_COMMAND" ]; then if [ -z "$PYENV_COMMAND" ]; then
echo "usage: pyenv which COMMAND" >&2 pyenv-help --usage which >&2
exit 1 exit 1
fi fi
if [ "$PYENV_VERSION" = "system" ]; then for version in "${versions[@]}"; do
if [ "$version" = "system" ]; then
PATH="$(remove_from_path "${PYENV_ROOT}/shims")" PATH="$(remove_from_path "${PYENV_ROOT}/shims")"
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND")" PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND" || true)"
else else
PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${PYENV_VERSION}/bin/${PYENV_COMMAND}" PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${version}/bin/${PYENV_COMMAND}"
fi fi
if [ -x "$PYENV_COMMAND_PATH" ]; then
break
fi
done
for script in $(pyenv-hooks which); do for script in $(pyenv-hooks which); do
source "$script" source "$script"

3
plugins/.gitignore vendored Normal file
View File

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

View File

@@ -1,4 +1,21 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Summary: Install a Python version using the python-build plugin
#
# Usage: pyenv install [-f|--force] [-k|--keep] [-v|--verbose] <version>
# pyenv install [-f|--force] [-k|--keep] [-v|--verbose] <definition-file>
# pyenv install -l|--list
#
# -l/--list List all available versions
# -f/--force Install even if the version appears to be installed already
# -k/--keep Keep source tree in $PYENV_BUILD_ROOT after installation
# (defaults to $PYENV_ROOT/sources)
# -v/--verbose Verbose mode: print compilation status to stdout
#
# For detailed information on installing Python versions with
# python-build, including a list of environment variables for adjusting
# compilation, see: https://github.com/yyuu/pyenv#readme
#
set -e set -e
[ -n "$PYENV_DEBUG" ] && set -x [ -n "$PYENV_DEBUG" ] && set -x
@@ -15,20 +32,12 @@ fi
eval "$(python-build --lib)" eval "$(python-build --lib)"
usage() { usage() {
{ echo "usage: pyenv install [-k|--keep] [-v|--verbose] VERSION" # We can remove the sed fallback once pyenv 0.4.0 is widely available.
echo " pyenv install [-k|--keep] [-v|--verbose] /path/to/definition" pyenv-help install 2>/dev/null || sed -ne '/^#/!q;s/.//;s/.//;1,4d;p' < "$0"
echo " pyenv install -l|--list"
echo
echo " -l/--list List all available versions"
echo " -k/--keep Keep source tree in \$PYENV_BUILD_ROOT after installation"
echo " (defaults to ${PYENV_ROOT}/sources)"
echo " -v/--verbose Verbose mode: print compilation status to stdout"
echo
} >&2
[ -z "$1" ] || exit "$1" [ -z "$1" ] || exit "$1"
} }
unset FORCE
unset KEEP unset KEEP
unset VERBOSE unset VERBOSE
@@ -43,6 +52,9 @@ for option in "${OPTIONS[@]}"; do
python-build --definitions | sed 's/^/ /' python-build --definitions | sed 's/^/ /'
exit exit
;; ;;
"f" | "force" )
FORCE=true
;;
"k" | "keep" ) "k" | "keep" )
[ -n "${PYENV_BUILD_ROOT}" ] || PYENV_BUILD_ROOT="${PYENV_ROOT}/sources" [ -n "${PYENV_BUILD_ROOT}" ] || PYENV_BUILD_ROOT="${PYENV_ROOT}/sources"
;; ;;
@@ -58,21 +70,80 @@ for option in "${OPTIONS[@]}"; do
esac esac
done done
unset VERSION_NAME
# The first argument contains the definition to install. If the
# argument is missing, try to install whatever local app-specific
# version is specified by pyenv. Show usage instructions if a local
# version is not specified.
DEFINITION="${ARGUMENTS[0]}" DEFINITION="${ARGUMENTS[0]}"
[ -n "$DEFINITION" ] || DEFINITION="$(pyenv local 2>/dev/null || true)"
[ -n "$DEFINITION" ] || usage 1 [ -n "$DEFINITION" ] || usage 1
# Define `before_install` and `after_install` functions that allow
# plugin hooks to register a string of code for execution before or
# after the installation process.
declare -a before_hooks after_hooks
before_install() {
local hook="$1"
before_hooks["${#before_hooks[@]}"]="$hook"
}
after_install() {
local hook="$1"
after_hooks["${#after_hooks[@]}"]="$hook"
}
# Load plugin hooks.
for script in $(pyenv-hooks install); do for script in $(pyenv-hooks install); do
source "$script" source "$script"
done done
VERSION_NAME="${DEFINITION##*/}"
# Set VERSION_NAME from $DEFINITION, if it is not already set. Then
# compute the installation prefix.
[ -n "$VERSION_NAME" ] || VERSION_NAME="${DEFINITION##*/}"
PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}" PREFIX="${PYENV_ROOT}/versions/${VERSION_NAME}"
# If PYENV_BUILD_ROOT is set, then always pass keep options to python-build # If the installation prefix exists, prompt for confirmation unless
# the --force option was specified.
if [ -z "$FORCE" ] && [ -d "${PREFIX}/bin" ]; then
echo "pyenv: $PREFIX already exists" >&2
read -p "continue with installation? (y/N) "
case "$REPLY" in
y* | Y* ) ;;
* ) exit 1 ;;
esac
fi
# If PYENV_BUILD_ROOT is set, always pass keep options to python-build.
if [ -n "${PYENV_BUILD_ROOT}" ]; then if [ -n "${PYENV_BUILD_ROOT}" ]; then
export PYTHON_BUILD_BUILD_PATH="${PYENV_BUILD_ROOT}/${VERSION_NAME}" export PYTHON_BUILD_BUILD_PATH="${PYENV_BUILD_ROOT}/${VERSION_NAME}"
KEEP="-k" KEEP="-k"
fi fi
python-build $KEEP $VERBOSE "$DEFINITION" "$PREFIX" # Set PYTHON_BUILD_CACHE_PATH to $PYENV_ROOT/cache, if the directory
pyenv rehash # exists and the variable is not already set.
if [ -z "${PYTHON_BUILD_CACHE_PATH}" ] && [ -d "${PYENV_ROOT}/cache" ]; then
export PYTHON_BUILD_CACHE_PATH="${PYENV_ROOT}/cache"
fi
# Execute `before_install` hooks.
for hook in "${before_hooks[@]}"; do eval "$hook"; done
# Invoke `python-build` and record the exit status in $STATUS. Run
# `pyenv rehash` after a successful installation.
STATUS=0
python-build $KEEP $VERBOSE "$DEFINITION" "$PREFIX" || STATUS="$?"
# Execute `after_install` hooks.
for hook in "${after_hooks[@]}"; do eval "$hook"; done
# Run `pyenv-rehash` after a successful installation.
[ "$STATUS" != "0" ] || pyenv rehash
exit "$STATUS"

View File

@@ -1,4 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#
# Summary: Uninstall a specific Python version
#
# Usage: pyenv uninstall [-f|--force] <version>
#
# -f Attempt to remove the specified version without prompting
# for confirmation. If the version does not exist, do not
# display an error message.
#
# See `pyenv versions` for a complete list of installed versions.
#
set -e set -e
# Provide pyenv completions # Provide pyenv completions
@@ -11,7 +22,7 @@ if [ -z "$PYENV_ROOT" ]; then
fi fi
unset FORCE unset FORCE
if [ "$1" = "-f" ]; then if [ "$1" = "-f" ] || [ "$1" = "--force" ]; then
FORCE=true FORCE=true
shift shift
fi fi
@@ -19,15 +30,9 @@ fi
DEFINITION="$1" DEFINITION="$1"
case "$DEFINITION" in case "$DEFINITION" in
"" | -* ) "" | -* )
{ echo "usage: pyenv uninstall [-f] VERSION" # We can remove the sed fallback once pyenv 0.4.0 is widely available.
echo { pyenv-help uninstall 2>/dev/null ||
echo " -f Attempt to remove the specified version without prompting" sed -ne '/^#/!q;s/.\{1,2\}//;1,4d;p' < "$0"
echo " for confirmation. If the version does not exist, do not"
echo " display an error message."
echo
echo "Installed versions:"
pyenv versions --bare | sed 's/^/ /'
echo
} >&2 } >&2
exit 1 exit 1
;; ;;

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PYTHON_BUILD_VERSION="20120815" PYTHON_BUILD_VERSION="20121023"
set -E set -E
exec 3<&2 # preserve original stderr at fd 3 exec 3<&2 # preserve original stderr at fd 3
@@ -96,6 +96,10 @@ install_git() {
install_package_using "git" 2 $* install_package_using "git" 2 $*
} }
install_svn() {
install_package_using "svn" 2 $*
}
install_jar() { install_jar() {
install_package_using "jar" 1 $* install_package_using "jar" 1 $*
} }
@@ -112,7 +116,9 @@ install_package_using() {
make_package "$package_name" $* make_package "$package_name" $*
popd >&4 popd >&4
echo "Installed ${package_name} to ${PREFIX_PATH}" >&2 { echo "Installed ${package_name} to ${PREFIX_PATH}"
echo
} >&2
} }
make_package() { make_package() {
@@ -127,27 +133,139 @@ make_package() {
popd >&4 popd >&4
} }
fetch_url() { compute_md5() {
if type md5 &>/dev/null; then
md5 -q
elif type openssl &>/dev/null; then
local output="$(openssl md5)"
echo "${output##* }"
elif type md5sum &>/dev/null; then
local output="$(md5sum -b)"
echo "${output% *}"
else
return 1
fi
}
verify_checksum() {
# If there's no MD5 support, return success
[ -n "$HAS_MD5_SUPPORT" ] || return 0
# If the specified filename doesn't exist, return success
local filename="$1"
[ -e "$filename" ] || return 0
# If there's no expected checksum, return success
local expected_checksum="$2"
[ -n "$expected_checksum" ] || return 0
# If the computed checksum is empty, return failure
local computed_checksum="$(compute_md5 < "$filename")"
[ -n "$computed_checksum" ] || return 1
if [ "$expected_checksum" != "$computed_checksum" ]; then
{ echo
echo "checksum mismatch: ${filename} (file is corrupt)"
echo "expected $expected_checksum, got $computed_checksum"
echo
} >&4
return 1
fi
}
http() {
local method="$1"
local url="$2"
[ -n "$url" ] || return 1
if type curl &>/dev/null; then if type curl &>/dev/null; then
curl -L "$@" "http_${method}_curl" "$url"
elif type wget &>/dev/null; then elif type wget &>/dev/null; then
wget -O- "$@" "http_${method}_wget" "$url"
else else
echo "error: please install \`curl\` or \`wget\` and try again" >&2 echo "error: please install \`curl\` or \`wget\` and try again" >&2
exit 1 exit 1
fi fi
} }
http_head_curl() {
curl -sILf "$1" >&4 2>&1
}
http_get_curl() {
curl -sSLf "$1"
}
http_head_wget() {
wget -q --spider "$1" >&4 2>&1
}
http_get_wget() {
wget -nv -O- "$1"
}
fetch_tarball() { fetch_tarball() {
local package_name="$1" local package_name="$1"
local package_url="$2" local package_url="$2"
local mirror_url
local checksum
echo "Downloading ${package_url}..." >&2 if [ "$package_url" != "${package_url/\#}" ]; then
{ fetch_url "$package_url" > "${package_name}.tar" checksum="${package_url#*#}"
tar xvf "${package_name}.tar" package_url="${package_url%%#*}"
if [ -n "$PYTHON_BUILD_MIRROR_URL" ]; then
mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
fi
fi
local package_filename="${package_name}.tar" # later tar can read compression algorithm from file
symlink_tarball_from_cache "$package_filename" "$checksum" || {
echo "Downloading ${package_filename}..." >&2
{ http head "$mirror_url" &&
download_tarball "$mirror_url" "$package_filename" "$checksum"
} ||
download_tarball "$package_url" "$package_filename" "$checksum"
}
{ tar xvf "$package_filename"
rm -f "$package_filename"
} >&4 2>&1 } >&4 2>&1
} }
symlink_tarball_from_cache() {
[ -n "$PYTHON_BUILD_CACHE_PATH" ] || return 1
local package_filename="$1"
local cached_package_filename="${PYTHON_BUILD_CACHE_PATH}/$package_filename"
local checksum="$2"
[ -e "$cached_package_filename" ] || return 1
verify_checksum "$cached_package_filename" "$checksum" >&4 2>&1 || return 1
ln -s "$cached_package_filename" "$package_filename" >&4 2>&1 || return 1
}
download_tarball() {
local package_url="$1"
[ -n "$package_url" ] || return 1
local package_filename="$2"
local checksum="$3"
echo "-> $package_url" >&2
{ http get "$package_url" > "$package_filename"
verify_checksum "$package_filename" "$checksum"
} >&4 2>&1 || return 1
if [ -n "$PYTHON_BUILD_CACHE_PATH" ]; then
local cached_package_filename="${PYTHON_BUILD_CACHE_PATH}/$package_filename"
{ mv "$package_filename" "$cached_package_filename"
ln -s "$cached_package_filename" "$package_filename"
} >&4 2>&1 || return 1
fi
}
fetch_git() { fetch_git() {
local package_name="$1" local package_name="$1"
local git_url="$2" local git_url="$2"
@@ -163,16 +281,57 @@ fetch_git() {
fi fi
} }
fetch_svn() {
local package_name="$1"
local svn_url="$2"
local svn_rev="$3"
echo "Checking out ${svn_url}..." >&2
if type svn &>/dev/null; then
svn co -r "$svn_rev" "$svn_url" "${package_name}" >&4 2>&1
else
echo "error: please install \`svn\` and try again" >&2
exit 1
fi
}
fetch_jar() { fetch_jar() {
local package_name="$1" local package_name="$1"
local package_url="$2" local package_url="$2"
local mirror_url
local checksum
echo "Downloading ${package_url}..." >&2 if [ "$package_url" != "${package_url/\#}" ]; then
{ fetch_url "$package_url" > "${package_name}.jar" checksum="${package_url#*#}"
$JAVA -jar ${package_name}.jar -s -d ${package_name} package_url="${package_url%%#*}"
if [ -n "$PYTHON_BUILD_MIRROR_URL" ]; then
mirror_url="${PYTHON_BUILD_MIRROR_URL}/$checksum"
fi
fi
local package_filename="${package_name}.jar"
symlink_jar_from_cache "$package_filename" "checksum" || {
echo "Downloading ${package_filename}..." >&2
{ http head "$mirror_url" &&
download_jar "$mirror_url" "$package_filename" "$checksum"
} ||
download_jar "$package_url" "$package_filename" "$checksum"
}
{ $JAVA -jar ${package_name}.jar -s -d ${package_name}
rm -f "$package_filename"
} >&4 2>&1 } >&4 2>&1
} }
symlink_jar_from_cache() {
symlink_tarball_from_cache "$@"
}
download_jar() {
download_tarball "$@"
}
build_package() { build_package() {
local package_name="$1" local package_name="$1"
shift shift
@@ -186,7 +345,7 @@ build_package() {
echo "Installing ${package_name}..." >&2 echo "Installing ${package_name}..." >&2
for command in $commands; do for command in $commands; do
"build_package_${command}" "${package_name}" "build_package_${command}"
done done
if [ ! -f "$PYTHON_BIN" ]; then if [ ! -f "$PYTHON_BIN" ]; then
@@ -212,8 +371,8 @@ build_package_standard() {
fi fi
{ ./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS { ./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS
make $MAKE_OPTS "$MAKE" $MAKE_OPTS
make install "$MAKE" install
} >&4 2>&1 } >&4 2>&1
} }
@@ -225,8 +384,7 @@ build_package_autoconf() {
build_package_python() { build_package_python() {
local package_name="$1" local package_name="$1"
{ { "$PYTHON_BIN" setup.py install
"$PYTHON_BIN" setup.py install
} >&4 2>&1 } >&4 2>&1
} }
@@ -252,10 +410,6 @@ build_package_copy() {
cp -R . "$PREFIX_PATH" cp -R . "$PREFIX_PATH"
} }
bild_package_noop() {
echo "Nothing to do."
}
before_install_package() { before_install_package() {
local stub=1 local stub=1
} }
@@ -266,7 +420,7 @@ after_install_package() {
fix_directory_permissions() { fix_directory_permissions() {
# Ensure installed directories are not world-writable to avoid Bundler warnings # Ensure installed directories are not world-writable to avoid Bundler warnings
find "$PREFIX_PATH" -type d -exec chmod go-w {} \; find "$PREFIX_PATH" -type d \( -perm -020 -o -perm -002 \) -exec chmod go-w {} \;
} }
require_gcc() { require_gcc() {
@@ -284,19 +438,6 @@ require_gcc() {
echo "${esc}[1mDETAILS${esc}[0m: Apple no longer includes the official GCC compiler with Xcode" 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 "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 "\`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 fi
} >&3 } >&3
return 1 return 1
@@ -346,10 +487,6 @@ verify_gcc() {
return 1 return 1
fi fi
if echo "$version" | grep LLVM >/dev/null; then
return 1
fi
echo "$gcc" echo "$gcc"
} }
@@ -497,6 +634,33 @@ else
TMP="${TMPDIR%/}" TMP="${TMPDIR%/}"
fi fi
if [ -z "$MAKE" ]; then
MAKE="make"
fi
if [ -n "$PYTHON_BUILD_CACHE_PATH" ] && [ -d "$PYTHON_BUILD_CACHE_PATH" ]; then
PYTHON_BUILD_CACHE_PATH="${PYTHON_BUILD_CACHE_PATH%/}"
else
unset PYTHON_BUILD_CACHE_PATH
fi
if [ -z "$PYTHON_BUILD_MIRROR_URL" ]; then
PYTHON_BUILD_MIRROR_URL="" # FIXME: setup mirror site
else
PYTHON_BUILD_MIRROR_URL="${PYTHON_BUILD_MIRROR_URL%/}"
fi
if [ -n "$PYTHON_BUILD_SKIP_MIRROR" ]; then
unset PYTHON_BUILD_MIRROR_URL
fi
if echo test | compute_md5 >/dev/null; then
HAS_MD5_SUPPORT=1
else
unset HAS_MD5_SUPPORT
unset PYTHON_BUILD_MIRROR_URL
fi
SEED="$(date "+%Y%m%d%H%M%S").$$" SEED="$(date "+%Y%m%d%H%M%S").$$"
LOG_PATH="${TMP}/python-build.${SEED}.log" LOG_PATH="${TMP}/python-build.${SEED}.log"
PYTHON_BIN="${PREFIX_PATH}/bin/python" PYTHON_BIN="${PREFIX_PATH}/bin/python"
@@ -517,8 +681,8 @@ fi
export LDFLAGS="-L'${PREFIX_PATH}/lib' ${LDFLAGS}" export LDFLAGS="-L'${PREFIX_PATH}/lib' ${LDFLAGS}"
export CPPFLAGS="-I'${PREFIX_PATH}/include' ${CPPFLAGS}" export CPPFLAGS="-I'${PREFIX_PATH}/include' ${CPPFLAGS}"
unset PYTHONOPT unset PYTHONHOME
unset PYTHONLIB unset PYTHONPATH
trap build_failed ERR trap build_failed ERR
mkdir -p "$BUILD_PATH" mkdir -p "$BUILD_PATH"

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#bc1b74f90a472a6c0a85481aaeb43f95"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#cca695828df8adc3e69b637af07522e1"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#3f7ca8aa86c6bd275426d63b46e07992"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#a971f8928d6beb31ae0de56f7034d6a2"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#ad47b23778f64edadaaa8b5534986eed"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#abc02139ca38f4258e8e372f7da05c88"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#d1d9c83928561addf11d00b22a18ca50"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
http get "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#b2f209df270a33315e62c1ffac1937f0"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
http get "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#af474f85a3af69ea50438a2a48039d7d"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python

View File

@@ -2,13 +2,12 @@ before_install_package() {
local package_name="$1" local package_name="$1"
case "$package_name" in case "$package_name" in
Python*) Python*)
fetch_url "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" > setup.patch http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/common/patch-setup.py.diff" > setup.patch
patch -p0 < setup.patch patch -p0 < setup.patch
;; ;;
esac esac
} }
require_gcc install_package "Python-2.6.8" "http://www.python.org/ftp/python/2.6.8/Python-2.6.8.tgz#f6c1781f5d73ab7dfa5181f43ea065f6"
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.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
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.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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*)
http get "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#35f56b092ecf39a6bd59d64f142aae0f"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python

View File

@@ -0,0 +1,13 @@
before_install_package() {
local package_name="$1"
case "$package_name" in
Python*)
http get "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#15ed56733655e3fab785e49a7278d2fb"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#0ddfe265f1b3d0a8c2459f5bf66894c7"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#2cf641732ac23b18d139be077bd906cd"
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.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
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.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python

View File

@@ -2,13 +2,12 @@ before_install_package() {
local package_name="$1" local package_name="$1"
case "$package_name" in case "$package_name" in
Python*) Python*)
fetch_url "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/python30/patch-setup.py.diff" > setup.patch http get "https://raw.github.com/saghul/pythonz/346450868902fed0fe654c472b7b58e2e31fde70/pythonz/patches/all/python30/patch-setup.py.diff" > setup.patch
patch -p0 < setup.patch patch -p0 < setup.patch
;; ;;
esac esac
} }
require_gcc install_package "Python-3.0.1" "http://www.python.org/ftp/python/3.0.1/Python-3.0.1.tgz#220b73f0a1a20c4b1cdf9f9db4cd52fe"
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.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
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.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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*)
http get "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#d797fa6abe82c21227e328f05a535424"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#fa9f8efdc63944c8393870282e8b5c35"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#02196d3fc7bc76bdda68aa36b0dd16ab"
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.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
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.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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*)
http get "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#5efe838a7878b170f6728d7e5d7517af"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#6c2aa3481cadb7bdf74e625fffc352b2"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#3c63a6d97333f4da35976b6a0755eb67"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#dcf3a738e7028f1deb41b180bf0e2cbc"
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.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
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.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#198a64f7a04d1d5e95ce2782d5fd8254"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#f98b83fce9669feec69d0a17ee515a20" jython
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#2ee978eff4306b23753b3fe9d7af5b37" jython
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python

View File

@@ -1,4 +1,4 @@
require_java require_java
install_jar "Jython-2.5.2" "https://downloads.sourceforge.net/project/jython/jython/2.5.2/jython_installer-2.5.2.jar" jython install_jar "Jython-2.5.2" "https://downloads.sourceforge.net/project/jython/jython/2.5.2/jython_installer-2.5.2.jar#7c7d9abd8985df480edeacd27ed9dcd5" jython
install_package "distribute-0.6.28" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz" python install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#41633b4557483d6d4237ee79ffcebe7b" jython
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" 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#1c293253e8e4df411c3dd59dff82a663"
;;
linux*)
case $(uname -m) in
i386|i486|i586|i686)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux.tar.bz2#c4a1d11e0283a390d9e9b801a4633b9f"
;;
x86_64)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2#3b81363ccbc042dfdda2fabbf419e788"
;;
esac
;;
cygwin*|mingw*)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-win32.zip#1af8ee722721e9f5fd06b61af530ecb3"
;;
esac
if [ -n "$PYPY_URL" ]; then
install_package "pypy-1.8" "$PYPY_URL" pypy
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python
fi

View File

@@ -1,26 +1,24 @@
require_gcc
case "$OSTYPE" in case "$OSTYPE" in
darwin*) darwin*)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-osx64.tar.bz2" PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-osx64.tar.bz2#aad9c4b7b827583e37fe8ae0f7cfe0ff"
;; ;;
linux*) linux*)
case $(uname -m) in case $(uname -m) in
i386|i486|i586|i686) i386|i486|i586|i686)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux.tar.bz2" PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux.tar.bz2#1a08c88642434fc2e0e4256d351f48db"
;; ;;
x86_64) x86_64)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux64.tar.bz2" PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-linux64.tar.bz2#201d2cce2557e40c784473b471ee1b6b"
;; ;;
esac esac
;; ;;
cygwin*|mingw*) cygwin*|mingw*)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-win32.zip" PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-1.9-win32.zip#e7655066baed3c7bbbca7df617817dd5"
;; ;;
esac esac
if [ -n "$PYPY_URL" ]; then if [ -n "$PYPY_URL" ]; then
install_package "pypy-1.9" "$PYPY_URL" pypy install_package "pypy-1.9" "$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 "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python
fi fi

View File

@@ -0,0 +1,39 @@
case "$OSTYPE" in
darwin*)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-beta1-osx64.tar.bz2#2802a06cd19ac86930b63afdd837c32f"
;;
linux*)
case $(uname -m) in
armel)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-beta1-linux-armel.tar.bz2#a1505520c063c591b218e5cd3436b111"
;;
i386|i486|i586|i686)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-beta1-linux.tar.bz2#5aa2e4eee1c3dab86e5cec237776ced3"
;;
x86_64)
LDD_VERSION=$(ldd --version | head -1)
case "${LDD_VERSION#ldd \(*\) }" in
2.15)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-beta1-linux64-libc2.15.tar.bz2#0fde559a7b1a3b98245d6a5ea7f8ebb2"
;;
2.13)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-beta1-linux64-libc2.13.tar.bz2#68d8668299cd5adf4f302eaf882c5b33"
;;
*)
echo "pypy-2.0-beta1 requires libc version 2.13 or 2.15." 1>&2
exit 1
;;
esac
;;
esac
;;
cygwin*|mingw*)
PYPY_URL="https://bitbucket.org/pypy/pypy/downloads/pypy-2.0-beta1-win32.zip#e46e1c20da6a2d15e34a6ef9afca311f"
;;
esac
if [ -n "$PYPY_URL" ]; then
install_package "pypy-2.0-beta1" "$PYPY_URL" pypy
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python
fi

View File

@@ -0,0 +1,3 @@
install_package "stackless-272-export" "http://www.stackless.com/binaries/stackless-272-export.tar.bz2#79a718db998f2cdd95478d2cb54d56f2"
install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
install_package "pip-1.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python

View File

@@ -1,4 +1,3 @@
require_gcc install_package "stackless-322-export" "http://www.stackless.com/binaries/stackless-322-export.tar.bz2#3a3edcfb4240bdcc580cec2baea60af4"
install_package "stackless-322-export" "http://www.stackless.com/binaries/stackless-322-export.tar.bz2" install_package "distribute-0.6.34" "http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz#4576ab843a6db5100fb22a72deadf56d" python
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.2.1" "http://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz#db8a6d8a4564d3dc7f337ebed67b1a85" python
install_package "pip-1.1" "http://pypi.python.org/packages/source/p/pip/pip-1.1.tar.gz" python