Compare commits

...

46 Commits

Author SHA1 Message Date
Kenneth Reitz 8be04ea656 no ! 2014-04-02 14:05:09 -04:00
Kenneth Reitz de7c16d942 handhold for collectstatic 2014-04-02 14:02:18 -04:00
Kenneth Reitz 5ea843458a improved collectstatic experience 2014-04-02 13:37:19 -04:00
Kenneth Reitz 2c16539190 Merge branch 'stop-finding' of git://github.com/agriffis/heroku-buildpack-python into develop 2014-03-21 15:57:39 -04:00
kennethreitz ed79e61a2f Merge pull request #120 from agriffis/sed-func
Use a sed() function for unbuffered output.
2014-03-21 15:51:18 -04:00
kennethreitz b7bcc69722 Update Readme.md 2014-03-03 16:02:31 -05:00
Kenneth Reitz 3dde375d0b pip v1.5.4 2014-02-21 10:08:50 -06:00
Kenneth Reitz 483e30a5ba --allow-all-external 2014-02-21 10:04:23 -06:00
Aron Griffis e783556e6b dotglob FTW. Doesn't expand . or .. but be explicit just in case. 2014-02-19 20:43:18 -05:00
Kenneth Reitz 5645a433dc Merge remote-tracking branch 'origin/master' 2014-02-19 11:59:07 -05:00
Kenneth Reitz 715ab8b96a Update to Setuptools 2.1 and Pip 1.5.2
So seamless.
2014-02-19 11:59:02 -05:00
Aron Griffis 5f96190eb5 Stop calling find for simple operations. Just use extglob.
Additionally use `cp -a` consistently rather than alternating between
`cp -a` and `cp -r`, and don't fail compile if the glob doesn't expand to
anything.
2014-02-17 15:28:17 -05:00
Aron Griffis c579162ef9 Use consistent syntax for declaring functions in utils 2014-02-17 14:55:55 -05:00
Aron Griffis a5cca6de75 Use a sed() function for unbuffered output.
In `bin/steps/collectstatic` the unbuffered output in `indent` is subverted
by calling `sed` first:

```shell
python $MANAGE_FILE collectstatic --noinput  2>&1 | sed '/^Copying/d;/^$/d;/^ /d' | indent
```

This commit fixes this by making `sed` itself unbuffered rather than
putting that logic in the `indent` function.
2014-02-17 14:49:09 -05:00
kennethreitz b7f1157693 Merge pull request #118 from uniphil/master
fix url to testing buildpack
2014-02-14 13:58:49 -05:00
Phil Schleihauf ae7b6fc715 fix url to testing buildpack 2014-02-14 13:56:49 -05:00
Kenneth Reitz e0c3b72950 update runtime docs, thanks @uniphil!
#117
2014-02-14 13:41:34 -05:00
Kenneth Reitz 566f7f4555 new buildpack env standard 2014-01-21 17:47:05 -05:00
Kenneth Reitz 4ff62b2b41 sticky python versions bugfix 2014-01-17 17:06:54 -08:00
Kenneth Reitz d47970fd81 sticky runtimes 2014-01-17 16:47:55 -08:00
Kenneth Reitz 69bdca063f fix sub-env for when env file is not present 2013-12-20 17:15:24 -05:00
Kenneth Reitz 63cea99415 chmod +x 2013-12-20 16:48:34 -05:00
Kenneth Reitz 5ecd27e3b8 chmod +x 2013-12-13 16:03:39 -08:00
Kenneth Reitz 206a2dbc04 third argument support for envs in compile 2013-12-13 15:48:39 -08:00
kennethreitz 2a083791b6 Merge pull request #113 from zyegfryed/patch-3
Fixed Python runtime according to the official Heroku doc
2013-11-14 19:59:56 -08:00
kennethreitz d5b2b0b464 Merge pull request #114 from catsby/update_default_postgresql
Update Heroku Postgresql default add-on to hobby-dev
2013-11-14 19:59:40 -08:00
Clint Shryock 2eab1ad845 Update Heroku Postgresql default add-on to hobby-dev 2013-11-12 14:10:52 -06:00
Sébastien Fievet 2b16420d41 Fixed Python runtime according to the official Heroku doc
See https://devcenter.heroku.com/articles/python-runtimes#supported-runtimes
2013-11-04 09:24:36 +01:00
kennethreitz 9fa0889499 Update bpwatch 2013-10-17 15:43:51 -04:00
kennethreitz 99b17fabeb Merge pull request #105 from bacongobbler/patch-1
update shebang to use python2 for bpwatch
2013-10-17 11:37:00 -07:00
kennethreitz 933d3014d7 Merge pull request #103 from grosskur/library-path-fix
Make vendored libraries available at compile time (fixes #57)
2013-10-17 11:36:34 -07:00
Kenneth Reitz 018e0f31de Merge remote-tracking branch 'origin/master' 2013-09-01 06:27:46 +05:30
Kenneth Reitz cf1647e937 no --use-mirrors 2013-09-01 06:27:18 +05:30
Matthew Fisher b9f154bf38 update shebang to use python2 for bpwatch 2013-08-27 16:49:55 -07:00
Kenneth Reitz 4cc18ce0af Merge pull request #104 from zyegfryed/patch-1
Typo
2013-08-27 09:12:23 -07:00
Sébastien Fievet f5ea1c24a3 Typo 2013-08-25 18:41:46 +02:00
Kenneth Reitz 952b0bb735 v28 2013-08-14 22:02:11 -04:00
Kenneth Reitz 8b7edad8a2 bugfix for bpwatch 2013-08-14 22:01:16 -04:00
Kenneth Reitz 02787ac910 update bpwatch.zip for request_id 2013-08-14 21:19:12 -04:00
Alan Grosskurth bcc3ba09ca Make vendored libraries available at compile time (fixes #57)
When building, BUILD_DIR is set to a temporary directory. Vendored
libraries (e.g., pylibmc) are downloaded and unpacked in
$BUILD_DIR/.heroku/vendor/lib, but this is not currently in
LIBRARY_PATH or LD_LIBRARY_PATH.

Fix this by doing the following:

* Add $BUILD_DIR/.heroku/vendor/lib to LIBRARY_PATH/LD_LIBRARY_PATH

* Add $BUILD_DIR/.heroku/vendor/include to
  C_INCLUDE_PATH/CPLUS_INCLUDE_PATH

* Add $BUILD_DIR/.heroku/vendor/bin to PATH, so vendored commands can
  be used at compile time (e.g., curl-config)

* Add $BUILD_DIR/.heroku/vendor/lib/pkg-config to PKG_CONFIG_PATH, so
  vendored packages can be found with pkg-config
2013-08-14 16:59:31 -07:00
Kenneth Reitz 31e65dc58b new bpwatch 2013-07-17 17:04:37 -04:00
Kenneth Reitz 9a227e6c73 v24 2013-07-17 08:38:47 -04:00
Kenneth Reitz ddc9c24d34 deep-rm for normal builds 2013-07-17 08:34:14 -04:00
Kenneth Reitz 42488a2be7 deep-rm 2013-07-17 08:33:36 -04:00
Kenneth Reitz 839486c25b make things pretty, skip anvil build for normal runs 2013-07-17 08:25:17 -04:00
Kenneth Reitz 5d56200179 bugfix for legacy apps + usr_env_compile 2013-07-16 16:54:33 -04:00
466 changed files with 78449 additions and 23040 deletions
-21
View File
@@ -1,21 +0,0 @@
tests:
./bin/test
docs:
mkdir -p site
shocco -t 'Python Buildpack Compiler' ./bin/compile > site/index.html
shocco -t 'Django Buildpack Compiler' ./bin/steps/django > site/django.html
shocco -t 'Python Buildpack Detector' ./bin/detect > site/detect.html
shocco -t 'Pylibmc Buildpack Compiler' ./bin/steps/pylibmc > site/pylibmc.html
shocco -t 'Python Buildpack Changelog' ./Changelog.md > site/changelog.html
site: docs
cd site && git add -A && git commit -m 'update' && git push heroku master
pip:
git clone git@github.com:kennethreitz/pip.git --branch heroku --depth 1
rm -fr vendor/virtualenv-1.8.4/virtualenv_support/pip-1.2.1.tar.gz
rm -fr pip/.git
tar -pczf vendor/virtualenv-1.8.4/virtualenv_support/pip-1.2.1.tar.gz pip
rm -fr pip
+13 -12
View File
@@ -3,7 +3,6 @@ Heroku buildpack: Python
This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [pip](http://www.pip-installer.org/). This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpacks) for Python apps, powered by [pip](http://www.pip-installer.org/).
[![Build Status](https://secure.travis-ci.org/heroku/heroku-buildpack-python.png?branch=master)](http://travis-ci.org/heroku/heroku-buildpack-python)
Usage Usage
----- -----
@@ -19,11 +18,11 @@ Example usage:
... ...
-----> Fetching custom git buildpack... done -----> Fetching custom git buildpack... done
-----> Python app detected -----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.3. -----> No runtime.txt provided; assuming python-2.7.6.
-----> Preparing Python runtime (python-2.7.3) -----> Preparing Python runtime (python-2.7.6)
-----> Installing Distribute (0.6.34) -----> Installing Setuptools (2.1)
-----> Installing Pip (1.2.1) -----> Installing Pip (1.5.2)
-----> Installing dependencies using Pip (1.2.1) -----> Installing dependencies using Pip (1.5.2)
Downloading/unpacking Flask==0.7.2 (from -r requirements.txt (line 1)) Downloading/unpacking Flask==0.7.2 (from -r requirements.txt (line 1))
Downloading/unpacking Werkzeug>=0.6.1 (from Flask==0.7.2->-r requirements.txt (line 1)) Downloading/unpacking Werkzeug>=0.6.1 (from Flask==0.7.2->-r requirements.txt (line 1))
Downloading/unpacking Jinja2>=2.4 (from Flask==0.7.2->-r requirements.txt (line 1)) Downloading/unpacking Jinja2>=2.4 (from Flask==0.7.2->-r requirements.txt (line 1))
@@ -35,9 +34,9 @@ You can also add it to upcoming builds of an existing application:
$ heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-python.git $ heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-python.git
The buildpack will detect your app as Python if it has the file `requirements.txt` in the root. The buildpack will detect your app as Python if it has the file `requirements.txt` in the root.
It will use Pip to install your dependencies, vendoring a copy of the Python runtime into your slug. It will use Pip to install your dependencies, vendoring a copy of the Python runtime into your slug.
Specify a Runtime Specify a Runtime
----------------- -----------------
@@ -45,10 +44,12 @@ Specify a Runtime
You can also provide arbitrary releases Python with a `runtime.txt` file. You can also provide arbitrary releases Python with a `runtime.txt` file.
$ cat runtime.txt $ cat runtime.txt
python-3.3.0 python-3.3.3
Runtime options include: Runtime options include:
- python-2.7.4 - python-2.7.6
- python-3.3.1 - python-3.3.3
- pypy-1.9 (experimental) - pypy-1.9 (experimental)
Other [unsupported runtimes](https://github.com/kennethreitz/python-versions/tree/master/formula) are available as well.
+70 -58
View File
@@ -2,8 +2,7 @@
# Usage: # Usage:
# #
# $ bin/compile <build-dir> <cache-dir> # $ bin/compile <build-dir> <cache-dir> <env-path>
# Fail fast and fail hard. # Fail fast and fail hard.
set -eo pipefail set -eo pipefail
@@ -16,6 +15,8 @@ BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
ROOT_DIR=$(dirname $BIN_DIR) ROOT_DIR=$(dirname $BIN_DIR)
BUILD_DIR=$1 BUILD_DIR=$1
CACHE_DIR=$2 CACHE_DIR=$2
ENV_DIR=$3
CACHED_DIRS=".heroku" CACHED_DIRS=".heroku"
@@ -24,22 +25,22 @@ VIRTUALENV_LOC=".heroku/venv"
LEGACY_TRIGGER="lib/python2.7" LEGACY_TRIGGER="lib/python2.7"
PROFILE_PATH="$BUILD_DIR/.profile.d/python.sh" PROFILE_PATH="$BUILD_DIR/.profile.d/python.sh"
# Python version. This will be used in the future to specify custom Pythons. DEFAULT_PYTHON_VERSION="python-2.7.6"
DEFAULT_PYTHON_VERSION="python-2.7.4"
PYTHON_EXE="/app/.heroku/python/bin/python" PYTHON_EXE="/app/.heroku/python/bin/python"
PIP_VERSION="1.3.1" PIP_VERSION="1.5.4"
DISTRIBUTE_VERSION="0.6.36" SETUPTOOLS_VERSION="2.1"
# Setup bpwatch
export PATH=$PATH:$ROOT_DIR/vendor/bpwatch export PATH=$PATH:$ROOT_DIR/vendor/bpwatch
LOGPLEX_KEY="t.b396af7f-ad75-4643-8b9e-ebb288acc624" LOGPLEX_KEY="t.b396af7f-ad75-4643-8b9e-ebb288acc624"
BUILDPACK_VERSION=HEAD
export BPWATCH_STORE_PATH=$CACHE_DIR/bpwatch.json export BPWATCH_STORE_PATH=$CACHE_DIR/bpwatch.json
BUILDPACK_VERSION=v28
# Support Anvil Build_IDs
[ ! "$REQUEST_ID" ] && REQUEST_ID=$SLUG_ID [ ! "$REQUEST_ID" ] && REQUEST_ID=$SLUG_ID
# Sanitizing environment variables.
unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH
bpwatch init $LOGPLEX_KEY bpwatch init $LOGPLEX_KEY
bpwatch build python $BUILDPACK_VERSION $REQUEST_ID bpwatch build python $BUILDPACK_VERSION $REQUEST_ID
@@ -48,9 +49,6 @@ TMP_APP_DIR=$CACHE_DIR/tmp_app_dir
bpwatch start compile bpwatch start compile
# Sanitizing environment variables.
unset GIT_DIR PYTHONHOME PYTHONPATH LD_LIBRARY_PATH LIBRARY_PATH
# We'll need to send these statics to other scripts we `source`. # We'll need to send these statics to other scripts we `source`.
export BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH export BUILD_DIR CACHE_DIR BIN_DIR PROFILE_PATH
@@ -63,13 +61,17 @@ TMP_APP_DIR=$CACHE_DIR/tmp_app_dir
# Copy Anvil app dir to temporary storage... # Copy Anvil app dir to temporary storage...
bpwatch start anvil_appdir_stage bpwatch start anvil_appdir_stage
mkdir -p $TMP_APP_DIR if [ "$SLUG_ID" ]; then
deep-mv $APP_DIR $TMP_APP_DIR mkdir -p $TMP_APP_DIR
deep-mv $APP_DIR $TMP_APP_DIR
else
deep-rm $APP_DIR
fi
bpwatch stop anvil_appdir_stage bpwatch stop anvil_appdir_stage
# Copy Application code in. # Copy Application code in.
bpwatch start appdir_stage bpwatch start appdir_stage
deep-mv $BUILD_DIR $APP_DIR deep-mv $BUILD_DIR $APP_DIR
bpwatch stop appdir_stage bpwatch stop appdir_stage
# Set new context. # Set new context.
@@ -77,18 +79,21 @@ ORIG_BUILD_DIR=$BUILD_DIR
BUILD_DIR=$APP_DIR BUILD_DIR=$APP_DIR
# Prepend proper path buildpack use. # Prepend proper path buildpack use.
export PATH=$BUILD_DIR/.heroku/python/bin:$PATH export PATH=$BUILD_DIR/.heroku/python/bin:$BUILD_DIR/.heroku/vendor/bin:$PATH
export PYTHONUNBUFFERED=1 export PYTHONUNBUFFERED=1
export LANG=en_US.UTF-8 export LANG=en_US.UTF-8
export LIBRARY_PATH=/app/.heroku/vendor/lib export C_INCLUDE_PATH=/app/.heroku/vendor/include:$BUILD_DIR/.heroku/vendor/include
export LD_LIBRARY_PATH=/app/.heroku/vendor/lib export CPLUS_INCLUDE_PATH=/app/.heroku/vendor/include:$BUILD_DIR/.heroku/vendor/include
export LIBRARY_PATH=/app/.heroku/vendor/lib:$BUILD_DIR/.heroku/vendor/lib
export LD_LIBRARY_PATH=/app/.heroku/vendor/lib:$BUILD_DIR/.heroku/vendor/lib
export PKG_CONFIG_PATH=/app/.heroku/vendor/lib/pkg-config:$BUILD_DIR/.heroku/vendor/lib/pkg-config
# Switch to the repo's context. # Switch to the repo's context.
cd $BUILD_DIR cd $BUILD_DIR
# Experimental pre_compile hook. # Experimental pre_compile hook.
bpwatch start pre_compile bpwatch start pre_compile
source $BIN_DIR/steps/hooks/pre_compile source $BIN_DIR/steps/hooks/pre_compile
bpwatch stop pre_compile bpwatch stop pre_compile
# If no requirements given, assume `setup.py develop`. # If no requirements given, assume `setup.py develop`.
@@ -97,6 +102,11 @@ if [ ! -f requirements.txt ]; then
echo "-e ." > requirements.txt echo "-e ." > requirements.txt
fi fi
# Sticky runtimes.
if [ -f $CACHE_DIR/.heroku/python-version ]; then
DEFAULT_PYTHON_VERSION=$(cat $CACHE_DIR/.heroku/python-version)
fi
# If no runtime given, assume default version. # If no runtime given, assume default version.
if [ ! -f runtime.txt ]; then if [ ! -f runtime.txt ]; then
puts-step "No runtime.txt provided; assuming $DEFAULT_PYTHON_VERSION." puts-step "No runtime.txt provided; assuming $DEFAULT_PYTHON_VERSION."
@@ -108,15 +118,15 @@ mkdir -p $CACHE_DIR
# Purge "old-style" virtualenvs. # Purge "old-style" virtualenvs.
bpwatch start clear_old_venvs bpwatch start clear_old_venvs
[ -d $CACHE_DIR/$LEGACY_TRIGGER ] && rm -fr $CACHE_DIR/.heroku/bin $CACHE_DIR/.heroku/lib $CACHE_DIR/.heroku/include [ -d $CACHE_DIR/$LEGACY_TRIGGER ] && rm -fr $CACHE_DIR/.heroku/bin $CACHE_DIR/.heroku/lib $CACHE_DIR/.heroku/include
[ -d $CACHE_DIR/$VIRTUALENV_LOC ] && rm -fr $CACHE_DIR/.heroku/venv $CACHE_DIR/.heroku/src [ -d $CACHE_DIR/$VIRTUALENV_LOC ] && rm -fr $CACHE_DIR/.heroku/venv $CACHE_DIR/.heroku/src
bpwatch stop clear_old_venvs bpwatch stop clear_old_venvs
# Restore old artifacts from the cache. # Restore old artifacts from the cache.
bpwatch start restore_cache bpwatch start restore_cache
for dir in $CACHED_DIRS; do for dir in $CACHED_DIRS; do
cp -R $CACHE_DIR/$dir . &> /dev/null || true cp -R $CACHE_DIR/$dir . &> /dev/null || true
done done
bpwatch stop restore_cache bpwatch stop restore_cache
set +e set +e
@@ -133,8 +143,8 @@ PYTHON_VERSION=$(cat runtime.txt)
if [ -f .heroku/python-version ]; then if [ -f .heroku/python-version ]; then
if [ ! $(cat .heroku/python-version) = $PYTHON_VERSION ]; then if [ ! $(cat .heroku/python-version) = $PYTHON_VERSION ]; then
bpwatch start uninstall_python bpwatch start uninstall_python
puts-step "Found $(cat .heroku/python-version), removing." puts-step "Found $(cat .heroku/python-version), removing."
rm -fr .heroku/python rm -fr .heroku/python
bpwatch stop uninstall_python bpwatch stop uninstall_python
else else
SKIP_INSTALL=1 SKIP_INSTALL=1
@@ -144,14 +154,14 @@ fi
if [ ! "$SKIP_INSTALL" ]; then if [ ! "$SKIP_INSTALL" ]; then
bpwatch start install_python bpwatch start install_python
puts-step "Preparing Python runtime ($PYTHON_VERSION)" puts-step "Preparing Python runtime ($PYTHON_VERSION)"
curl http://envy-versions.s3.amazonaws.com/$PYTHON_VERSION.tar.bz2 -s | tar jx &> /dev/null curl http://envy-versions.s3.amazonaws.com/$PYTHON_VERSION.tar.bz2 -s | tar jx &> /dev/null
if [[ $? != 0 ]] ; then if [[ $? != 0 ]] ; then
puts-warn "Requested runtime ($PYTHON_VERSION) was not found." puts-warn "Requested runtime ($PYTHON_VERSION) was not found."
puts-warn "Aborting. More info: https://devcenter.heroku.com/articles/python-support" puts-warn "Aborting. More info: https://devcenter.heroku.com/articles/python-support"
exit 1 exit 1
fi fi
mv python .heroku/python mv python .heroku/python
bpwatch stop install_python bpwatch stop install_python
# Record for future reference. # Record for future reference.
@@ -169,19 +179,19 @@ if [ "$FRESH_PYTHON" ] || [[ ! $(pip --version) == *$PIP_VERSION* ]]; then
bpwatch start prepare_environment bpwatch start prepare_environment
bpwatch start install_distribute bpwatch start install_setuptools
# Prepare it for the real world # Prepare it for the real world
puts-step "Installing Distribute ($DISTRIBUTE_VERSION)" puts-step "Installing Setuptools ($SETUPTOOLS_VERSION)"
cd $ROOT_DIR/vendor/distribute-$DISTRIBUTE_VERSION/ cd $ROOT_DIR/vendor/setuptools-$SETUPTOOLS_VERSION/
python setup.py install &> /dev/null python setup.py install &> /dev/null
cd $WORKING_DIR cd $WORKING_DIR
bpwatch stop install_distribute bpwatch stop install_setuptoools
bpwatch start install_pip bpwatch start install_pip
puts-step "Installing Pip ($PIP_VERSION)" puts-step "Installing Pip ($PIP_VERSION)"
cd $ROOT_DIR/vendor/pip-$PIP_VERSION/ cd $ROOT_DIR/vendor/pip-$PIP_VERSION/
python setup.py install &> /dev/null python setup.py install &> /dev/null
cd $WORKING_DIR cd $WORKING_DIR
bpwatch stop install_pip bpwatch stop install_pip
bpwatch stop prepare_environment bpwatch stop prepare_environment
@@ -193,13 +203,13 @@ hash -r
# Pylibmc support. # Pylibmc support.
# See [`bin/steps/pylibmc`](pylibmc.html). # See [`bin/steps/pylibmc`](pylibmc.html).
bpwatch start pylibmc_install bpwatch start pylibmc_install
source $BIN_DIR/steps/pylibmc source $BIN_DIR/steps/pylibmc
bpwatch stop pylibmc_install bpwatch stop pylibmc_install
# Install Mercurial if it appears to be required. # Install Mercurial if it appears to be required.
if (grep -Fiq "hg+" requirements.txt) then if (grep -Fiq "hg+" requirements.txt) then
bpwatch start mercurial_install bpwatch start mercurial_install
/app/.heroku/python/bin/pip install --use-mirrors mercurial | cleanup | indent /app/.heroku/python/bin/pip install mercurial | cleanup | indent
bpwatch stop mercurial_install bpwatch stop mercurial_install
fi fi
@@ -210,14 +220,14 @@ puts-step "Installing dependencies using Pip ($PIP_VERSION)"
[ ! "$FRESH_PYTHON" ] && bpwatch start pip_install [ ! "$FRESH_PYTHON" ] && bpwatch start pip_install
[ "$FRESH_PYTHON" ] && bpwatch start pip_install_first [ "$FRESH_PYTHON" ] && bpwatch start pip_install_first
/app/.heroku/python/bin/pip install --use-mirrors -r requirements.txt --exists-action=w --src=./.heroku/src | cleanup | indent /app/.heroku/python/bin/pip install -r requirements.txt --exists-action=w --src=./.heroku/src --allow-all-external | cleanup | indent
[ ! "$FRESH_PYTHON" ] && bpwatch stop pip_install [ ! "$FRESH_PYTHON" ] && bpwatch stop pip_install
[ "$FRESH_PYTHON" ] && bpwatch stop pip_install_first [ "$FRESH_PYTHON" ] && bpwatch stop pip_install_first
# Django collectstatic support. # Django collectstatic support.
bpwatch start collectstatic bpwatch start collectstatic
source $BIN_DIR/steps/collectstatic sub-env $BIN_DIR/steps/collectstatic
bpwatch stop collectstatic bpwatch stop collectstatic
# ### Finalize # ### Finalize
@@ -236,24 +246,26 @@ set-default-env PYTHONPATH /app/
# Experimental post_compile hook. # Experimental post_compile hook.
bpwatch start post_compile bpwatch start post_compile
source $BIN_DIR/steps/hooks/post_compile source $BIN_DIR/steps/hooks/post_compile
bpwatch stop post_compile bpwatch stop post_compile
# Store new artifacts in cache. # Store new artifacts in cache.
bpwatch start dump_cache bpwatch start dump_cache
for dir in $CACHED_DIRS; do for dir in $CACHED_DIRS; do
rm -rf $CACHE_DIR/$dir rm -rf $CACHE_DIR/$dir
cp -R $dir $CACHE_DIR/ cp -R $dir $CACHE_DIR/
done done
bpwatch stop dump_cache bpwatch stop dump_cache
# ### Fin. # ### Fin.
bpwatch start appdir_commit bpwatch start appdir_commit
deep-mv $BUILD_DIR $ORIG_BUILD_DIR deep-mv $BUILD_DIR $ORIG_BUILD_DIR
bpwatch stop appdir_commit bpwatch stop appdir_commit
bpwatch start anvil_appdir_commit bpwatch start anvil_appdir_commit
deep-mv $TMP_APP_DIR $APP_DIR if [ "$SLUG_ID" ]; then
bpwatch stop anvil_appdir_commit deep-mv $TMP_APP_DIR $APP_DIR
fi
bpwatch stop anvil_appdir_commit
bpwatch stop compile bpwatch stop compile
+1 -1
View File
@@ -18,6 +18,6 @@ if [[ $MANAGE_FILE ]]; then
cat <<EOF cat <<EOF
addons: addons:
heroku-postgresql:dev heroku-postgresql:hobby-dev
EOF EOF
fi fi
Regular → Executable
+7 -7
View File
@@ -1,10 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Syntax sugar. source $BIN_DIR/utils
indent() {
RE="s/^/ /"
[ $(uname) == "Darwin" ] && sed -l "$RE" || sed -u "$RE"
}
MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1) MANAGE_FILE=$(find . -maxdepth 3 -type f -name 'manage.py' | head -1)
MANAGE_FILE=${MANAGE_FILE:-fakepath} MANAGE_FILE=${MANAGE_FILE:-fakepath}
@@ -14,19 +10,23 @@ MANAGE_FILE=${MANAGE_FILE:-fakepath}
if [ ! "$DISABLE_COLLECTSTATIC" ] && [ -f "$MANAGE_FILE" ]; then if [ ! "$DISABLE_COLLECTSTATIC" ] && [ -f "$MANAGE_FILE" ]; then
set +e set +e
echo "-----> Preparing static assets"
# Check if collectstatic is configured properly. # Check if collectstatic is configured properly.
python $MANAGE_FILE collectstatic --dry-run --noinput &> /dev/null && RUN_COLLECTSTATIC=true python $MANAGE_FILE collectstatic --dry-run --noinput &> /dev/null && RUN_COLLECTSTATIC=true
# Compile assets if collectstatic appears to be kosher. # Compile assets if collectstatic appears to be kosher.
if [ "$RUN_COLLECTSTATIC" ]; then if [ "$RUN_COLLECTSTATIC" ]; then
echo "-----> Collecting static files" echo " Running collectstatic..."
python $MANAGE_FILE collectstatic --noinput 2>&1 | sed '/^Copying/d;/^$/d;/^ /d' | indent python $MANAGE_FILE collectstatic --noinput 2>&1 | sed '/^Copying/d;/^$/d;/^ /d' | indent
[ $? -ne 0 ] && { [ $? -ne 0 ] && {
echo " ! Error running manage.py collectstatic. More info:" echo " ! Error running 'manage.py collectstatic'. More info:"
echo " http://devcenter.heroku.com/articles/django-assets" echo " http://devcenter.heroku.com/articles/django-assets"
} }
else
echo " Collectstatic configuration error. To debug, run:"
echo " $ heroku run python $MANAGE_FILE collectstatic --noinput"
fi fi
echo echo
Regular → Executable
+1 -1
View File
@@ -3,5 +3,5 @@
if [ -f bin/post_compile ]; then if [ -f bin/post_compile ]; then
echo "-----> Running post-compile hook" echo "-----> Running post-compile hook"
chmod +x bin/post_compile chmod +x bin/post_compile
bin/post_compile sub-env bin/post_compile
fi fi
Regular → Executable
+1 -1
View File
@@ -3,5 +3,5 @@
if [ -f bin/pre_compile ]; then if [ -f bin/pre_compile ]; then
echo "-----> Running pre-compile hook" echo "-----> Running pre-compile hook"
chmod +x bin/pre_compile chmod +x bin/pre_compile
bin/pre_compile sub-env bin/pre_compile
fi fi
+1 -1
View File
@@ -2,7 +2,7 @@
# #
# Create a Heroku app with the following buildpack: # Create a Heroku app with the following buildpack:
# https://github.com/ddollar/buildpack-tet # https://github.com/ddollar/buildpack-test
# #
# Push this Python buildpack to that Heroku app to # Push this Python buildpack to that Heroku app to
# run the tests. # run the tests.
+57 -18
View File
@@ -1,54 +1,93 @@
shopt -s extglob shopt -s extglob
[ $(uname) == "Darwin" ] && SED_FLAG='-l' || SED_FLAG='-u' if [ $(uname) == Darwin ]; then
sed() { command sed -l "$@"; }
else
sed() { command sed -u "$@"; }
fi
# Syntax sugar. # Syntax sugar.
indent() { indent() {
RE="s/^/ /" sed "s/^/ /"
sed $SED_FLAG "$RE"
} }
# Clean up pip output # Clean up pip output
cleanup() { cleanup() {
sed $SED_FLAG -e 's/\.\.\.\+/.../g' | sed $SED_FLAG '/already satisfied/Id' | sed $SED_FLAG -e '/Overwriting/Id' | sed $SED_FLAG -e '/python executable/Id' | sed $SED_FLAG -e '/no previously-included files/Id' sed -e 's/\.\.\.\+/.../g' | sed -e '/already satisfied/Id' | sed -e '/Overwriting/Id' | sed -e '/python executable/Id' | sed -e '/no previously-included files/Id'
} }
# Buildpack Steps. # Buildpack Steps.
function puts-step (){ puts-step() {
echo "-----> $@" echo "-----> $@"
} }
# Buildpack Warnings. # Buildpack Warnings.
function puts-warn (){ puts-warn() {
echo " ! $@" echo " ! $@"
} }
# Usage: $ set-env key value # Usage: $ set-env key value
function set-env (){ set-env() {
echo "export $1=$2" >> $PROFILE_PATH echo "export $1=$2" >> $PROFILE_PATH
} }
# Usage: $ set-default-env key value # Usage: $ set-default-env key value
function set-default-env (){ set-default-env() {
echo "export $1=\${$1:-$2}" >> $PROFILE_PATH echo "export $1=\${$1:-$2}" >> $PROFILE_PATH
} }
# Usage: $ set-default-env key value # Usage: $ set-default-env key value
function un-set-env (){ un-set-env() {
echo "unset $1" >> $PROFILE_PATH echo "unset $1" >> $PROFILE_PATH
} }
# Does some serious copying. # Does some serious copying.
function deep-cp (){ deep-cp() {
find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec cp -a '{}' $2 \; declare source="$1" target="$2"
cp -r $1/!(tmp) $2
# echo copying $1 to $2 mkdir -p "$target"
# cp doesn't like being called without source params,
# so make sure they expand to something first.
# subshell to avoid surprising caller with shopts.
(
shopt -s nullglob dotglob
set -- "$source"/!(tmp|.|..)
[[ $# == 0 ]] || cp -a "$@" "$target"
)
} }
# Does some serious moving. # Does some serious moving.
function deep-mv (){ deep-mv() {
deep-cp $1 $2 deep-cp "$1" "$2"
deep-rm "$1"
rm -fr $1/!(tmp) }
find -H $1 -maxdepth 1 -name '.*' -a \( -type d -o -type f -o -type l \) -exec rm -fr '{}' \;
# Does some serious deleting.
deep-rm() {
# subshell to avoid surprising caller with shopts.
(
shopt -s dotglob
rm -rf "$1"/!(tmp|.|..)
)
}
sub-env() {
WHITELIST=${2:-''}
BLACKLIST=${3:-'^(GIT_DIR|PYTHONHOME|PYTHONPATH|LD_LIBRARY_PATH|LIBRARY_PATH|PATH)$'}
(
if [ -d "$ENV_DIR" ]; then
for e in $(ls $ENV_DIR); do
echo "$e" | grep -E "$WHITELIST" | grep -qvE "$BLACKLIST" &&
export "$e=$(cat $ENV_DIR/$e)"
:
done
fi
$1
)
} }
+2 -1
View File
@@ -1 +1,2 @@
httpbin requests
distribute==0.6.49
+1 -1
View File
@@ -1 +1 @@
python-2.7.3 python-3.3.2
+4 -4
View File
@@ -1,14 +1,14 @@
#!/usr/local/bin/python #!/usr/bin/env python2
import os import os
import sys import sys
DEFUALT_PATH = '{}.zip'.format(os.path.abspath(__file__)) DEFAULT_PATH = '{0}.zip'.format(os.path.abspath(__file__))
BPWATCH_DISTRO_PATH = os.environ.get('BPWATCH_DISTRO_PATH', DEFUALT_PATH) BPWATCH_DISTRO_PATH = os.environ.get('BPWATCH_DISTRO_PATH', DEFAULT_PATH)
sys.path.insert(0, BPWATCH_DISTRO_PATH) sys.path.insert(0, BPWATCH_DISTRO_PATH)
import bp_cli import bp_cli
bp_cli.main() bp_cli.main()
BIN
View File
Binary file not shown.
-509
View File
@@ -1,509 +0,0 @@
=======
CHANGES
=======
------
0.6.36
------
* Pull Request #35: In `Buildout issue 64
<https://github.com/buildout/buildout/issues/64>`_, it was reported that
under Python 3, installation of distutils scripts could attempt to copy
the ``__pycache__`` directory as a file, causing an error, apparently only
under Windows. Easy_install now skips all directories when processing
metadata scripts.
------
0.6.35
------
Note this release is backward-incompatible with distribute 0.6.23-0.6.34 in
how it parses version numbers.
* Issue #278: Restored compatibility with distribute 0.6.22 and setuptools
0.6. Updated the documentation to match more closely with the version
parsing as intended in setuptools 0.6.
------
0.6.34
------
* Issue #341: 0.6.33 fails to build under Python 2.4.
------
0.6.33
------
* Fix 2 errors with Jython 2.5.
* Fix 1 failure with Jython 2.5 and 2.7.
* Disable workaround for Jython scripts on Linux systems.
* Issue #336: `setup.py` no longer masks failure exit code when tests fail.
* Fix issue in pkg_resources where try/except around a platform-dependent
import would trigger hook load failures on Mercurial. See pull request 32
for details.
* Issue #341: Fix a ResourceWarning.
------
0.6.32
------
* Fix test suite with Python 2.6.
* Fix some DeprecationWarnings and ResourceWarnings.
* Issue #335: Backed out `setup_requires` superceding installed requirements
until regression can be addressed.
------
0.6.31
------
* Issue #303: Make sure the manifest only ever contains UTF-8 in Python 3.
* Issue #329: Properly close files created by tests for compatibility with
Jython.
* Work around Jython bugs `#1980 <http://bugs.jython.org/issue1980>`_ and
`#1981 <http://bugs.jython.org/issue1981>`_.
* Issue #334: Provide workaround for packages that reference `sys.__stdout__`
such as numpy does. This change should address
`virtualenv #359 <https://github.com/pypa/virtualenv/issues/359>`_ as long
as the system encoding is UTF-8 or the IO encoding is specified in the
environment, i.e.::
PYTHONIOENCODING=utf8 pip install numpy
* Fix for encoding issue when installing from Windows executable on Python 3.
* Issue #323: Allow `setup_requires` requirements to supercede installed
requirements. Added some new keyword arguments to existing pkg_resources
methods. Also had to updated how __path__ is handled for namespace packages
to ensure that when a new egg distribution containing a namespace package is
placed on sys.path, the entries in __path__ are found in the same order they
would have been in had that egg been on the path when pkg_resources was
first imported.
------
0.6.30
------
* Issue #328: Clean up temporary directories in distribute_setup.py.
* Fix fatal bug in distribute_setup.py.
------
0.6.29
------
* Pull Request #14: Honor file permissions in zip files.
* Issue #327: Merged pull request #24 to fix a dependency problem with pip.
* Merged pull request #23 to fix https://github.com/pypa/virtualenv/issues/301.
* If Sphinx is installed, the `upload_docs` command now runs `build_sphinx`
to produce uploadable documentation.
* Issue #326: `upload_docs` provided mangled auth credentials under Python 3.
* Issue #320: Fix check for "createable" in distribute_setup.py.
* Issue #305: Remove a warning that was triggered during normal operations.
* Issue #311: Print metadata in UTF-8 independent of platform.
* Issue #303: Read manifest file with UTF-8 encoding under Python 3.
* Issue #301: Allow to run tests of namespace packages when using 2to3.
* Issue #304: Prevent import loop in site.py under Python 3.3.
* Issue #283: Reenable scanning of `*.pyc` / `*.pyo` files on Python 3.3.
* Issue #299: The develop command didn't work on Python 3, when using 2to3,
as the egg link would go to the Python 2 source. Linking to the 2to3'd code
in build/lib makes it work, although you will have to rebuild the module
before testing it.
* Issue #306: Even if 2to3 is used, we build in-place under Python 2.
* Issue #307: Prints the full path when .svn/entries is broken.
* Issue #313: Support for sdist subcommands (Python 2.7)
* Issue #314: test_local_index() would fail an OS X.
* Issue #310: Non-ascii characters in a namespace __init__.py causes errors.
* Issue #218: Improved documentation on behavior of `package_data` and
`include_package_data`. Files indicated by `package_data` are now included
in the manifest.
* `distribute_setup.py` now allows a `--download-base` argument for retrieving
distribute from a specified location.
------
0.6.28
------
* Issue #294: setup.py can now be invoked from any directory.
* Scripts are now installed honoring the umask.
* Added support for .dist-info directories.
* Issue #283: Fix and disable scanning of `*.pyc` / `*.pyo` files on
Python 3.3.
------
0.6.27
------
* Support current snapshots of CPython 3.3.
* Distribute now recognizes README.rst as a standard, default readme file.
* Exclude 'encodings' modules when removing modules from sys.modules.
Workaround for #285.
* Issue #231: Don't fiddle with system python when used with buildout
(bootstrap.py)
------
0.6.26
------
* Issue #183: Symlinked files are now extracted from source distributions.
* Issue #227: Easy_install fetch parameters are now passed during the
installation of a source distribution; now fulfillment of setup_requires
dependencies will honor the parameters passed to easy_install.
------
0.6.25
------
* Issue #258: Workaround a cache issue
* Issue #260: distribute_setup.py now accepts the --user parameter for
Python 2.6 and later.
* Issue #262: package_index.open_with_auth no longer throws LookupError
on Python 3.
* Issue #269: AttributeError when an exception occurs reading Manifest.in
on late releases of Python.
* Issue #272: Prevent TypeError when namespace package names are unicode
and single-install-externally-managed is used. Also fixes PIP issue
449.
* Issue #273: Legacy script launchers now install with Python2/3 support.
------
0.6.24
------
* Issue #249: Added options to exclude 2to3 fixers
------
0.6.23
------
* Issue #244: Fixed a test
* Issue #243: Fixed a test
* Issue #239: Fixed a test
* Issue #240: Fixed a test
* Issue #241: Fixed a test
* Issue #237: Fixed a test
* Issue #238: easy_install now uses 64bit executable wrappers on 64bit Python
* Issue #208: Fixed parsed_versions, it now honors post-releases as noted in the documentation
* Issue #207: Windows cli and gui wrappers pass CTRL-C to child python process
* Issue #227: easy_install now passes its arguments to setup.py bdist_egg
* Issue #225: Fixed a NameError on Python 2.5, 2.4
------
0.6.21
------
* Issue #225: FIxed a regression on py2.4
------
0.6.20
------
* Issue #135: Include url in warning when processing URLs in package_index.
* Issue #212: Fix issue where easy_instal fails on Python 3 on windows installer.
* Issue #213: Fix typo in documentation.
------
0.6.19
------
* Issue 206: AttributeError: 'HTTPMessage' object has no attribute 'getheaders'
------
0.6.18
------
* Issue 210: Fixed a regression introduced by Issue 204 fix.
------
0.6.17
------
* Support 'DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT' environment
variable to allow to disable installation of easy_install-${version} script.
* Support Python >=3.1.4 and >=3.2.1.
* Issue 204: Don't try to import the parent of a namespace package in
declare_namespace
* Issue 196: Tolerate responses with multiple Content-Length headers
* Issue 205: Sandboxing doesn't preserve working_set. Leads to setup_requires
problems.
------
0.6.16
------
* Builds sdist gztar even on Windows (avoiding Issue 193).
* Issue 192: Fixed metadata omitted on Windows when package_dir
specified with forward-slash.
* Issue 195: Cython build support.
* Issue 200: Issues with recognizing 64-bit packages on Windows.
------
0.6.15
------
* Fixed typo in bdist_egg
* Several issues under Python 3 has been solved.
* Issue 146: Fixed missing DLL files after easy_install of windows exe package.
------
0.6.14
------
* Issue 170: Fixed unittest failure. Thanks to Toshio.
* Issue 171: Fixed race condition in unittests cause deadlocks in test suite.
* Issue 143: Fixed a lookup issue with easy_install.
Thanks to David and Zooko.
* Issue 174: Fixed the edit mode when its used with setuptools itself
------
0.6.13
------
* Issue 160: 2.7 gives ValueError("Invalid IPv6 URL")
* Issue 150: Fixed using ~/.local even in a --no-site-packages virtualenv
* Issue 163: scan index links before external links, and don't use the md5 when
comparing two distributions
------
0.6.12
------
* Issue 149: Fixed various failures on 2.3/2.4
------
0.6.11
------
* Found another case of SandboxViolation - fixed
* Issue 15 and 48: Introduced a socket timeout of 15 seconds on url openings
* Added indexsidebar.html into MANIFEST.in
* Issue 108: Fixed TypeError with Python3.1
* Issue 121: Fixed --help install command trying to actually install.
* Issue 112: Added an os.makedirs so that Tarek's solution will work.
* Issue 133: Added --no-find-links to easy_install
* Added easy_install --user
* Issue 100: Fixed develop --user not taking '.' in PYTHONPATH into account
* Issue 134: removed spurious UserWarnings. Patch by VanLindberg
* Issue 138: cant_write_to_target error when setup_requires is used.
* Issue 147: respect the sys.dont_write_bytecode flag
------
0.6.10
------
* Reverted change made for the DistributionNotFound exception because
zc.buildout uses the exception message to get the name of the
distribution.
-----
0.6.9
-----
* Issue 90: unknown setuptools version can be added in the working set
* Issue 87: setupt.py doesn't try to convert distribute_setup.py anymore
Initial Patch by arfrever.
* Issue 89: added a side bar with a download link to the doc.
* Issue 86: fixed missing sentence in pkg_resources doc.
* Added a nicer error message when a DistributionNotFound is raised.
* Issue 80: test_develop now works with Python 3.1
* Issue 93: upload_docs now works if there is an empty sub-directory.
* Issue 70: exec bit on non-exec files
* Issue 99: now the standalone easy_install command doesn't uses a
"setup.cfg" if any exists in the working directory. It will use it
only if triggered by ``install_requires`` from a setup.py call
(install, develop, etc).
* Issue 101: Allowing ``os.devnull`` in Sandbox
* Issue 92: Fixed the "no eggs" found error with MacPort
(platform.mac_ver() fails)
* Issue 103: test_get_script_header_jython_workaround not run
anymore under py3 with C or POSIX local. Contributed by Arfrever.
* Issue 104: remvoved the assertion when the installation fails,
with a nicer message for the end user.
* Issue 100: making sure there's no SandboxViolation when
the setup script patches setuptools.
-----
0.6.8
-----
* Added "check_packages" in dist. (added in Setuptools 0.6c11)
* Fixed the DONT_PATCH_SETUPTOOLS state.
-----
0.6.7
-----
* Issue 58: Added --user support to the develop command
* Issue 11: Generated scripts now wrap their call to the script entry point
in the standard "if name == 'main'"
* Added the 'DONT_PATCH_SETUPTOOLS' environment variable, so virtualenv
can drive an installation that doesn't patch a global setuptools.
* Reviewed unladen-swallow specific change from
http://code.google.com/p/unladen-swallow/source/detail?spec=svn875&r=719
and determined that it no longer applies. Distribute should work fine with
Unladen Swallow 2009Q3.
* Issue 21: Allow PackageIndex.open_url to gracefully handle all cases of a
httplib.HTTPException instead of just InvalidURL and BadStatusLine.
* Removed virtual-python.py from this distribution and updated documentation
to point to the actively maintained virtualenv instead.
* Issue 64: use_setuptools no longer rebuilds the distribute egg every
time it is run
* use_setuptools now properly respects the requested version
* use_setuptools will no longer try to import a distribute egg for the
wrong Python version
* Issue 74: no_fake should be True by default.
* Issue 72: avoid a bootstrapping issue with easy_install -U
-----
0.6.6
-----
* Unified the bootstrap file so it works on both py2.x and py3k without 2to3
(patch by Holger Krekel)
-----
0.6.5
-----
* Issue 65: cli.exe and gui.exe are now generated at build time,
depending on the platform in use.
* Issue 67: Fixed doc typo (PEP 381/382)
* Distribute no longer shadows setuptools if we require a 0.7-series
setuptools. And an error is raised when installing a 0.7 setuptools with
distribute.
* When run from within buildout, no attempt is made to modify an existing
setuptools egg, whether in a shared egg directory or a system setuptools.
* Fixed a hole in sandboxing allowing builtin file to write outside of
the sandbox.
-----
0.6.4
-----
* Added the generation of `distribute_setup_3k.py` during the release.
This closes issue #52.
* Added an upload_docs command to easily upload project documentation to
PyPI's http://packages.python.org. This close issue #56.
* Fixed a bootstrap bug on the use_setuptools() API.
-----
0.6.3
-----
setuptools
==========
* Fixed a bunch of calls to file() that caused crashes on Python 3.
bootstrapping
=============
* Fixed a bug in sorting that caused bootstrap to fail on Python 3.
-----
0.6.2
-----
setuptools
==========
* Added Python 3 support; see docs/python3.txt.
This closes http://bugs.python.org/setuptools/issue39.
* Added option to run 2to3 automatically when installing on Python 3.
This closes issue #31.
* Fixed invalid usage of requirement.parse, that broke develop -d.
This closes http://bugs.python.org/setuptools/issue44.
* Fixed script launcher for 64-bit Windows.
This closes http://bugs.python.org/setuptools/issue2.
* KeyError when compiling extensions.
This closes http://bugs.python.org/setuptools/issue41.
bootstrapping
=============
* Fixed bootstrap not working on Windows. This closes issue #49.
* Fixed 2.6 dependencies. This closes issue #50.
* Make sure setuptools is patched when running through easy_install
This closes http://bugs.python.org/setuptools/issue40.
-----
0.6.1
-----
setuptools
==========
* package_index.urlopen now catches BadStatusLine and malformed url errors.
This closes issue #16 and issue #18.
* zip_ok is now False by default. This closes
http://bugs.python.org/setuptools/issue33.
* Fixed invalid URL error catching. http://bugs.python.org/setuptools/issue20.
* Fixed invalid bootstraping with easy_install installation (issue #40).
Thanks to Florian Schulze for the help.
* Removed buildout/bootstrap.py. A new repository will create a specific
bootstrap.py script.
bootstrapping
=============
* The boostrap process leave setuptools alone if detected in the system
and --root or --prefix is provided, but is not in the same location.
This closes issue #10.
---
0.6
---
setuptools
==========
* Packages required at build time where not fully present at install time.
This closes issue #12.
* Protected against failures in tarfile extraction. This closes issue #10.
* Made Jython api_tests.txt doctest compatible. This closes issue #7.
* sandbox.py replaced builtin type file with builtin function open. This
closes issue #6.
* Immediately close all file handles. This closes issue #3.
* Added compatibility with Subversion 1.6. This references issue #1.
pkg_resources
=============
* Avoid a call to /usr/bin/sw_vers on OSX and use the official platform API
instead. Based on a patch from ronaldoussoren. This closes issue #5.
* Fixed a SandboxViolation for mkdir that could occur in certain cases.
This closes issue #13.
* Allow to find_on_path on systems with tight permissions to fail gracefully.
This closes issue #9.
* Corrected inconsistency between documentation and code of add_entry.
This closes issue #8.
* Immediately close all file handles. This closes issue #3.
easy_install
============
* Immediately close all file handles. This closes issue #3.
-883
View File
@@ -1,883 +0,0 @@
Metadata-Version: 1.1
Name: distribute
Version: 0.6.36
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: http://packages.python.org/distribute
Author: The fellowship of the packaging
Author-email: distutils-sig@python.org
License: PSF or ZPL
Description: ===============================
Installing and Using Distribute
===============================
.. contents:: **Table of Contents**
-----------
Disclaimers
-----------
About the fork
==============
`Distribute` is a fork of the `Setuptools` project.
Distribute is intended to replace Setuptools as the standard method
for working with Python module distributions.
The fork has two goals:
- Providing a backward compatible version to replace Setuptools
and make all distributions that depend on Setuptools work as
before, but with less bugs and behaviorial issues.
This work is done in the 0.6.x series.
Starting with version 0.6.2, Distribute supports Python 3.
Installing and using distribute for Python 3 code works exactly
the same as for Python 2 code, but Distribute also helps you to support
Python 2 and Python 3 from the same source code by letting you run 2to3
on the code as a part of the build process, by setting the keyword parameter
``use_2to3`` to True. See http://packages.python.org/distribute for more
information.
- Refactoring the code, and releasing it in several distributions.
This work is being done in the 0.7.x series but not yet released.
The roadmap is still evolving, and the page that is up-to-date is
located at : `http://packages.python.org/distribute/roadmap`.
If you install `Distribute` and want to switch back for any reason to
`Setuptools`, get to the `Uninstallation instructions`_ section.
More documentation
==================
You can get more information in the Sphinx-based documentation, located
at http://packages.python.org/distribute. This documentation includes the old
Setuptools documentation that is slowly replaced, and brand new content.
About the installation process
==============================
The `Distribute` installer modifies your installation by de-activating an
existing installation of `Setuptools` in a bootstrap process. This process
has been tested in various installation schemes and contexts but in case of a
bug during this process your Python installation might be left in a broken
state. Since all modified files and directories are copied before the
installation starts, you will be able to get back to a normal state by reading
the instructions in the `Uninstallation instructions`_ section.
In any case, it is recommended to save you `site-packages` directory before
you start the installation of `Distribute`.
-------------------------
Installation Instructions
-------------------------
Distribute is only released as a source distribution.
It can be installed using pip, and can be done so with the source tarball,
or by using the ``distribute_setup.py`` script provided online.
``distribute_setup.py`` is the simplest and preferred way on all systems.
distribute_setup.py
===================
Download
`distribute_setup.py <http://python-distribute.org/distribute_setup.py>`_
and execute it, using the Python interpreter of your choice.
If your shell has the ``curl`` program you can do::
$ curl -O http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
Notice this file is also provided in the source release.
pip
===
Run easy_install or pip::
$ pip install distribute
Source installation
===================
Download the source tarball, uncompress it, then run the install command::
$ curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz
$ tar -xzvf distribute-0.6.36.tar.gz
$ cd distribute-0.6.36
$ python setup.py install
---------------------------
Uninstallation Instructions
---------------------------
Like other distutils-based distributions, Distribute doesn't provide an
uninstaller yet. It's all done manually! We are all waiting for PEP 376
support in Python.
Distribute is installed in three steps:
1. it gets out of the way an existing installation of Setuptools
2. it installs a `fake` setuptools installation
3. it installs distribute
Distribute can be removed like this:
- remove the ``distribute*.egg`` file located in your site-packages directory
- remove the ``setuptools.pth`` file located in you site-packages directory
- remove the easy_install script located in you ``sys.prefix/bin`` directory
- remove the ``setuptools*.egg`` directory located in your site-packages directory,
if any.
If you want to get back to setuptools:
- reinstall setuptools using its instruction.
Lastly:
- remove the *.OLD.* directory located in your site-packages directory if any,
**once you have checked everything was working correctly again**.
-------------------------
Quick help for developers
-------------------------
To create an egg which is compatible with Distribute, use the same
practice as with Setuptools, e.g.::
from setuptools import setup
setup(...
)
To use `pkg_resources` to access data files in the egg, you should
require the Setuptools distribution explicitly::
from setuptools import setup
setup(...
install_requires=['setuptools']
)
Only if you need Distribute-specific functionality should you depend
on it explicitly. In this case, replace the Setuptools dependency::
from setuptools import setup
setup(...
install_requires=['distribute']
)
-----------
Install FAQ
-----------
- **Why is Distribute wrapping my Setuptools installation?**
Since Distribute is a fork, and since it provides the same package
and modules, it renames the existing Setuptools egg and inserts a
new one which merely wraps the Distribute code. This way, full
backwards compatibility is kept for packages which rely on the
Setuptools modules.
At the same time, packages can meet their dependency on Setuptools
without actually installing it (which would disable Distribute).
- **How does Distribute interact with virtualenv?**
Everytime you create a virtualenv it will install setuptools by default.
You either need to re-install Distribute in it right after or pass the
``--distribute`` option when creating it.
Once installed, your virtualenv will use Distribute transparently.
Although, if you have Setuptools installed in your system-wide Python,
and if the virtualenv you are in was generated without the `--no-site-packages`
option, the Distribute installation will stop.
You need in this case to build a virtualenv with the `--no-site-packages`
option or to install `Distribute` globally.
- **How does Distribute interacts with zc.buildout?**
You can use Distribute in your zc.buildout, with the --distribute option,
starting at zc.buildout 1.4.2::
$ python bootstrap.py --distribute
For previous zc.buildout versions, *the only thing* you need to do
is use the bootstrap at `http://python-distribute.org/bootstrap.py`. Run
that bootstrap and ``bin/buildout`` (and all other buildout-generated
scripts) will transparently use distribute instead of setuptools. You do
not need a specific buildout release.
A shared eggs directory is no problem (since 0.6.6): the setuptools egg is
left in place unmodified. So other buildouts that do not yet use the new
bootstrap continue to work just fine. And there is no need to list
``distribute`` somewhere in your eggs: using the bootstrap is enough.
The source code for the bootstrap script is located at
`http://bitbucket.org/tarek/buildout-distribute`.
-----------------------------
Feedback and getting involved
-----------------------------
- Mailing list: http://mail.python.org/mailman/listinfo/distutils-sig
- Issue tracker: http://bitbucket.org/tarek/distribute/issues/
- Code Repository: http://bitbucket.org/tarek/distribute
=======
CHANGES
=======
------
0.6.36
------
* Pull Request #35: In `Buildout `issue 64`_
<https://github.com/buildout/buildout/issues/64>`_, it was reported that
under Python 3, installation of distutils scripts could attempt to copy
the ``__pycache__`` directory as a file, causing an error, apparently only
under Windows. Easy_install now skips all directories when processing
metadata scripts.
------
0.6.35
------
Note this release is backward-incompatible with distribute 0.6.23-0.6.34 in
how it parses version numbers.
* `Issue #278`_: Restored compatibility with distribute 0.6.22 and setuptools
0.6. Updated the documentation to match more closely with the version
parsing as intended in setuptools 0.6.
------
0.6.34
------
* `Issue #341`_: 0.6.33 fails to build under Python 2.4.
------
0.6.33
------
* Fix 2 errors with Jython 2.5.
* Fix 1 failure with Jython 2.5 and 2.7.
* Disable workaround for Jython scripts on Linux systems.
* `Issue #336`_: `setup.py` no longer masks failure exit code when tests fail.
* Fix issue in pkg_resources where try/except around a platform-dependent
import would trigger hook load failures on Mercurial. See pull request 32
for details.
* `Issue #341`_: Fix a ResourceWarning.
------
0.6.32
------
* Fix test suite with Python 2.6.
* Fix some DeprecationWarnings and ResourceWarnings.
* `Issue #335`_: Backed out `setup_requires` superceding installed requirements
until regression can be addressed.
------
0.6.31
------
* `Issue #303`_: Make sure the manifest only ever contains UTF-8 in Python 3.
* `Issue #329`_: Properly close files created by tests for compatibility with
Jython.
* Work around Jython bugs `#1980 <http://bugs.jython.org/issue1980>`_ and
`#1981 <http://bugs.jython.org/issue1981>`_.
* `Issue #334`_: Provide workaround for packages that reference `sys.__stdout__`
such as numpy does. This change should address
`virtualenv #359 <https://github.com/pypa/virtualenv/issues/359>`_ as long
as the system encoding is UTF-8 or the IO encoding is specified in the
environment, i.e.::
PYTHONIOENCODING=utf8 pip install numpy
* Fix for encoding issue when installing from Windows executable on Python 3.
* `Issue #323`_: Allow `setup_requires` requirements to supercede installed
requirements. Added some new keyword arguments to existing pkg_resources
methods. Also had to updated how __path__ is handled for namespace packages
to ensure that when a new egg distribution containing a namespace package is
placed on sys.path, the entries in __path__ are found in the same order they
would have been in had that egg been on the path when pkg_resources was
first imported.
------
0.6.30
------
* `Issue #328`_: Clean up temporary directories in distribute_setup.py.
* Fix fatal bug in distribute_setup.py.
------
0.6.29
------
* Pull Request #14: Honor file permissions in zip files.
* `Issue #327`_: Merged pull request #24 to fix a dependency problem with pip.
* Merged pull request #23 to fix https://github.com/pypa/virtualenv/issues/301.
* If Sphinx is installed, the `upload_docs` command now runs `build_sphinx`
to produce uploadable documentation.
* `Issue #326`_: `upload_docs` provided mangled auth credentials under Python 3.
* `Issue #320`_: Fix check for "createable" in distribute_setup.py.
* `Issue #305`_: Remove a warning that was triggered during normal operations.
* `Issue #311`_: Print metadata in UTF-8 independent of platform.
* `Issue #303`_: Read manifest file with UTF-8 encoding under Python 3.
* `Issue #301`_: Allow to run tests of namespace packages when using 2to3.
* `Issue #304`_: Prevent import loop in site.py under Python 3.3.
* `Issue #283`_: Reenable scanning of `*.pyc` / `*.pyo` files on Python 3.3.
* `Issue #299`_: The develop command didn't work on Python 3, when using 2to3,
as the egg link would go to the Python 2 source. Linking to the 2to3'd code
in build/lib makes it work, although you will have to rebuild the module
before testing it.
* `Issue #306`_: Even if 2to3 is used, we build in-place under Python 2.
* `Issue #307`_: Prints the full path when .svn/entries is broken.
* `Issue #313`_: Support for sdist subcommands (Python 2.7)
* `Issue #314`_: test_local_index() would fail an OS X.
* `Issue #310`_: Non-ascii characters in a namespace __init__.py causes errors.
* `Issue #218`_: Improved documentation on behavior of `package_data` and
`include_package_data`. Files indicated by `package_data` are now included
in the manifest.
* `distribute_setup.py` now allows a `--download-base` argument for retrieving
distribute from a specified location.
------
0.6.28
------
* `Issue #294`_: setup.py can now be invoked from any directory.
* Scripts are now installed honoring the umask.
* Added support for .dist-info directories.
* `Issue #283`_: Fix and disable scanning of `*.pyc` / `*.pyo` files on
Python 3.3.
------
0.6.27
------
* Support current snapshots of CPython 3.3.
* Distribute now recognizes README.rst as a standard, default readme file.
* Exclude 'encodings' modules when removing modules from sys.modules.
Workaround for #285.
* `Issue #231`_: Don't fiddle with system python when used with buildout
(bootstrap.py)
------
0.6.26
------
* `Issue #183`_: Symlinked files are now extracted from source distributions.
* `Issue #227`_: Easy_install fetch parameters are now passed during the
installation of a source distribution; now fulfillment of setup_requires
dependencies will honor the parameters passed to easy_install.
------
0.6.25
------
* `Issue #258`_: Workaround a cache issue
* `Issue #260`_: distribute_setup.py now accepts the --user parameter for
Python 2.6 and later.
* `Issue #262`_: package_index.open_with_auth no longer throws LookupError
on Python 3.
* `Issue #269`_: AttributeError when an exception occurs reading Manifest.in
on late releases of Python.
* `Issue #272`_: Prevent TypeError when namespace package names are unicode
and single-install-externally-managed is used. Also fixes PIP `issue
449`_.
* `Issue #273`_: Legacy script launchers now install with Python2/3 support.
------
0.6.24
------
* `Issue #249`_: Added options to exclude 2to3 fixers
------
0.6.23
------
* `Issue #244`_: Fixed a test
* `Issue #243`_: Fixed a test
* `Issue #239`_: Fixed a test
* `Issue #240`_: Fixed a test
* `Issue #241`_: Fixed a test
* `Issue #237`_: Fixed a test
* `Issue #238`_: easy_install now uses 64bit executable wrappers on 64bit Python
* `Issue #208`_: Fixed parsed_versions, it now honors post-releases as noted in the documentation
* `Issue #207`_: Windows cli and gui wrappers pass CTRL-C to child python process
* `Issue #227`_: easy_install now passes its arguments to setup.py bdist_egg
* `Issue #225`_: Fixed a NameError on Python 2.5, 2.4
------
0.6.21
------
* `Issue #225`_: FIxed a regression on py2.4
------
0.6.20
------
* `Issue #135`_: Include url in warning when processing URLs in package_index.
* `Issue #212`_: Fix issue where easy_instal fails on Python 3 on windows installer.
* `Issue #213`_: Fix typo in documentation.
------
0.6.19
------
* `Issue 206`_: AttributeError: 'HTTPMessage' object has no attribute 'getheaders'
------
0.6.18
------
* `Issue 210`_: Fixed a regression introduced by `Issue 204`_ fix.
------
0.6.17
------
* Support 'DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT' environment
variable to allow to disable installation of easy_install-${version} script.
* Support Python >=3.1.4 and >=3.2.1.
* `Issue 204`_: Don't try to import the parent of a namespace package in
declare_namespace
* `Issue 196`_: Tolerate responses with multiple Content-Length headers
* `Issue 205`_: Sandboxing doesn't preserve working_set. Leads to setup_requires
problems.
------
0.6.16
------
* Builds sdist gztar even on Windows (avoiding `Issue 193`_).
* `Issue 192`_: Fixed metadata omitted on Windows when package_dir
specified with forward-slash.
* `Issue 195`_: Cython build support.
* `Issue 200`_: Issues with recognizing 64-bit packages on Windows.
------
0.6.15
------
* Fixed typo in bdist_egg
* Several issues under Python 3 has been solved.
* `Issue 146`_: Fixed missing DLL files after easy_install of windows exe package.
------
0.6.14
------
* `Issue 170`_: Fixed unittest failure. Thanks to Toshio.
* `Issue 171`_: Fixed race condition in unittests cause deadlocks in test suite.
* `Issue 143`_: Fixed a lookup issue with easy_install.
Thanks to David and Zooko.
* `Issue 174`_: Fixed the edit mode when its used with setuptools itself
------
0.6.13
------
* `Issue 160`_: 2.7 gives ValueError("Invalid IPv6 URL")
* `Issue 150`_: Fixed using ~/.local even in a --no-site-packages virtualenv
* `Issue 163`_: scan index links before external links, and don't use the md5 when
comparing two distributions
------
0.6.12
------
* `Issue 149`_: Fixed various failures on 2.3/2.4
------
0.6.11
------
* Found another case of SandboxViolation - fixed
* `Issue 15`_ and 48: Introduced a socket timeout of 15 seconds on url openings
* Added indexsidebar.html into MANIFEST.in
* `Issue 108`_: Fixed TypeError with Python3.1
* `Issue 121`_: Fixed --help install command trying to actually install.
* `Issue 112`_: Added an os.makedirs so that Tarek's solution will work.
* `Issue 133`_: Added --no-find-links to easy_install
* Added easy_install --user
* `Issue 100`_: Fixed develop --user not taking '.' in PYTHONPATH into account
* `Issue 134`_: removed spurious UserWarnings. Patch by VanLindberg
* `Issue 138`_: cant_write_to_target error when setup_requires is used.
* `Issue 147`_: respect the sys.dont_write_bytecode flag
------
0.6.10
------
* Reverted change made for the DistributionNotFound exception because
zc.buildout uses the exception message to get the name of the
distribution.
-----
0.6.9
-----
* `Issue 90`_: unknown setuptools version can be added in the working set
* `Issue 87`_: setupt.py doesn't try to convert distribute_setup.py anymore
Initial Patch by arfrever.
* `Issue 89`_: added a side bar with a download link to the doc.
* `Issue 86`_: fixed missing sentence in pkg_resources doc.
* Added a nicer error message when a DistributionNotFound is raised.
* `Issue 80`_: test_develop now works with Python 3.1
* `Issue 93`_: upload_docs now works if there is an empty sub-directory.
* `Issue 70`_: exec bit on non-exec files
* `Issue 99`_: now the standalone easy_install command doesn't uses a
"setup.cfg" if any exists in the working directory. It will use it
only if triggered by ``install_requires`` from a setup.py call
(install, develop, etc).
* `Issue 101`_: Allowing ``os.devnull`` in Sandbox
* `Issue 92`_: Fixed the "no eggs" found error with MacPort
(platform.mac_ver() fails)
* `Issue 103`_: test_get_script_header_jython_workaround not run
anymore under py3 with C or POSIX local. Contributed by Arfrever.
* `Issue 104`_: remvoved the assertion when the installation fails,
with a nicer message for the end user.
* `Issue 100`_: making sure there's no SandboxViolation when
the setup script patches setuptools.
-----
0.6.8
-----
* Added "check_packages" in dist. (added in Setuptools 0.6c11)
* Fixed the DONT_PATCH_SETUPTOOLS state.
-----
0.6.7
-----
* `Issue 58`_: Added --user support to the develop command
* `Issue 11`_: Generated scripts now wrap their call to the script entry point
in the standard "if name == 'main'"
* Added the 'DONT_PATCH_SETUPTOOLS' environment variable, so virtualenv
can drive an installation that doesn't patch a global setuptools.
* Reviewed unladen-swallow specific change from
http://code.google.com/p/unladen-swallow/source/detail?spec=svn875&r=719
and determined that it no longer applies. Distribute should work fine with
Unladen Swallow 2009Q3.
* `Issue 21`_: Allow PackageIndex.open_url to gracefully handle all cases of a
httplib.HTTPException instead of just InvalidURL and BadStatusLine.
* Removed virtual-python.py from this distribution and updated documentation
to point to the actively maintained virtualenv instead.
* `Issue 64`_: use_setuptools no longer rebuilds the distribute egg every
time it is run
* use_setuptools now properly respects the requested version
* use_setuptools will no longer try to import a distribute egg for the
wrong Python version
* `Issue 74`_: no_fake should be True by default.
* `Issue 72`_: avoid a bootstrapping issue with easy_install -U
-----
0.6.6
-----
* Unified the bootstrap file so it works on both py2.x and py3k without 2to3
(patch by Holger Krekel)
-----
0.6.5
-----
* `Issue 65`_: cli.exe and gui.exe are now generated at build time,
depending on the platform in use.
* `Issue 67`_: Fixed doc typo (PEP 381/382)
* Distribute no longer shadows setuptools if we require a 0.7-series
setuptools. And an error is raised when installing a 0.7 setuptools with
distribute.
* When run from within buildout, no attempt is made to modify an existing
setuptools egg, whether in a shared egg directory or a system setuptools.
* Fixed a hole in sandboxing allowing builtin file to write outside of
the sandbox.
-----
0.6.4
-----
* Added the generation of `distribute_setup_3k.py` during the release.
This closes `issue #52`_.
* Added an upload_docs command to easily upload project documentation to
PyPI's http://packages.python.org. This close `issue #56`_.
* Fixed a bootstrap bug on the use_setuptools() API.
-----
0.6.3
-----
setuptools
==========
* Fixed a bunch of calls to file() that caused crashes on Python 3.
bootstrapping
=============
* Fixed a bug in sorting that caused bootstrap to fail on Python 3.
-----
0.6.2
-----
setuptools
==========
* Added Python 3 support; see docs/python3.txt.
This closes http://bugs.python.org/setuptools/issue39.
* Added option to run 2to3 automatically when installing on Python 3.
This closes `issue #31`_.
* Fixed invalid usage of requirement.parse, that broke develop -d.
This closes http://bugs.python.org/setuptools/issue44.
* Fixed script launcher for 64-bit Windows.
This closes http://bugs.python.org/setuptools/issue2.
* KeyError when compiling extensions.
This closes http://bugs.python.org/setuptools/issue41.
bootstrapping
=============
* Fixed bootstrap not working on Windows. This closes `issue #49`_.
* Fixed 2.6 dependencies. This closes `issue #50`_.
* Make sure setuptools is patched when running through easy_install
This closes http://bugs.python.org/setuptools/issue40.
-----
0.6.1
-----
setuptools
==========
* package_index.urlopen now catches BadStatusLine and malformed url errors.
This closes `issue #16`_ and `issue #18`_.
* zip_ok is now False by default. This closes
http://bugs.python.org/setuptools/issue33.
* Fixed invalid URL error catching. http://bugs.python.org/setuptools/issue20.
* Fixed invalid bootstraping with easy_install installation (`issue #40`_).
Thanks to Florian Schulze for the help.
* Removed buildout/bootstrap.py. A new repository will create a specific
bootstrap.py script.
bootstrapping
=============
* The boostrap process leave setuptools alone if detected in the system
and --root or --prefix is provided, but is not in the same location.
This closes `issue #10`_.
---
0.6
---
setuptools
==========
* Packages required at build time where not fully present at install time.
This closes `issue #12`_.
* Protected against failures in tarfile extraction. This closes `issue #10`_.
* Made Jython api_tests.txt doctest compatible. This closes `issue #7`_.
* sandbox.py replaced builtin type file with builtin function open. This
closes `issue #6`_.
* Immediately close all file handles. This closes `issue #3`_.
* Added compatibility with Subversion 1.6. This references `issue #1`_.
pkg_resources
=============
* Avoid a call to /usr/bin/sw_vers on OSX and use the official platform API
instead. Based on a patch from ronaldoussoren. This closes `issue #5`_.
* Fixed a SandboxViolation for mkdir that could occur in certain cases.
This closes `issue #13`_.
* Allow to find_on_path on systems with tight permissions to fail gracefully.
This closes `issue #9`_.
* Corrected inconsistency between documentation and code of add_entry.
This closes `issue #8`_.
* Immediately close all file handles. This closes `issue #3`_.
easy_install
============
* Immediately close all file handles. This closes `issue #3`_.
.. _`Issue #135`: http://bitbucket.org/tarek/distribute/issue/135
.. _`Issue #183`: http://bitbucket.org/tarek/distribute/issue/183
.. _`Issue #207`: http://bitbucket.org/tarek/distribute/issue/207
.. _`Issue #208`: http://bitbucket.org/tarek/distribute/issue/208
.. _`Issue #212`: http://bitbucket.org/tarek/distribute/issue/212
.. _`Issue #213`: http://bitbucket.org/tarek/distribute/issue/213
.. _`Issue #218`: http://bitbucket.org/tarek/distribute/issue/218
.. _`Issue #225`: http://bitbucket.org/tarek/distribute/issue/225
.. _`Issue #227`: http://bitbucket.org/tarek/distribute/issue/227
.. _`Issue #231`: http://bitbucket.org/tarek/distribute/issue/231
.. _`Issue #237`: http://bitbucket.org/tarek/distribute/issue/237
.. _`Issue #238`: http://bitbucket.org/tarek/distribute/issue/238
.. _`Issue #239`: http://bitbucket.org/tarek/distribute/issue/239
.. _`Issue #240`: http://bitbucket.org/tarek/distribute/issue/240
.. _`Issue #241`: http://bitbucket.org/tarek/distribute/issue/241
.. _`Issue #243`: http://bitbucket.org/tarek/distribute/issue/243
.. _`Issue #244`: http://bitbucket.org/tarek/distribute/issue/244
.. _`Issue #249`: http://bitbucket.org/tarek/distribute/issue/249
.. _`Issue #258`: http://bitbucket.org/tarek/distribute/issue/258
.. _`Issue #260`: http://bitbucket.org/tarek/distribute/issue/260
.. _`Issue #262`: http://bitbucket.org/tarek/distribute/issue/262
.. _`Issue #269`: http://bitbucket.org/tarek/distribute/issue/269
.. _`Issue #272`: http://bitbucket.org/tarek/distribute/issue/272
.. _`Issue #273`: http://bitbucket.org/tarek/distribute/issue/273
.. _`Issue #278`: http://bitbucket.org/tarek/distribute/issue/278
.. _`Issue #283`: http://bitbucket.org/tarek/distribute/issue/283
.. _`Issue #294`: http://bitbucket.org/tarek/distribute/issue/294
.. _`Issue #299`: http://bitbucket.org/tarek/distribute/issue/299
.. _`Issue #301`: http://bitbucket.org/tarek/distribute/issue/301
.. _`Issue #303`: http://bitbucket.org/tarek/distribute/issue/303
.. _`Issue #304`: http://bitbucket.org/tarek/distribute/issue/304
.. _`Issue #305`: http://bitbucket.org/tarek/distribute/issue/305
.. _`Issue #306`: http://bitbucket.org/tarek/distribute/issue/306
.. _`Issue #307`: http://bitbucket.org/tarek/distribute/issue/307
.. _`Issue #310`: http://bitbucket.org/tarek/distribute/issue/310
.. _`Issue #311`: http://bitbucket.org/tarek/distribute/issue/311
.. _`Issue #313`: http://bitbucket.org/tarek/distribute/issue/313
.. _`Issue #314`: http://bitbucket.org/tarek/distribute/issue/314
.. _`Issue #320`: http://bitbucket.org/tarek/distribute/issue/320
.. _`Issue #323`: http://bitbucket.org/tarek/distribute/issue/323
.. _`Issue #326`: http://bitbucket.org/tarek/distribute/issue/326
.. _`Issue #327`: http://bitbucket.org/tarek/distribute/issue/327
.. _`Issue #328`: http://bitbucket.org/tarek/distribute/issue/328
.. _`Issue #329`: http://bitbucket.org/tarek/distribute/issue/329
.. _`Issue #334`: http://bitbucket.org/tarek/distribute/issue/334
.. _`Issue #335`: http://bitbucket.org/tarek/distribute/issue/335
.. _`Issue #336`: http://bitbucket.org/tarek/distribute/issue/336
.. _`Issue #341`: http://bitbucket.org/tarek/distribute/issue/341
.. _`Issue 100`: http://bitbucket.org/tarek/distribute/issue/100
.. _`Issue 101`: http://bitbucket.org/tarek/distribute/issue/101
.. _`Issue 103`: http://bitbucket.org/tarek/distribute/issue/103
.. _`Issue 104`: http://bitbucket.org/tarek/distribute/issue/104
.. _`Issue 108`: http://bitbucket.org/tarek/distribute/issue/108
.. _`Issue 11`: http://bitbucket.org/tarek/distribute/issue/11
.. _`Issue 112`: http://bitbucket.org/tarek/distribute/issue/112
.. _`Issue 121`: http://bitbucket.org/tarek/distribute/issue/121
.. _`Issue 133`: http://bitbucket.org/tarek/distribute/issue/133
.. _`Issue 134`: http://bitbucket.org/tarek/distribute/issue/134
.. _`Issue 138`: http://bitbucket.org/tarek/distribute/issue/138
.. _`Issue 143`: http://bitbucket.org/tarek/distribute/issue/143
.. _`Issue 146`: http://bitbucket.org/tarek/distribute/issue/146
.. _`Issue 147`: http://bitbucket.org/tarek/distribute/issue/147
.. _`Issue 149`: http://bitbucket.org/tarek/distribute/issue/149
.. _`Issue 15`: http://bitbucket.org/tarek/distribute/issue/15
.. _`Issue 150`: http://bitbucket.org/tarek/distribute/issue/150
.. _`Issue 160`: http://bitbucket.org/tarek/distribute/issue/160
.. _`Issue 163`: http://bitbucket.org/tarek/distribute/issue/163
.. _`Issue 170`: http://bitbucket.org/tarek/distribute/issue/170
.. _`Issue 171`: http://bitbucket.org/tarek/distribute/issue/171
.. _`Issue 174`: http://bitbucket.org/tarek/distribute/issue/174
.. _`Issue 192`: http://bitbucket.org/tarek/distribute/issue/192
.. _`Issue 193`: http://bitbucket.org/tarek/distribute/issue/193
.. _`Issue 195`: http://bitbucket.org/tarek/distribute/issue/195
.. _`Issue 196`: http://bitbucket.org/tarek/distribute/issue/196
.. _`Issue 200`: http://bitbucket.org/tarek/distribute/issue/200
.. _`Issue 204`: http://bitbucket.org/tarek/distribute/issue/204
.. _`Issue 205`: http://bitbucket.org/tarek/distribute/issue/205
.. _`Issue 206`: http://bitbucket.org/tarek/distribute/issue/206
.. _`Issue 21`: http://bitbucket.org/tarek/distribute/issue/21
.. _`Issue 210`: http://bitbucket.org/tarek/distribute/issue/210
.. _`Issue 58`: http://bitbucket.org/tarek/distribute/issue/58
.. _`Issue 64`: http://bitbucket.org/tarek/distribute/issue/64
.. _`Issue 65`: http://bitbucket.org/tarek/distribute/issue/65
.. _`Issue 67`: http://bitbucket.org/tarek/distribute/issue/67
.. _`Issue 70`: http://bitbucket.org/tarek/distribute/issue/70
.. _`Issue 72`: http://bitbucket.org/tarek/distribute/issue/72
.. _`Issue 74`: http://bitbucket.org/tarek/distribute/issue/74
.. _`Issue 80`: http://bitbucket.org/tarek/distribute/issue/80
.. _`Issue 86`: http://bitbucket.org/tarek/distribute/issue/86
.. _`Issue 87`: http://bitbucket.org/tarek/distribute/issue/87
.. _`Issue 89`: http://bitbucket.org/tarek/distribute/issue/89
.. _`Issue 90`: http://bitbucket.org/tarek/distribute/issue/90
.. _`Issue 92`: http://bitbucket.org/tarek/distribute/issue/92
.. _`Issue 93`: http://bitbucket.org/tarek/distribute/issue/93
.. _`Issue 99`: http://bitbucket.org/tarek/distribute/issue/99
.. _`issue
449`: http://bitbucket.org/tarek/distribute/issue/449
.. _`issue #1`: http://bitbucket.org/tarek/distribute/issue/1
.. _`issue #10`: http://bitbucket.org/tarek/distribute/issue/10
.. _`issue #12`: http://bitbucket.org/tarek/distribute/issue/12
.. _`issue #13`: http://bitbucket.org/tarek/distribute/issue/13
.. _`issue #16`: http://bitbucket.org/tarek/distribute/issue/16
.. _`issue #18`: http://bitbucket.org/tarek/distribute/issue/18
.. _`issue #3`: http://bitbucket.org/tarek/distribute/issue/3
.. _`issue #31`: http://bitbucket.org/tarek/distribute/issue/31
.. _`issue #40`: http://bitbucket.org/tarek/distribute/issue/40
.. _`issue #49`: http://bitbucket.org/tarek/distribute/issue/49
.. _`issue #5`: http://bitbucket.org/tarek/distribute/issue/5
.. _`issue #50`: http://bitbucket.org/tarek/distribute/issue/50
.. _`issue #52`: http://bitbucket.org/tarek/distribute/issue/52
.. _`issue #56`: http://bitbucket.org/tarek/distribute/issue/56
.. _`issue #6`: http://bitbucket.org/tarek/distribute/issue/6
.. _`issue #7`: http://bitbucket.org/tarek/distribute/issue/7
.. _`issue #8`: http://bitbucket.org/tarek/distribute/issue/8
.. _`issue #9`: http://bitbucket.org/tarek/distribute/issue/9
.. _`issue 64`: http://bitbucket.org/tarek/distribute/issue/64
Keywords: CPAN PyPI distutils eggs package management
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Archiving :: Packaging
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
-228
View File
@@ -1,228 +0,0 @@
===============================
Installing and Using Distribute
===============================
.. contents:: **Table of Contents**
-----------
Disclaimers
-----------
About the fork
==============
`Distribute` is a fork of the `Setuptools` project.
Distribute is intended to replace Setuptools as the standard method
for working with Python module distributions.
The fork has two goals:
- Providing a backward compatible version to replace Setuptools
and make all distributions that depend on Setuptools work as
before, but with less bugs and behaviorial issues.
This work is done in the 0.6.x series.
Starting with version 0.6.2, Distribute supports Python 3.
Installing and using distribute for Python 3 code works exactly
the same as for Python 2 code, but Distribute also helps you to support
Python 2 and Python 3 from the same source code by letting you run 2to3
on the code as a part of the build process, by setting the keyword parameter
``use_2to3`` to True. See http://packages.python.org/distribute for more
information.
- Refactoring the code, and releasing it in several distributions.
This work is being done in the 0.7.x series but not yet released.
The roadmap is still evolving, and the page that is up-to-date is
located at : `http://packages.python.org/distribute/roadmap`.
If you install `Distribute` and want to switch back for any reason to
`Setuptools`, get to the `Uninstallation instructions`_ section.
More documentation
==================
You can get more information in the Sphinx-based documentation, located
at http://packages.python.org/distribute. This documentation includes the old
Setuptools documentation that is slowly replaced, and brand new content.
About the installation process
==============================
The `Distribute` installer modifies your installation by de-activating an
existing installation of `Setuptools` in a bootstrap process. This process
has been tested in various installation schemes and contexts but in case of a
bug during this process your Python installation might be left in a broken
state. Since all modified files and directories are copied before the
installation starts, you will be able to get back to a normal state by reading
the instructions in the `Uninstallation instructions`_ section.
In any case, it is recommended to save you `site-packages` directory before
you start the installation of `Distribute`.
-------------------------
Installation Instructions
-------------------------
Distribute is only released as a source distribution.
It can be installed using pip, and can be done so with the source tarball,
or by using the ``distribute_setup.py`` script provided online.
``distribute_setup.py`` is the simplest and preferred way on all systems.
distribute_setup.py
===================
Download
`distribute_setup.py <http://python-distribute.org/distribute_setup.py>`_
and execute it, using the Python interpreter of your choice.
If your shell has the ``curl`` program you can do::
$ curl -O http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
Notice this file is also provided in the source release.
pip
===
Run easy_install or pip::
$ pip install distribute
Source installation
===================
Download the source tarball, uncompress it, then run the install command::
$ curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz
$ tar -xzvf distribute-0.6.36.tar.gz
$ cd distribute-0.6.36
$ python setup.py install
---------------------------
Uninstallation Instructions
---------------------------
Like other distutils-based distributions, Distribute doesn't provide an
uninstaller yet. It's all done manually! We are all waiting for PEP 376
support in Python.
Distribute is installed in three steps:
1. it gets out of the way an existing installation of Setuptools
2. it installs a `fake` setuptools installation
3. it installs distribute
Distribute can be removed like this:
- remove the ``distribute*.egg`` file located in your site-packages directory
- remove the ``setuptools.pth`` file located in you site-packages directory
- remove the easy_install script located in you ``sys.prefix/bin`` directory
- remove the ``setuptools*.egg`` directory located in your site-packages directory,
if any.
If you want to get back to setuptools:
- reinstall setuptools using its instruction.
Lastly:
- remove the *.OLD.* directory located in your site-packages directory if any,
**once you have checked everything was working correctly again**.
-------------------------
Quick help for developers
-------------------------
To create an egg which is compatible with Distribute, use the same
practice as with Setuptools, e.g.::
from setuptools import setup
setup(...
)
To use `pkg_resources` to access data files in the egg, you should
require the Setuptools distribution explicitly::
from setuptools import setup
setup(...
install_requires=['setuptools']
)
Only if you need Distribute-specific functionality should you depend
on it explicitly. In this case, replace the Setuptools dependency::
from setuptools import setup
setup(...
install_requires=['distribute']
)
-----------
Install FAQ
-----------
- **Why is Distribute wrapping my Setuptools installation?**
Since Distribute is a fork, and since it provides the same package
and modules, it renames the existing Setuptools egg and inserts a
new one which merely wraps the Distribute code. This way, full
backwards compatibility is kept for packages which rely on the
Setuptools modules.
At the same time, packages can meet their dependency on Setuptools
without actually installing it (which would disable Distribute).
- **How does Distribute interact with virtualenv?**
Everytime you create a virtualenv it will install setuptools by default.
You either need to re-install Distribute in it right after or pass the
``--distribute`` option when creating it.
Once installed, your virtualenv will use Distribute transparently.
Although, if you have Setuptools installed in your system-wide Python,
and if the virtualenv you are in was generated without the `--no-site-packages`
option, the Distribute installation will stop.
You need in this case to build a virtualenv with the `--no-site-packages`
option or to install `Distribute` globally.
- **How does Distribute interacts with zc.buildout?**
You can use Distribute in your zc.buildout, with the --distribute option,
starting at zc.buildout 1.4.2::
$ python bootstrap.py --distribute
For previous zc.buildout versions, *the only thing* you need to do
is use the bootstrap at `http://python-distribute.org/bootstrap.py`. Run
that bootstrap and ``bin/buildout`` (and all other buildout-generated
scripts) will transparently use distribute instead of setuptools. You do
not need a specific buildout release.
A shared eggs directory is no problem (since 0.6.6): the setuptools egg is
left in place unmodified. So other buildouts that do not yet use the new
bootstrap continue to work just fine. And there is no need to list
``distribute`` somewhere in your eggs: using the bootstrap is enough.
The source code for the bootstrap script is located at
`http://bitbucket.org/tarek/buildout-distribute`.
-----------------------------
Feedback and getting involved
-----------------------------
- Mailing list: http://mail.python.org/mailman/listinfo/distutils-sig
- Issue tracker: http://bitbucket.org/tarek/distribute/issues/
- Code Repository: http://bitbucket.org/tarek/distribute
-883
View File
@@ -1,883 +0,0 @@
Metadata-Version: 1.1
Name: distribute
Version: 0.6.36
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: http://packages.python.org/distribute
Author: The fellowship of the packaging
Author-email: distutils-sig@python.org
License: PSF or ZPL
Description: ===============================
Installing and Using Distribute
===============================
.. contents:: **Table of Contents**
-----------
Disclaimers
-----------
About the fork
==============
`Distribute` is a fork of the `Setuptools` project.
Distribute is intended to replace Setuptools as the standard method
for working with Python module distributions.
The fork has two goals:
- Providing a backward compatible version to replace Setuptools
and make all distributions that depend on Setuptools work as
before, but with less bugs and behaviorial issues.
This work is done in the 0.6.x series.
Starting with version 0.6.2, Distribute supports Python 3.
Installing and using distribute for Python 3 code works exactly
the same as for Python 2 code, but Distribute also helps you to support
Python 2 and Python 3 from the same source code by letting you run 2to3
on the code as a part of the build process, by setting the keyword parameter
``use_2to3`` to True. See http://packages.python.org/distribute for more
information.
- Refactoring the code, and releasing it in several distributions.
This work is being done in the 0.7.x series but not yet released.
The roadmap is still evolving, and the page that is up-to-date is
located at : `http://packages.python.org/distribute/roadmap`.
If you install `Distribute` and want to switch back for any reason to
`Setuptools`, get to the `Uninstallation instructions`_ section.
More documentation
==================
You can get more information in the Sphinx-based documentation, located
at http://packages.python.org/distribute. This documentation includes the old
Setuptools documentation that is slowly replaced, and brand new content.
About the installation process
==============================
The `Distribute` installer modifies your installation by de-activating an
existing installation of `Setuptools` in a bootstrap process. This process
has been tested in various installation schemes and contexts but in case of a
bug during this process your Python installation might be left in a broken
state. Since all modified files and directories are copied before the
installation starts, you will be able to get back to a normal state by reading
the instructions in the `Uninstallation instructions`_ section.
In any case, it is recommended to save you `site-packages` directory before
you start the installation of `Distribute`.
-------------------------
Installation Instructions
-------------------------
Distribute is only released as a source distribution.
It can be installed using pip, and can be done so with the source tarball,
or by using the ``distribute_setup.py`` script provided online.
``distribute_setup.py`` is the simplest and preferred way on all systems.
distribute_setup.py
===================
Download
`distribute_setup.py <http://python-distribute.org/distribute_setup.py>`_
and execute it, using the Python interpreter of your choice.
If your shell has the ``curl`` program you can do::
$ curl -O http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
Notice this file is also provided in the source release.
pip
===
Run easy_install or pip::
$ pip install distribute
Source installation
===================
Download the source tarball, uncompress it, then run the install command::
$ curl -O http://pypi.python.org/packages/source/d/distribute/distribute-0.6.36.tar.gz
$ tar -xzvf distribute-0.6.36.tar.gz
$ cd distribute-0.6.36
$ python setup.py install
---------------------------
Uninstallation Instructions
---------------------------
Like other distutils-based distributions, Distribute doesn't provide an
uninstaller yet. It's all done manually! We are all waiting for PEP 376
support in Python.
Distribute is installed in three steps:
1. it gets out of the way an existing installation of Setuptools
2. it installs a `fake` setuptools installation
3. it installs distribute
Distribute can be removed like this:
- remove the ``distribute*.egg`` file located in your site-packages directory
- remove the ``setuptools.pth`` file located in you site-packages directory
- remove the easy_install script located in you ``sys.prefix/bin`` directory
- remove the ``setuptools*.egg`` directory located in your site-packages directory,
if any.
If you want to get back to setuptools:
- reinstall setuptools using its instruction.
Lastly:
- remove the *.OLD.* directory located in your site-packages directory if any,
**once you have checked everything was working correctly again**.
-------------------------
Quick help for developers
-------------------------
To create an egg which is compatible with Distribute, use the same
practice as with Setuptools, e.g.::
from setuptools import setup
setup(...
)
To use `pkg_resources` to access data files in the egg, you should
require the Setuptools distribution explicitly::
from setuptools import setup
setup(...
install_requires=['setuptools']
)
Only if you need Distribute-specific functionality should you depend
on it explicitly. In this case, replace the Setuptools dependency::
from setuptools import setup
setup(...
install_requires=['distribute']
)
-----------
Install FAQ
-----------
- **Why is Distribute wrapping my Setuptools installation?**
Since Distribute is a fork, and since it provides the same package
and modules, it renames the existing Setuptools egg and inserts a
new one which merely wraps the Distribute code. This way, full
backwards compatibility is kept for packages which rely on the
Setuptools modules.
At the same time, packages can meet their dependency on Setuptools
without actually installing it (which would disable Distribute).
- **How does Distribute interact with virtualenv?**
Everytime you create a virtualenv it will install setuptools by default.
You either need to re-install Distribute in it right after or pass the
``--distribute`` option when creating it.
Once installed, your virtualenv will use Distribute transparently.
Although, if you have Setuptools installed in your system-wide Python,
and if the virtualenv you are in was generated without the `--no-site-packages`
option, the Distribute installation will stop.
You need in this case to build a virtualenv with the `--no-site-packages`
option or to install `Distribute` globally.
- **How does Distribute interacts with zc.buildout?**
You can use Distribute in your zc.buildout, with the --distribute option,
starting at zc.buildout 1.4.2::
$ python bootstrap.py --distribute
For previous zc.buildout versions, *the only thing* you need to do
is use the bootstrap at `http://python-distribute.org/bootstrap.py`. Run
that bootstrap and ``bin/buildout`` (and all other buildout-generated
scripts) will transparently use distribute instead of setuptools. You do
not need a specific buildout release.
A shared eggs directory is no problem (since 0.6.6): the setuptools egg is
left in place unmodified. So other buildouts that do not yet use the new
bootstrap continue to work just fine. And there is no need to list
``distribute`` somewhere in your eggs: using the bootstrap is enough.
The source code for the bootstrap script is located at
`http://bitbucket.org/tarek/buildout-distribute`.
-----------------------------
Feedback and getting involved
-----------------------------
- Mailing list: http://mail.python.org/mailman/listinfo/distutils-sig
- Issue tracker: http://bitbucket.org/tarek/distribute/issues/
- Code Repository: http://bitbucket.org/tarek/distribute
=======
CHANGES
=======
------
0.6.36
------
* Pull Request #35: In `Buildout `issue 64`_
<https://github.com/buildout/buildout/issues/64>`_, it was reported that
under Python 3, installation of distutils scripts could attempt to copy
the ``__pycache__`` directory as a file, causing an error, apparently only
under Windows. Easy_install now skips all directories when processing
metadata scripts.
------
0.6.35
------
Note this release is backward-incompatible with distribute 0.6.23-0.6.34 in
how it parses version numbers.
* `Issue #278`_: Restored compatibility with distribute 0.6.22 and setuptools
0.6. Updated the documentation to match more closely with the version
parsing as intended in setuptools 0.6.
------
0.6.34
------
* `Issue #341`_: 0.6.33 fails to build under Python 2.4.
------
0.6.33
------
* Fix 2 errors with Jython 2.5.
* Fix 1 failure with Jython 2.5 and 2.7.
* Disable workaround for Jython scripts on Linux systems.
* `Issue #336`_: `setup.py` no longer masks failure exit code when tests fail.
* Fix issue in pkg_resources where try/except around a platform-dependent
import would trigger hook load failures on Mercurial. See pull request 32
for details.
* `Issue #341`_: Fix a ResourceWarning.
------
0.6.32
------
* Fix test suite with Python 2.6.
* Fix some DeprecationWarnings and ResourceWarnings.
* `Issue #335`_: Backed out `setup_requires` superceding installed requirements
until regression can be addressed.
------
0.6.31
------
* `Issue #303`_: Make sure the manifest only ever contains UTF-8 in Python 3.
* `Issue #329`_: Properly close files created by tests for compatibility with
Jython.
* Work around Jython bugs `#1980 <http://bugs.jython.org/issue1980>`_ and
`#1981 <http://bugs.jython.org/issue1981>`_.
* `Issue #334`_: Provide workaround for packages that reference `sys.__stdout__`
such as numpy does. This change should address
`virtualenv #359 <https://github.com/pypa/virtualenv/issues/359>`_ as long
as the system encoding is UTF-8 or the IO encoding is specified in the
environment, i.e.::
PYTHONIOENCODING=utf8 pip install numpy
* Fix for encoding issue when installing from Windows executable on Python 3.
* `Issue #323`_: Allow `setup_requires` requirements to supercede installed
requirements. Added some new keyword arguments to existing pkg_resources
methods. Also had to updated how __path__ is handled for namespace packages
to ensure that when a new egg distribution containing a namespace package is
placed on sys.path, the entries in __path__ are found in the same order they
would have been in had that egg been on the path when pkg_resources was
first imported.
------
0.6.30
------
* `Issue #328`_: Clean up temporary directories in distribute_setup.py.
* Fix fatal bug in distribute_setup.py.
------
0.6.29
------
* Pull Request #14: Honor file permissions in zip files.
* `Issue #327`_: Merged pull request #24 to fix a dependency problem with pip.
* Merged pull request #23 to fix https://github.com/pypa/virtualenv/issues/301.
* If Sphinx is installed, the `upload_docs` command now runs `build_sphinx`
to produce uploadable documentation.
* `Issue #326`_: `upload_docs` provided mangled auth credentials under Python 3.
* `Issue #320`_: Fix check for "createable" in distribute_setup.py.
* `Issue #305`_: Remove a warning that was triggered during normal operations.
* `Issue #311`_: Print metadata in UTF-8 independent of platform.
* `Issue #303`_: Read manifest file with UTF-8 encoding under Python 3.
* `Issue #301`_: Allow to run tests of namespace packages when using 2to3.
* `Issue #304`_: Prevent import loop in site.py under Python 3.3.
* `Issue #283`_: Reenable scanning of `*.pyc` / `*.pyo` files on Python 3.3.
* `Issue #299`_: The develop command didn't work on Python 3, when using 2to3,
as the egg link would go to the Python 2 source. Linking to the 2to3'd code
in build/lib makes it work, although you will have to rebuild the module
before testing it.
* `Issue #306`_: Even if 2to3 is used, we build in-place under Python 2.
* `Issue #307`_: Prints the full path when .svn/entries is broken.
* `Issue #313`_: Support for sdist subcommands (Python 2.7)
* `Issue #314`_: test_local_index() would fail an OS X.
* `Issue #310`_: Non-ascii characters in a namespace __init__.py causes errors.
* `Issue #218`_: Improved documentation on behavior of `package_data` and
`include_package_data`. Files indicated by `package_data` are now included
in the manifest.
* `distribute_setup.py` now allows a `--download-base` argument for retrieving
distribute from a specified location.
------
0.6.28
------
* `Issue #294`_: setup.py can now be invoked from any directory.
* Scripts are now installed honoring the umask.
* Added support for .dist-info directories.
* `Issue #283`_: Fix and disable scanning of `*.pyc` / `*.pyo` files on
Python 3.3.
------
0.6.27
------
* Support current snapshots of CPython 3.3.
* Distribute now recognizes README.rst as a standard, default readme file.
* Exclude 'encodings' modules when removing modules from sys.modules.
Workaround for #285.
* `Issue #231`_: Don't fiddle with system python when used with buildout
(bootstrap.py)
------
0.6.26
------
* `Issue #183`_: Symlinked files are now extracted from source distributions.
* `Issue #227`_: Easy_install fetch parameters are now passed during the
installation of a source distribution; now fulfillment of setup_requires
dependencies will honor the parameters passed to easy_install.
------
0.6.25
------
* `Issue #258`_: Workaround a cache issue
* `Issue #260`_: distribute_setup.py now accepts the --user parameter for
Python 2.6 and later.
* `Issue #262`_: package_index.open_with_auth no longer throws LookupError
on Python 3.
* `Issue #269`_: AttributeError when an exception occurs reading Manifest.in
on late releases of Python.
* `Issue #272`_: Prevent TypeError when namespace package names are unicode
and single-install-externally-managed is used. Also fixes PIP `issue
449`_.
* `Issue #273`_: Legacy script launchers now install with Python2/3 support.
------
0.6.24
------
* `Issue #249`_: Added options to exclude 2to3 fixers
------
0.6.23
------
* `Issue #244`_: Fixed a test
* `Issue #243`_: Fixed a test
* `Issue #239`_: Fixed a test
* `Issue #240`_: Fixed a test
* `Issue #241`_: Fixed a test
* `Issue #237`_: Fixed a test
* `Issue #238`_: easy_install now uses 64bit executable wrappers on 64bit Python
* `Issue #208`_: Fixed parsed_versions, it now honors post-releases as noted in the documentation
* `Issue #207`_: Windows cli and gui wrappers pass CTRL-C to child python process
* `Issue #227`_: easy_install now passes its arguments to setup.py bdist_egg
* `Issue #225`_: Fixed a NameError on Python 2.5, 2.4
------
0.6.21
------
* `Issue #225`_: FIxed a regression on py2.4
------
0.6.20
------
* `Issue #135`_: Include url in warning when processing URLs in package_index.
* `Issue #212`_: Fix issue where easy_instal fails on Python 3 on windows installer.
* `Issue #213`_: Fix typo in documentation.
------
0.6.19
------
* `Issue 206`_: AttributeError: 'HTTPMessage' object has no attribute 'getheaders'
------
0.6.18
------
* `Issue 210`_: Fixed a regression introduced by `Issue 204`_ fix.
------
0.6.17
------
* Support 'DISTRIBUTE_DISABLE_VERSIONED_EASY_INSTALL_SCRIPT' environment
variable to allow to disable installation of easy_install-${version} script.
* Support Python >=3.1.4 and >=3.2.1.
* `Issue 204`_: Don't try to import the parent of a namespace package in
declare_namespace
* `Issue 196`_: Tolerate responses with multiple Content-Length headers
* `Issue 205`_: Sandboxing doesn't preserve working_set. Leads to setup_requires
problems.
------
0.6.16
------
* Builds sdist gztar even on Windows (avoiding `Issue 193`_).
* `Issue 192`_: Fixed metadata omitted on Windows when package_dir
specified with forward-slash.
* `Issue 195`_: Cython build support.
* `Issue 200`_: Issues with recognizing 64-bit packages on Windows.
------
0.6.15
------
* Fixed typo in bdist_egg
* Several issues under Python 3 has been solved.
* `Issue 146`_: Fixed missing DLL files after easy_install of windows exe package.
------
0.6.14
------
* `Issue 170`_: Fixed unittest failure. Thanks to Toshio.
* `Issue 171`_: Fixed race condition in unittests cause deadlocks in test suite.
* `Issue 143`_: Fixed a lookup issue with easy_install.
Thanks to David and Zooko.
* `Issue 174`_: Fixed the edit mode when its used with setuptools itself
------
0.6.13
------
* `Issue 160`_: 2.7 gives ValueError("Invalid IPv6 URL")
* `Issue 150`_: Fixed using ~/.local even in a --no-site-packages virtualenv
* `Issue 163`_: scan index links before external links, and don't use the md5 when
comparing two distributions
------
0.6.12
------
* `Issue 149`_: Fixed various failures on 2.3/2.4
------
0.6.11
------
* Found another case of SandboxViolation - fixed
* `Issue 15`_ and 48: Introduced a socket timeout of 15 seconds on url openings
* Added indexsidebar.html into MANIFEST.in
* `Issue 108`_: Fixed TypeError with Python3.1
* `Issue 121`_: Fixed --help install command trying to actually install.
* `Issue 112`_: Added an os.makedirs so that Tarek's solution will work.
* `Issue 133`_: Added --no-find-links to easy_install
* Added easy_install --user
* `Issue 100`_: Fixed develop --user not taking '.' in PYTHONPATH into account
* `Issue 134`_: removed spurious UserWarnings. Patch by VanLindberg
* `Issue 138`_: cant_write_to_target error when setup_requires is used.
* `Issue 147`_: respect the sys.dont_write_bytecode flag
------
0.6.10
------
* Reverted change made for the DistributionNotFound exception because
zc.buildout uses the exception message to get the name of the
distribution.
-----
0.6.9
-----
* `Issue 90`_: unknown setuptools version can be added in the working set
* `Issue 87`_: setupt.py doesn't try to convert distribute_setup.py anymore
Initial Patch by arfrever.
* `Issue 89`_: added a side bar with a download link to the doc.
* `Issue 86`_: fixed missing sentence in pkg_resources doc.
* Added a nicer error message when a DistributionNotFound is raised.
* `Issue 80`_: test_develop now works with Python 3.1
* `Issue 93`_: upload_docs now works if there is an empty sub-directory.
* `Issue 70`_: exec bit on non-exec files
* `Issue 99`_: now the standalone easy_install command doesn't uses a
"setup.cfg" if any exists in the working directory. It will use it
only if triggered by ``install_requires`` from a setup.py call
(install, develop, etc).
* `Issue 101`_: Allowing ``os.devnull`` in Sandbox
* `Issue 92`_: Fixed the "no eggs" found error with MacPort
(platform.mac_ver() fails)
* `Issue 103`_: test_get_script_header_jython_workaround not run
anymore under py3 with C or POSIX local. Contributed by Arfrever.
* `Issue 104`_: remvoved the assertion when the installation fails,
with a nicer message for the end user.
* `Issue 100`_: making sure there's no SandboxViolation when
the setup script patches setuptools.
-----
0.6.8
-----
* Added "check_packages" in dist. (added in Setuptools 0.6c11)
* Fixed the DONT_PATCH_SETUPTOOLS state.
-----
0.6.7
-----
* `Issue 58`_: Added --user support to the develop command
* `Issue 11`_: Generated scripts now wrap their call to the script entry point
in the standard "if name == 'main'"
* Added the 'DONT_PATCH_SETUPTOOLS' environment variable, so virtualenv
can drive an installation that doesn't patch a global setuptools.
* Reviewed unladen-swallow specific change from
http://code.google.com/p/unladen-swallow/source/detail?spec=svn875&r=719
and determined that it no longer applies. Distribute should work fine with
Unladen Swallow 2009Q3.
* `Issue 21`_: Allow PackageIndex.open_url to gracefully handle all cases of a
httplib.HTTPException instead of just InvalidURL and BadStatusLine.
* Removed virtual-python.py from this distribution and updated documentation
to point to the actively maintained virtualenv instead.
* `Issue 64`_: use_setuptools no longer rebuilds the distribute egg every
time it is run
* use_setuptools now properly respects the requested version
* use_setuptools will no longer try to import a distribute egg for the
wrong Python version
* `Issue 74`_: no_fake should be True by default.
* `Issue 72`_: avoid a bootstrapping issue with easy_install -U
-----
0.6.6
-----
* Unified the bootstrap file so it works on both py2.x and py3k without 2to3
(patch by Holger Krekel)
-----
0.6.5
-----
* `Issue 65`_: cli.exe and gui.exe are now generated at build time,
depending on the platform in use.
* `Issue 67`_: Fixed doc typo (PEP 381/382)
* Distribute no longer shadows setuptools if we require a 0.7-series
setuptools. And an error is raised when installing a 0.7 setuptools with
distribute.
* When run from within buildout, no attempt is made to modify an existing
setuptools egg, whether in a shared egg directory or a system setuptools.
* Fixed a hole in sandboxing allowing builtin file to write outside of
the sandbox.
-----
0.6.4
-----
* Added the generation of `distribute_setup_3k.py` during the release.
This closes `issue #52`_.
* Added an upload_docs command to easily upload project documentation to
PyPI's http://packages.python.org. This close `issue #56`_.
* Fixed a bootstrap bug on the use_setuptools() API.
-----
0.6.3
-----
setuptools
==========
* Fixed a bunch of calls to file() that caused crashes on Python 3.
bootstrapping
=============
* Fixed a bug in sorting that caused bootstrap to fail on Python 3.
-----
0.6.2
-----
setuptools
==========
* Added Python 3 support; see docs/python3.txt.
This closes http://bugs.python.org/setuptools/issue39.
* Added option to run 2to3 automatically when installing on Python 3.
This closes `issue #31`_.
* Fixed invalid usage of requirement.parse, that broke develop -d.
This closes http://bugs.python.org/setuptools/issue44.
* Fixed script launcher for 64-bit Windows.
This closes http://bugs.python.org/setuptools/issue2.
* KeyError when compiling extensions.
This closes http://bugs.python.org/setuptools/issue41.
bootstrapping
=============
* Fixed bootstrap not working on Windows. This closes `issue #49`_.
* Fixed 2.6 dependencies. This closes `issue #50`_.
* Make sure setuptools is patched when running through easy_install
This closes http://bugs.python.org/setuptools/issue40.
-----
0.6.1
-----
setuptools
==========
* package_index.urlopen now catches BadStatusLine and malformed url errors.
This closes `issue #16`_ and `issue #18`_.
* zip_ok is now False by default. This closes
http://bugs.python.org/setuptools/issue33.
* Fixed invalid URL error catching. http://bugs.python.org/setuptools/issue20.
* Fixed invalid bootstraping with easy_install installation (`issue #40`_).
Thanks to Florian Schulze for the help.
* Removed buildout/bootstrap.py. A new repository will create a specific
bootstrap.py script.
bootstrapping
=============
* The boostrap process leave setuptools alone if detected in the system
and --root or --prefix is provided, but is not in the same location.
This closes `issue #10`_.
---
0.6
---
setuptools
==========
* Packages required at build time where not fully present at install time.
This closes `issue #12`_.
* Protected against failures in tarfile extraction. This closes `issue #10`_.
* Made Jython api_tests.txt doctest compatible. This closes `issue #7`_.
* sandbox.py replaced builtin type file with builtin function open. This
closes `issue #6`_.
* Immediately close all file handles. This closes `issue #3`_.
* Added compatibility with Subversion 1.6. This references `issue #1`_.
pkg_resources
=============
* Avoid a call to /usr/bin/sw_vers on OSX and use the official platform API
instead. Based on a patch from ronaldoussoren. This closes `issue #5`_.
* Fixed a SandboxViolation for mkdir that could occur in certain cases.
This closes `issue #13`_.
* Allow to find_on_path on systems with tight permissions to fail gracefully.
This closes `issue #9`_.
* Corrected inconsistency between documentation and code of add_entry.
This closes `issue #8`_.
* Immediately close all file handles. This closes `issue #3`_.
easy_install
============
* Immediately close all file handles. This closes `issue #3`_.
.. _`Issue #135`: http://bitbucket.org/tarek/distribute/issue/135
.. _`Issue #183`: http://bitbucket.org/tarek/distribute/issue/183
.. _`Issue #207`: http://bitbucket.org/tarek/distribute/issue/207
.. _`Issue #208`: http://bitbucket.org/tarek/distribute/issue/208
.. _`Issue #212`: http://bitbucket.org/tarek/distribute/issue/212
.. _`Issue #213`: http://bitbucket.org/tarek/distribute/issue/213
.. _`Issue #218`: http://bitbucket.org/tarek/distribute/issue/218
.. _`Issue #225`: http://bitbucket.org/tarek/distribute/issue/225
.. _`Issue #227`: http://bitbucket.org/tarek/distribute/issue/227
.. _`Issue #231`: http://bitbucket.org/tarek/distribute/issue/231
.. _`Issue #237`: http://bitbucket.org/tarek/distribute/issue/237
.. _`Issue #238`: http://bitbucket.org/tarek/distribute/issue/238
.. _`Issue #239`: http://bitbucket.org/tarek/distribute/issue/239
.. _`Issue #240`: http://bitbucket.org/tarek/distribute/issue/240
.. _`Issue #241`: http://bitbucket.org/tarek/distribute/issue/241
.. _`Issue #243`: http://bitbucket.org/tarek/distribute/issue/243
.. _`Issue #244`: http://bitbucket.org/tarek/distribute/issue/244
.. _`Issue #249`: http://bitbucket.org/tarek/distribute/issue/249
.. _`Issue #258`: http://bitbucket.org/tarek/distribute/issue/258
.. _`Issue #260`: http://bitbucket.org/tarek/distribute/issue/260
.. _`Issue #262`: http://bitbucket.org/tarek/distribute/issue/262
.. _`Issue #269`: http://bitbucket.org/tarek/distribute/issue/269
.. _`Issue #272`: http://bitbucket.org/tarek/distribute/issue/272
.. _`Issue #273`: http://bitbucket.org/tarek/distribute/issue/273
.. _`Issue #278`: http://bitbucket.org/tarek/distribute/issue/278
.. _`Issue #283`: http://bitbucket.org/tarek/distribute/issue/283
.. _`Issue #294`: http://bitbucket.org/tarek/distribute/issue/294
.. _`Issue #299`: http://bitbucket.org/tarek/distribute/issue/299
.. _`Issue #301`: http://bitbucket.org/tarek/distribute/issue/301
.. _`Issue #303`: http://bitbucket.org/tarek/distribute/issue/303
.. _`Issue #304`: http://bitbucket.org/tarek/distribute/issue/304
.. _`Issue #305`: http://bitbucket.org/tarek/distribute/issue/305
.. _`Issue #306`: http://bitbucket.org/tarek/distribute/issue/306
.. _`Issue #307`: http://bitbucket.org/tarek/distribute/issue/307
.. _`Issue #310`: http://bitbucket.org/tarek/distribute/issue/310
.. _`Issue #311`: http://bitbucket.org/tarek/distribute/issue/311
.. _`Issue #313`: http://bitbucket.org/tarek/distribute/issue/313
.. _`Issue #314`: http://bitbucket.org/tarek/distribute/issue/314
.. _`Issue #320`: http://bitbucket.org/tarek/distribute/issue/320
.. _`Issue #323`: http://bitbucket.org/tarek/distribute/issue/323
.. _`Issue #326`: http://bitbucket.org/tarek/distribute/issue/326
.. _`Issue #327`: http://bitbucket.org/tarek/distribute/issue/327
.. _`Issue #328`: http://bitbucket.org/tarek/distribute/issue/328
.. _`Issue #329`: http://bitbucket.org/tarek/distribute/issue/329
.. _`Issue #334`: http://bitbucket.org/tarek/distribute/issue/334
.. _`Issue #335`: http://bitbucket.org/tarek/distribute/issue/335
.. _`Issue #336`: http://bitbucket.org/tarek/distribute/issue/336
.. _`Issue #341`: http://bitbucket.org/tarek/distribute/issue/341
.. _`Issue 100`: http://bitbucket.org/tarek/distribute/issue/100
.. _`Issue 101`: http://bitbucket.org/tarek/distribute/issue/101
.. _`Issue 103`: http://bitbucket.org/tarek/distribute/issue/103
.. _`Issue 104`: http://bitbucket.org/tarek/distribute/issue/104
.. _`Issue 108`: http://bitbucket.org/tarek/distribute/issue/108
.. _`Issue 11`: http://bitbucket.org/tarek/distribute/issue/11
.. _`Issue 112`: http://bitbucket.org/tarek/distribute/issue/112
.. _`Issue 121`: http://bitbucket.org/tarek/distribute/issue/121
.. _`Issue 133`: http://bitbucket.org/tarek/distribute/issue/133
.. _`Issue 134`: http://bitbucket.org/tarek/distribute/issue/134
.. _`Issue 138`: http://bitbucket.org/tarek/distribute/issue/138
.. _`Issue 143`: http://bitbucket.org/tarek/distribute/issue/143
.. _`Issue 146`: http://bitbucket.org/tarek/distribute/issue/146
.. _`Issue 147`: http://bitbucket.org/tarek/distribute/issue/147
.. _`Issue 149`: http://bitbucket.org/tarek/distribute/issue/149
.. _`Issue 15`: http://bitbucket.org/tarek/distribute/issue/15
.. _`Issue 150`: http://bitbucket.org/tarek/distribute/issue/150
.. _`Issue 160`: http://bitbucket.org/tarek/distribute/issue/160
.. _`Issue 163`: http://bitbucket.org/tarek/distribute/issue/163
.. _`Issue 170`: http://bitbucket.org/tarek/distribute/issue/170
.. _`Issue 171`: http://bitbucket.org/tarek/distribute/issue/171
.. _`Issue 174`: http://bitbucket.org/tarek/distribute/issue/174
.. _`Issue 192`: http://bitbucket.org/tarek/distribute/issue/192
.. _`Issue 193`: http://bitbucket.org/tarek/distribute/issue/193
.. _`Issue 195`: http://bitbucket.org/tarek/distribute/issue/195
.. _`Issue 196`: http://bitbucket.org/tarek/distribute/issue/196
.. _`Issue 200`: http://bitbucket.org/tarek/distribute/issue/200
.. _`Issue 204`: http://bitbucket.org/tarek/distribute/issue/204
.. _`Issue 205`: http://bitbucket.org/tarek/distribute/issue/205
.. _`Issue 206`: http://bitbucket.org/tarek/distribute/issue/206
.. _`Issue 21`: http://bitbucket.org/tarek/distribute/issue/21
.. _`Issue 210`: http://bitbucket.org/tarek/distribute/issue/210
.. _`Issue 58`: http://bitbucket.org/tarek/distribute/issue/58
.. _`Issue 64`: http://bitbucket.org/tarek/distribute/issue/64
.. _`Issue 65`: http://bitbucket.org/tarek/distribute/issue/65
.. _`Issue 67`: http://bitbucket.org/tarek/distribute/issue/67
.. _`Issue 70`: http://bitbucket.org/tarek/distribute/issue/70
.. _`Issue 72`: http://bitbucket.org/tarek/distribute/issue/72
.. _`Issue 74`: http://bitbucket.org/tarek/distribute/issue/74
.. _`Issue 80`: http://bitbucket.org/tarek/distribute/issue/80
.. _`Issue 86`: http://bitbucket.org/tarek/distribute/issue/86
.. _`Issue 87`: http://bitbucket.org/tarek/distribute/issue/87
.. _`Issue 89`: http://bitbucket.org/tarek/distribute/issue/89
.. _`Issue 90`: http://bitbucket.org/tarek/distribute/issue/90
.. _`Issue 92`: http://bitbucket.org/tarek/distribute/issue/92
.. _`Issue 93`: http://bitbucket.org/tarek/distribute/issue/93
.. _`Issue 99`: http://bitbucket.org/tarek/distribute/issue/99
.. _`issue
449`: http://bitbucket.org/tarek/distribute/issue/449
.. _`issue #1`: http://bitbucket.org/tarek/distribute/issue/1
.. _`issue #10`: http://bitbucket.org/tarek/distribute/issue/10
.. _`issue #12`: http://bitbucket.org/tarek/distribute/issue/12
.. _`issue #13`: http://bitbucket.org/tarek/distribute/issue/13
.. _`issue #16`: http://bitbucket.org/tarek/distribute/issue/16
.. _`issue #18`: http://bitbucket.org/tarek/distribute/issue/18
.. _`issue #3`: http://bitbucket.org/tarek/distribute/issue/3
.. _`issue #31`: http://bitbucket.org/tarek/distribute/issue/31
.. _`issue #40`: http://bitbucket.org/tarek/distribute/issue/40
.. _`issue #49`: http://bitbucket.org/tarek/distribute/issue/49
.. _`issue #5`: http://bitbucket.org/tarek/distribute/issue/5
.. _`issue #50`: http://bitbucket.org/tarek/distribute/issue/50
.. _`issue #52`: http://bitbucket.org/tarek/distribute/issue/52
.. _`issue #56`: http://bitbucket.org/tarek/distribute/issue/56
.. _`issue #6`: http://bitbucket.org/tarek/distribute/issue/6
.. _`issue #7`: http://bitbucket.org/tarek/distribute/issue/7
.. _`issue #8`: http://bitbucket.org/tarek/distribute/issue/8
.. _`issue #9`: http://bitbucket.org/tarek/distribute/issue/9
.. _`issue 64`: http://bitbucket.org/tarek/distribute/issue/64
Keywords: CPAN PyPI distutils eggs package management
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Python Software Foundation License
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Archiving :: Packaging
Classifier: Topic :: System :: Systems Administration
Classifier: Topic :: Utilities
-546
View File
@@ -1,546 +0,0 @@
#!python
"""Bootstrap distribute installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from distribute_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools, set a download
mirror, or use an alternate download directory, you can do so by supplying
the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools.
"""
import os
import shutil
import sys
import time
import fnmatch
import tempfile
import tarfile
import optparse
from distutils import log
try:
from site import USER_SITE
except ImportError:
USER_SITE = None
try:
import subprocess
def _python_cmd(*args):
args = (sys.executable,) + args
return subprocess.call(args) == 0
except ImportError:
# will be used for python 2.3
def _python_cmd(*args):
args = (sys.executable,) + args
# quoting arguments if windows
if sys.platform == 'win32':
def quote(arg):
if ' ' in arg:
return '"%s"' % arg
return arg
args = [quote(arg) for arg in args]
return os.spawnl(os.P_WAIT, sys.executable, *args) == 0
DEFAULT_VERSION = "0.6.36"
DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/"
SETUPTOOLS_FAKED_VERSION = "0.6c11"
SETUPTOOLS_PKG_INFO = """\
Metadata-Version: 1.0
Name: setuptools
Version: %s
Summary: xxxx
Home-page: xxx
Author: xxx
Author-email: xxx
License: xxx
Description: xxx
""" % SETUPTOOLS_FAKED_VERSION
def _install(tarball, install_args=()):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
# installing
log.warn('Installing Distribute')
if not _python_cmd('setup.py', 'install', *install_args):
log.warn('Something went wrong during the installation.')
log.warn('See the error message above.')
# exitcode will be 2
return 2
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
def _build_egg(egg, tarball, to_dir):
# extracting the tarball
tmpdir = tempfile.mkdtemp()
log.warn('Extracting in %s', tmpdir)
old_wd = os.getcwd()
try:
os.chdir(tmpdir)
tar = tarfile.open(tarball)
_extractall(tar)
tar.close()
# going in the directory
subdir = os.path.join(tmpdir, os.listdir(tmpdir)[0])
os.chdir(subdir)
log.warn('Now working in %s', subdir)
# building an egg
log.warn('Building a Distribute egg in %s', to_dir)
_python_cmd('setup.py', '-q', 'bdist_egg', '--dist-dir', to_dir)
finally:
os.chdir(old_wd)
shutil.rmtree(tmpdir)
# returning the result
log.warn(egg)
if not os.path.exists(egg):
raise IOError('Could not build the egg.')
def _do_download(version, download_base, to_dir, download_delay):
egg = os.path.join(to_dir, 'distribute-%s-py%d.%d.egg'
% (version, sys.version_info[0], sys.version_info[1]))
if not os.path.exists(egg):
tarball = download_setuptools(version, download_base,
to_dir, download_delay)
_build_egg(egg, tarball, to_dir)
sys.path.insert(0, egg)
import setuptools
setuptools.bootstrap_install_from = egg
def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, download_delay=15, no_fake=True):
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
was_imported = 'pkg_resources' in sys.modules or \
'setuptools' in sys.modules
try:
try:
import pkg_resources
if not hasattr(pkg_resources, '_distribute'):
if not no_fake:
_fake_setuptools()
raise ImportError
except ImportError:
return _do_download(version, download_base, to_dir, download_delay)
try:
pkg_resources.require("distribute>=" + version)
return
except pkg_resources.VersionConflict:
e = sys.exc_info()[1]
if was_imported:
sys.stderr.write(
"The required version of distribute (>=%s) is not available,\n"
"and can't be installed while this script is running. Please\n"
"install a more recent version first, using\n"
"'easy_install -U distribute'."
"\n\n(Currently using %r)\n" % (version, e.args[0]))
sys.exit(2)
else:
del pkg_resources, sys.modules['pkg_resources'] # reload ok
return _do_download(version, download_base, to_dir,
download_delay)
except pkg_resources.DistributionNotFound:
return _do_download(version, download_base, to_dir,
download_delay)
finally:
if not no_fake:
_create_fake_setuptools_pkg_info(to_dir)
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
to_dir=os.curdir, delay=15):
"""Download distribute from a specified location and return its filename
`version` should be a valid distribute version number that is available
as an egg for download under the `download_base` URL (which should end
with a '/'). `to_dir` is the directory where the egg will be downloaded.
`delay` is the number of seconds to pause before an actual download
attempt.
"""
# making sure we use the absolute path
to_dir = os.path.abspath(to_dir)
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
tgz_name = "distribute-%s.tar.gz" % version
url = download_base + tgz_name
saveto = os.path.join(to_dir, tgz_name)
src = dst = None
if not os.path.exists(saveto): # Avoid repeated downloads
try:
log.warn("Downloading %s", url)
src = urlopen(url)
# Read/write all in one block, so we don't create a corrupt file
# if the download is interrupted.
data = src.read()
dst = open(saveto, "wb")
dst.write(data)
finally:
if src:
src.close()
if dst:
dst.close()
return os.path.realpath(saveto)
def _no_sandbox(function):
def __no_sandbox(*args, **kw):
try:
from setuptools.sandbox import DirectorySandbox
if not hasattr(DirectorySandbox, '_old'):
def violation(*args):
pass
DirectorySandbox._old = DirectorySandbox._violation
DirectorySandbox._violation = violation
patched = True
else:
patched = False
except ImportError:
patched = False
try:
return function(*args, **kw)
finally:
if patched:
DirectorySandbox._violation = DirectorySandbox._old
del DirectorySandbox._old
return __no_sandbox
def _patch_file(path, content):
"""Will backup the file then patch it"""
f = open(path)
existing_content = f.read()
f.close()
if existing_content == content:
# already patched
log.warn('Already patched.')
return False
log.warn('Patching...')
_rename_path(path)
f = open(path, 'w')
try:
f.write(content)
finally:
f.close()
return True
_patch_file = _no_sandbox(_patch_file)
def _same_content(path, content):
f = open(path)
existing_content = f.read()
f.close()
return existing_content == content
def _rename_path(path):
new_name = path + '.OLD.%s' % time.time()
log.warn('Renaming %s to %s', path, new_name)
os.rename(path, new_name)
return new_name
def _remove_flat_installation(placeholder):
if not os.path.isdir(placeholder):
log.warn('Unkown installation at %s', placeholder)
return False
found = False
for file in os.listdir(placeholder):
if fnmatch.fnmatch(file, 'setuptools*.egg-info'):
found = True
break
if not found:
log.warn('Could not locate setuptools*.egg-info')
return
log.warn('Moving elements out of the way...')
pkg_info = os.path.join(placeholder, file)
if os.path.isdir(pkg_info):
patched = _patch_egg_dir(pkg_info)
else:
patched = _patch_file(pkg_info, SETUPTOOLS_PKG_INFO)
if not patched:
log.warn('%s already patched.', pkg_info)
return False
# now let's move the files out of the way
for element in ('setuptools', 'pkg_resources.py', 'site.py'):
element = os.path.join(placeholder, element)
if os.path.exists(element):
_rename_path(element)
else:
log.warn('Could not find the %s element of the '
'Setuptools distribution', element)
return True
_remove_flat_installation = _no_sandbox(_remove_flat_installation)
def _after_install(dist):
log.warn('After install bootstrap.')
placeholder = dist.get_command_obj('install').install_purelib
_create_fake_setuptools_pkg_info(placeholder)
def _create_fake_setuptools_pkg_info(placeholder):
if not placeholder or not os.path.exists(placeholder):
log.warn('Could not find the install location')
return
pyver = '%s.%s' % (sys.version_info[0], sys.version_info[1])
setuptools_file = 'setuptools-%s-py%s.egg-info' % \
(SETUPTOOLS_FAKED_VERSION, pyver)
pkg_info = os.path.join(placeholder, setuptools_file)
if os.path.exists(pkg_info):
log.warn('%s already exists', pkg_info)
return
log.warn('Creating %s', pkg_info)
try:
f = open(pkg_info, 'w')
except EnvironmentError:
log.warn("Don't have permissions to write %s, skipping", pkg_info)
return
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
f.close()
pth_file = os.path.join(placeholder, 'setuptools.pth')
log.warn('Creating %s', pth_file)
f = open(pth_file, 'w')
try:
f.write(os.path.join(os.curdir, setuptools_file))
finally:
f.close()
_create_fake_setuptools_pkg_info = _no_sandbox(
_create_fake_setuptools_pkg_info
)
def _patch_egg_dir(path):
# let's check if it's already patched
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
if os.path.exists(pkg_info):
if _same_content(pkg_info, SETUPTOOLS_PKG_INFO):
log.warn('%s already patched.', pkg_info)
return False
_rename_path(path)
os.mkdir(path)
os.mkdir(os.path.join(path, 'EGG-INFO'))
pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO')
f = open(pkg_info, 'w')
try:
f.write(SETUPTOOLS_PKG_INFO)
finally:
f.close()
return True
_patch_egg_dir = _no_sandbox(_patch_egg_dir)
def _before_install():
log.warn('Before install bootstrap.')
_fake_setuptools()
def _under_prefix(location):
if 'install' not in sys.argv:
return True
args = sys.argv[sys.argv.index('install') + 1:]
for index, arg in enumerate(args):
for option in ('--root', '--prefix'):
if arg.startswith('%s=' % option):
top_dir = arg.split('root=')[-1]
return location.startswith(top_dir)
elif arg == option:
if len(args) > index:
top_dir = args[index + 1]
return location.startswith(top_dir)
if arg == '--user' and USER_SITE is not None:
return location.startswith(USER_SITE)
return True
def _fake_setuptools():
log.warn('Scanning installed packages')
try:
import pkg_resources
except ImportError:
# we're cool
log.warn('Setuptools or Distribute does not seem to be installed.')
return
ws = pkg_resources.working_set
try:
setuptools_dist = ws.find(
pkg_resources.Requirement.parse('setuptools', replacement=False)
)
except TypeError:
# old distribute API
setuptools_dist = ws.find(
pkg_resources.Requirement.parse('setuptools')
)
if setuptools_dist is None:
log.warn('No setuptools distribution found')
return
# detecting if it was already faked
setuptools_location = setuptools_dist.location
log.warn('Setuptools installation detected at %s', setuptools_location)
# if --root or --preix was provided, and if
# setuptools is not located in them, we don't patch it
if not _under_prefix(setuptools_location):
log.warn('Not patching, --root or --prefix is installing Distribute'
' in another location')
return
# let's see if its an egg
if not setuptools_location.endswith('.egg'):
log.warn('Non-egg installation')
res = _remove_flat_installation(setuptools_location)
if not res:
return
else:
log.warn('Egg installation')
pkg_info = os.path.join(setuptools_location, 'EGG-INFO', 'PKG-INFO')
if (os.path.exists(pkg_info) and
_same_content(pkg_info, SETUPTOOLS_PKG_INFO)):
log.warn('Already patched.')
return
log.warn('Patching...')
# let's create a fake egg replacing setuptools one
res = _patch_egg_dir(setuptools_location)
if not res:
return
log.warn('Patching complete.')
_relaunch()
def _relaunch():
log.warn('Relaunching...')
# we have to relaunch the process
# pip marker to avoid a relaunch bug
_cmd1 = ['-c', 'install', '--single-version-externally-managed']
_cmd2 = ['-c', 'install', '--record']
if sys.argv[:3] == _cmd1 or sys.argv[:3] == _cmd2:
sys.argv[0] = 'setup.py'
args = [sys.executable] + sys.argv
sys.exit(subprocess.call(args))
def _extractall(self, path=".", members=None):
"""Extract all members from the archive to the current working
directory and set owner, modification time and permissions on
directories afterwards. `path' specifies a different directory
to extract to. `members' is optional and must be a subset of the
list returned by getmembers().
"""
import copy
import operator
from tarfile import ExtractError
directories = []
if members is None:
members = self
for tarinfo in members:
if tarinfo.isdir():
# Extract directories with a safe mode.
directories.append(tarinfo)
tarinfo = copy.copy(tarinfo)
tarinfo.mode = 448 # decimal for oct 0700
self.extract(tarinfo, path)
# Reverse sort directories.
if sys.version_info < (2, 4):
def sorter(dir1, dir2):
return cmp(dir1.name, dir2.name)
directories.sort(sorter)
directories.reverse()
else:
directories.sort(key=operator.attrgetter('name'), reverse=True)
# Set correct owner, mtime and filemode on directories.
for tarinfo in directories:
dirpath = os.path.join(path, tarinfo.name)
try:
self.chown(tarinfo, dirpath)
self.utime(tarinfo, dirpath)
self.chmod(tarinfo, dirpath)
except ExtractError:
e = sys.exc_info()[1]
if self.errorlevel > 1:
raise
else:
self._dbg(1, "tarfile: %s" % e)
def _build_install_args(options):
"""
Build the arguments to 'python setup.py install' on the distribute package
"""
install_args = []
if options.user_install:
if sys.version_info < (2, 6):
log.warn("--user requires Python 2.6 or later")
raise SystemExit(1)
install_args.append('--user')
return install_args
def _parse_args():
"""
Parse the command line for options
"""
parser = optparse.OptionParser()
parser.add_option(
'--user', dest='user_install', action='store_true', default=False,
help='install in user site package (requires Python 2.6 or later)')
parser.add_option(
'--download-base', dest='download_base', metavar="URL",
default=DEFAULT_URL,
help='alternative URL from where to download the distribute package')
options, args = parser.parse_args()
# positional arguments are ignored
return options
def main(version=DEFAULT_VERSION):
"""Install or upgrade setuptools and EasyInstall"""
options = _parse_args()
tarball = download_setuptools(download_base=options.download_base)
return _install(tarball, _build_install_args(options))
if __name__ == '__main__':
sys.exit(main())
@@ -1,8 +0,0 @@
<h3>Download</h3>
<p>Current version: <b>{{ version }}</b></p>
<p>Get Distribute from the <a href="http://pypi.python.org/pypi/distribute"> Python Package Index</a>
<h3>Questions? Suggestions? Contributions?</h3>
<p>Visit the <a href="http://bitbucket.org/tarek/distribute">Distribute project page</a> </p>
File diff suppressed because it is too large Load Diff
@@ -1,36 +0,0 @@
Welcome to Distribute's documentation!
======================================
`Distribute` is a fork of the `Setuptools` project.
Distribute is intended to replace Setuptools as the standard method for
working with Python module distributions.
For those who may wonder why they should switch to Distribute over Setuptools, its quite simple:
- Distribute is a drop-in replacement for Setuptools
- The code is actively maintained, and has over 10 commiters
- Distribute offers Python 3 support !
Documentation content:
.. toctree::
:maxdepth: 2
roadmap
python3
using
setuptools
easy_install
pkg_resources
.. image:: http://python-distribute.org/pip_distribute.png
Design done by Idan Gazit (http://pixane.com) - License: cc-by-3.0
Copy & paste::
curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip
@@ -1,121 +0,0 @@
=====================================================
Supporting both Python 2 and Python 3 with Distribute
=====================================================
Starting with version 0.6.2, Distribute supports Python 3. Installing and
using distribute for Python 3 code works exactly the same as for Python 2
code, but Distribute also helps you to support Python 2 and Python 3 from
the same source code by letting you run 2to3 on the code as a part of the
build process, by setting the keyword parameter ``use_2to3`` to True.
Distribute as help during porting
=================================
Distribute can make the porting process much easier by automatically running
2to3 as a part of the test running. To do this you need to configure the
setup.py so that you can run the unit tests with ``python setup.py test``.
See :ref:`test` for more information on this.
Once you have the tests running under Python 2, you can add the use_2to3
keyword parameters to setup(), and start running the tests under Python 3.
The test command will now first run the build command during which the code
will be converted with 2to3, and the tests will then be run from the build
directory, as opposed from the source directory as is normally done.
Distribute will convert all Python files, and also all doctests in Python
files. However, if you have doctests located in separate text files, these
will not automatically be converted. By adding them to the
``convert_2to3_doctests`` keyword parameter Distrubute will convert them as
well.
By default, the conversion uses all fixers in the ``lib2to3.fixers`` package.
To use additional fixers, the parameter ``use_2to3_fixers`` can be set
to a list of names of packages containing fixers. To exclude fixers, the
parameter ``use_2to3_exclude_fixers`` can be set to fixer names to be
skipped.
A typical setup.py can look something like this::
from setuptools import setup
setup(
name='your.module',
version = '1.0',
description='This is your awesome module',
author='You',
author_email='your@email',
package_dir = {'': 'src'},
packages = ['your', 'you.module'],
test_suite = 'your.module.tests',
use_2to3 = True,
convert_2to3_doctests = ['src/your/module/README.txt'],
use_2to3_fixers = ['your.fixers'],
use_2to3_exclude_fixers = ['lib2to3.fixes.fix_import'],
)
Differential conversion
-----------------------
Note that a file will only be copied and converted during the build process
if the source file has been changed. If you add a file to the doctests
that should be converted, it will not be converted the next time you run
the tests, since it hasn't been modified. You need to remove it from the
build directory. Also if you run the build, install or test commands before
adding the use_2to3 parameter, you will have to remove the build directory
before you run the test command, as the files otherwise will seem updated,
and no conversion will happen.
In general, if code doesn't seem to be converted, deleting the build directory
and trying again is a good saferguard against the build directory getting
"out of sync" with the source directory.
Distributing Python 3 modules
=============================
You can distribute your modules with Python 3 support in different ways. A
normal source distribution will work, but can be slow in installing, as the
2to3 process will be run during the install. But you can also distribute
the module in binary format, such as a binary egg. That egg will contain the
already converted code, and hence no 2to3 conversion is needed during install.
Advanced features
=================
If you don't want to run the 2to3 conversion on the doctests in Python files,
you can turn that off by setting ``setuptools.use_2to3_on_doctests = False``.
Note on compatibility with setuptools
=====================================
Setuptools do not know about the new keyword parameters to support Python 3.
As a result it will warn about the unknown keyword parameters if you use
setuptools instead of Distribute under Python 2. This is not an error, and
install process will continue as normal, but if you want to get rid of that
error this is easy. Simply conditionally add the new parameters into an extra
dict and pass that dict into setup()::
from setuptools import setup
import sys
extra = {}
if sys.version_info >= (3,):
extra['use_2to3'] = True
extra['convert_2to3_doctests'] = ['src/your/module/README.txt']
extra['use_2to3_fixers'] = ['your.fixers']
setup(
name='your.module',
version = '1.0',
description='This is your awesome module',
author='You',
author_email='your@email',
package_dir = {'': 'src'},
packages = ['your', 'you.module'],
test_suite = 'your.module.tests',
**extra
)
This way the parameters will only be used under Python 3, where you have to
use Distribute.
@@ -1,86 +0,0 @@
=======
Roadmap
=======
Distribute has two branches:
- 0.6.x : provides a Setuptools-0.6cX compatible version
- 0.7.x : will provide a refactoring
0.6.x
=====
Not "much" is going to happen here, we want this branch to be helpful
to the community *today* by addressing the 40-or-so bugs
that were found in Setuptools and never fixed. This is eventually
happen soon because its development is
fast : there are up to 5 commiters that are working on it very often
(and the number grows weekly.)
The biggest issue with this branch is that it is providing the same
packages and modules setuptools does, and this
requires some bootstrapping work where we make sure once Distribute is
installed, all Distribution that requires Setuptools
will continue to work. This is done by faking the metadata of
Setuptools 0.6c9. That's the only way we found to do this.
There's one major thing though: thanks to the work of Lennart, Alex,
Martin, this branch supports Python 3,
which is great to have to speed up Py3 adoption.
The goal of the 0.6.x is to remove as much bugs as we can, and try if
possible to remove the patches done
on Distutils. We will support 0.6.x maintenance for years and we will
promote its usage everywhere instead of
Setuptools.
Some new commands are added there, when they are helpful and don't
interact with the rest. I am thinking
about "upload_docs" that let you upload documentation to PyPI. The
goal is to move it to Distutils
at some point, if the documentation feature of PyPI stays and starts to be used.
0.7.x
=====
We've started to refactor Distribute with this roadmap in mind (and
no, as someone said, it's not vaporware,
we've done a lot already)
- 0.7.x can be installed and used with 0.6.x
- easy_install is going to be deprecated ! use Pip !
- the version system will be deprecated, in favor of the one in Distutils
- no more Distutils monkey-patch that happens once you use the code
(things like 'from distutils import cmd; cmd.Command = CustomCommand')
- no more custom site.py (that is: if something misses in Python's
site.py we'll add it there instead of patching it)
- no more namespaced packages system, if PEP 382 (namespaces package
support) makes it to 2.7
- The code is splitted in many packages and might be distributed under
several distributions.
- distribute.resources: that's the old pkg_resources, but
reorganized in clean, pep-8 modules. This package will
only contain the query APIs and will focus on being PEP 376
compatible. We will promote its usage and see if Pip wants
to use it as a basis.
It will probably shrink a lot though, once the stdlib provides PEP 376 support.
- distribute.entrypoints: that's the old pkg_resources entry points
system, but on its own. it uses distribute.resources
- distribute.index: that's package_index and a few other things.
everything required to interact with PyPI. We will promote
its usage and see if Pip wants to use it as a basis.
- distribute.core (might be renamed to main): that's everything
else, and uses the other packages.
Goal: A first release before (or when) Python 2.7 / 3.2 is out.
@@ -1,21 +0,0 @@
================================
Using Distribute in your project
================================
To use Distribute in your project, the recommended way is to ship
`distribute_setup.py` alongside your `setup.py` script and call
it at the very begining of `setup.py` like this::
from distribute_setup import use_setuptools
use_setuptools()
Another way is to add ``Distribute`` in the ``install_requires`` option::
from setuptools import setup
setup(...
install_requires=['distribute']
)
XXX to be finished
@@ -1,540 +0,0 @@
/*
* basic.css
* ~~~~~~~~~
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
/* -- main layout ----------------------------------------------------------- */
div.clearer {
clear: both;
}
/* -- relbar ---------------------------------------------------------------- */
div.related {
width: 100%;
font-size: 90%;
}
div.related h3 {
display: none;
}
div.related ul {
margin: 0;
padding: 0 0 0 10px;
list-style: none;
}
div.related li {
display: inline;
}
div.related li.right {
float: right;
margin-right: 5px;
}
/* -- sidebar --------------------------------------------------------------- */
div.sphinxsidebarwrapper {
padding: 10px 5px 0 10px;
}
div.sphinxsidebar {
float: left;
width: 230px;
margin-left: -100%;
font-size: 90%;
}
div.sphinxsidebar ul {
list-style: none;
}
div.sphinxsidebar ul ul,
div.sphinxsidebar ul.want-points {
margin-left: 20px;
list-style: square;
}
div.sphinxsidebar ul ul {
margin-top: 0;
margin-bottom: 0;
}
div.sphinxsidebar form {
margin-top: 10px;
}
div.sphinxsidebar input {
border: 1px solid #98dbcc;
font-family: sans-serif;
font-size: 1em;
}
div.sphinxsidebar #searchbox input[type="text"] {
width: 170px;
}
div.sphinxsidebar #searchbox input[type="submit"] {
width: 30px;
}
img {
border: 0;
}
/* -- search page ----------------------------------------------------------- */
ul.search {
margin: 10px 0 0 20px;
padding: 0;
}
ul.search li {
padding: 5px 0 5px 20px;
background-image: url(file.png);
background-repeat: no-repeat;
background-position: 0 7px;
}
ul.search li a {
font-weight: bold;
}
ul.search li div.context {
color: #888;
margin: 2px 0 0 30px;
text-align: left;
}
ul.keywordmatches li.goodmatch a {
font-weight: bold;
}
/* -- index page ------------------------------------------------------------ */
table.contentstable {
width: 90%;
}
table.contentstable p.biglink {
line-height: 150%;
}
a.biglink {
font-size: 1.3em;
}
span.linkdescr {
font-style: italic;
padding-top: 5px;
font-size: 90%;
}
/* -- general index --------------------------------------------------------- */
table.indextable {
width: 100%;
}
table.indextable td {
text-align: left;
vertical-align: top;
}
table.indextable dl, table.indextable dd {
margin-top: 0;
margin-bottom: 0;
}
table.indextable tr.pcap {
height: 10px;
}
table.indextable tr.cap {
margin-top: 10px;
background-color: #f2f2f2;
}
img.toggler {
margin-right: 3px;
margin-top: 3px;
cursor: pointer;
}
div.modindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
div.genindex-jumpbox {
border-top: 1px solid #ddd;
border-bottom: 1px solid #ddd;
margin: 1em 0 1em 0;
padding: 0.4em;
}
/* -- general body styles --------------------------------------------------- */
a.headerlink {
visibility: hidden;
}
h1:hover > a.headerlink,
h2:hover > a.headerlink,
h3:hover > a.headerlink,
h4:hover > a.headerlink,
h5:hover > a.headerlink,
h6:hover > a.headerlink,
dt:hover > a.headerlink {
visibility: visible;
}
div.body p.caption {
text-align: inherit;
}
div.body td {
text-align: left;
}
.field-list ul {
padding-left: 1em;
}
.first {
margin-top: 0 !important;
}
p.rubric {
margin-top: 30px;
font-weight: bold;
}
img.align-left, .figure.align-left, object.align-left {
clear: left;
float: left;
margin-right: 1em;
}
img.align-right, .figure.align-right, object.align-right {
clear: right;
float: right;
margin-left: 1em;
}
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left;
}
.align-center {
text-align: center;
}
.align-right {
text-align: right;
}
/* -- sidebars -------------------------------------------------------------- */
div.sidebar {
margin: 0 0 0.5em 1em;
border: 1px solid #ddb;
padding: 7px 7px 0 7px;
background-color: #ffe;
width: 40%;
float: right;
}
p.sidebar-title {
font-weight: bold;
}
/* -- topics ---------------------------------------------------------------- */
div.topic {
border: 1px solid #ccc;
padding: 7px 7px 0 7px;
margin: 10px 0 10px 0;
}
p.topic-title {
font-size: 1.1em;
font-weight: bold;
margin-top: 10px;
}
/* -- admonitions ----------------------------------------------------------- */
div.admonition {
margin-top: 10px;
margin-bottom: 10px;
padding: 7px;
}
div.admonition dt {
font-weight: bold;
}
div.admonition dl {
margin-bottom: 0;
}
p.admonition-title {
margin: 0px 10px 5px 0px;
font-weight: bold;
}
div.body p.centered {
text-align: center;
margin-top: 25px;
}
/* -- tables ---------------------------------------------------------------- */
table.docutils {
border: 0;
border-collapse: collapse;
}
table.docutils td, table.docutils th {
padding: 1px 8px 1px 5px;
border-top: 0;
border-left: 0;
border-right: 0;
border-bottom: 1px solid #aaa;
}
table.field-list td, table.field-list th {
border: 0 !important;
}
table.footnote td, table.footnote th {
border: 0 !important;
}
th {
text-align: left;
padding-right: 5px;
}
table.citation {
border-left: solid 1px gray;
margin-left: 1px;
}
table.citation td {
border-bottom: none;
}
/* -- other body styles ----------------------------------------------------- */
ol.arabic {
list-style: decimal;
}
ol.loweralpha {
list-style: lower-alpha;
}
ol.upperalpha {
list-style: upper-alpha;
}
ol.lowerroman {
list-style: lower-roman;
}
ol.upperroman {
list-style: upper-roman;
}
dl {
margin-bottom: 15px;
}
dd p {
margin-top: 0px;
}
dd ul, dd table {
margin-bottom: 10px;
}
dd {
margin-top: 3px;
margin-bottom: 10px;
margin-left: 30px;
}
dt:target, .highlighted {
background-color: #fbe54e;
}
dl.glossary dt {
font-weight: bold;
font-size: 1.1em;
}
.field-list ul {
margin: 0;
padding-left: 1em;
}
.field-list p {
margin: 0;
}
.refcount {
color: #060;
}
.optional {
font-size: 1.3em;
}
.versionmodified {
font-style: italic;
}
.system-message {
background-color: #fda;
padding: 5px;
border: 3px solid red;
}
.footnote:target {
background-color: #ffa;
}
.line-block {
display: block;
margin-top: 1em;
margin-bottom: 1em;
}
.line-block .line-block {
margin-top: 0;
margin-bottom: 0;
margin-left: 1.5em;
}
.guilabel, .menuselection {
font-family: sans-serif;
}
.accelerator {
text-decoration: underline;
}
.classifier {
font-style: oblique;
}
abbr, acronym {
border-bottom: dotted 1px;
cursor: help;
}
/* -- code displays --------------------------------------------------------- */
pre {
overflow: auto;
overflow-y: hidden; /* fixes display issues on Chrome browsers */
}
td.linenos pre {
padding: 5px 0px;
border: 0;
background-color: transparent;
color: #aaa;
}
table.highlighttable {
margin-left: 0.5em;
}
table.highlighttable td {
padding: 0 0.5em 0 0.5em;
}
tt.descname {
background-color: transparent;
font-weight: bold;
font-size: 1.2em;
}
tt.descclassname {
background-color: transparent;
}
tt.xref, a tt {
background-color: transparent;
font-weight: bold;
}
h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
background-color: transparent;
}
.viewcode-link {
float: right;
}
.viewcode-back {
float: right;
font-family: sans-serif;
}
div.viewcode-block:target {
margin: -1px -10px;
padding: 0 10px;
}
/* -- math display ---------------------------------------------------------- */
img.math {
vertical-align: middle;
}
div.body div.math p {
text-align: center;
}
span.eqno {
float: right;
}
/* -- printout stylesheet --------------------------------------------------- */
@media print {
div.document,
div.documentwrapper,
div.bodywrapper {
margin: 0 !important;
width: 100%;
}
div.sphinxsidebar,
div.related,
div.footer,
#top-link {
display: none;
}
}
@@ -1,236 +0,0 @@
/**
* Sphinx stylesheet -- default theme
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
@import url("basic.css");
/* -- page layout ----------------------------------------------------------- */
body {
font-family: Arial, sans-serif;
font-size: 100%;
background-color: #111111;
color: #555555;
margin: 0;
padding: 0;
}
div.documentwrapper {
float: left;
width: 100%;
}
div.bodywrapper {
margin: 0 0 0 300px;
}
hr{
border: 1px solid #B1B4B6;
}
div.document {
background-color: #fafafa;
}
div.body {
background-color: #ffffff;
color: #3E4349;
padding: 1em 30px 30px 30px;
font-size: 0.9em;
}
div.footer {
color: #555;
width: 100%;
padding: 13px 0;
text-align: center;
font-size: 75%;
}
div.footer a {
color: #444444;
}
div.related {
background-color: #6BA81E;
line-height: 36px;
color: #ffffff;
text-shadow: 0px 1px 0 #444444;
font-size: 1.1em;
}
div.related a {
color: #E2F3CC;
}
div.related .right {
font-size: 0.9em;
}
div.sphinxsidebar {
font-size: 0.9em;
line-height: 1.5em;
width: 300px;
}
div.sphinxsidebarwrapper{
padding: 20px 0;
}
div.sphinxsidebar h3,
div.sphinxsidebar h4 {
font-family: Arial, sans-serif;
color: #222222;
font-size: 1.2em;
font-weight: bold;
margin: 0;
padding: 5px 10px;
text-shadow: 1px 1px 0 white
}
div.sphinxsidebar h3 a {
color: #444444;
}
div.sphinxsidebar p {
color: #888888;
padding: 5px 20px;
margin: 0.5em 0px;
}
div.sphinxsidebar p.topless {
}
div.sphinxsidebar ul {
margin: 10px 10px 10px 20px;
padding: 0;
color: #000000;
}
div.sphinxsidebar a {
color: #444444;
}
div.sphinxsidebar a:hover {
color: #E32E00;
}
div.sphinxsidebar input {
border: 1px solid #cccccc;
font-family: sans-serif;
font-size: 1.1em;
padding: 0.15em 0.3em;
}
div.sphinxsidebar input[type=text]{
margin-left: 20px;
}
/* -- body styles ----------------------------------------------------------- */
a {
color: #005B81;
text-decoration: none;
}
a:hover {
color: #E32E00;
}
div.body h1,
div.body h2,
div.body h3,
div.body h4,
div.body h5,
div.body h6 {
font-family: Arial, sans-serif;
font-weight: normal;
color: #212224;
margin: 30px 0px 10px 0px;
padding: 5px 0 5px 0px;
text-shadow: 0px 1px 0 white;
border-bottom: 1px solid #C8D5E3;
}
div.body h1 { margin-top: 0; font-size: 200%; }
div.body h2 { font-size: 150%; }
div.body h3 { font-size: 120%; }
div.body h4 { font-size: 110%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
a.headerlink {
color: #c60f0f;
font-size: 0.8em;
padding: 0 4px 0 4px;
text-decoration: none;
}
a.headerlink:hover {
background-color: #c60f0f;
color: white;
}
div.body p, div.body dd, div.body li {
line-height: 1.8em;
}
div.admonition p.admonition-title + p {
display: inline;
}
div.highlight{
background-color: white;
}
div.note {
background-color: #eeeeee;
border: 1px solid #cccccc;
}
div.seealso {
background-color: #ffffcc;
border: 1px solid #ffff66;
}
div.topic {
background-color: #fafafa;
border-width: 0;
}
div.warning {
background-color: #ffe4e4;
border: 1px solid #ff6666;
}
p.admonition-title {
display: inline;
}
p.admonition-title:after {
content: ":";
}
pre {
padding: 10px;
background-color: #fafafa;
color: #222222;
line-height: 1.5em;
font-size: 1.1em;
margin: 1.5em 0 1.5em 0;
-webkit-box-shadow: 0px 0px 4px #d8d8d8;
-moz-box-shadow: 0px 0px 4px #d8d8d8;
box-shadow: 0px 0px 4px #d8d8d8;
}
tt {
color: #222222;
padding: 1px 2px;
font-size: 1.2em;
font-family: monospace;
}
#table-of-contents ul {
padding-left: 2em;
}
@@ -1,54 +0,0 @@
.c { color: #999988; font-style: italic } /* Comment */
.k { font-weight: bold } /* Keyword */
.o { font-weight: bold } /* Operator */
.cm { color: #999988; font-style: italic } /* Comment.Multiline */
.cp { color: #999999; font-weight: bold } /* Comment.preproc */
.c1 { color: #999988; font-style: italic } /* Comment.Single */
.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #aa0000 } /* Generic.Error */
.gh { color: #999999 } /* Generic.Heading */
.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.go { color: #111 } /* Generic.Output */
.gp { color: #555555 } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #aaaaaa } /* Generic.Subheading */
.gt { color: #aa0000 } /* Generic.Traceback */
.kc { font-weight: bold } /* Keyword.Constant */
.kd { font-weight: bold } /* Keyword.Declaration */
.kp { font-weight: bold } /* Keyword.Pseudo */
.kr { font-weight: bold } /* Keyword.Reserved */
.kt { color: #445588; font-weight: bold } /* Keyword.Type */
.m { color: #009999 } /* Literal.Number */
.s { color: #bb8844 } /* Literal.String */
.na { color: #008080 } /* Name.Attribute */
.nb { color: #999999 } /* Name.Builtin */
.nc { color: #445588; font-weight: bold } /* Name.Class */
.no { color: #ff99ff } /* Name.Constant */
.ni { color: #800080 } /* Name.Entity */
.ne { color: #990000; font-weight: bold } /* Name.Exception */
.nf { color: #990000; font-weight: bold } /* Name.Function */
.nn { color: #555555 } /* Name.Namespace */
.nt { color: #000080 } /* Name.Tag */
.nv { color: purple } /* Name.Variable */
.ow { font-weight: bold } /* Operator.Word */
.mf { color: #009999 } /* Literal.Number.Float */
.mh { color: #009999 } /* Literal.Number.Hex */
.mi { color: #009999 } /* Literal.Number.Integer */
.mo { color: #009999 } /* Literal.Number.Oct */
.sb { color: #bb8844 } /* Literal.String.Backtick */
.sc { color: #bb8844 } /* Literal.String.Char */
.sd { color: #bb8844 } /* Literal.String.Doc */
.s2 { color: #bb8844 } /* Literal.String.Double */
.se { color: #bb8844 } /* Literal.String.Escape */
.sh { color: #bb8844 } /* Literal.String.Heredoc */
.si { color: #bb8844 } /* Literal.String.Interpol */
.sx { color: #bb8844 } /* Literal.String.Other */
.sr { color: #808000 } /* Literal.String.Regex */
.s1 { color: #bb8844 } /* Literal.String.Single */
.ss { color: #bb8844 } /* Literal.String.Symbol */
.bp { color: #999999 } /* Name.Builtin.Pseudo */
.vc { color: #ff99ff } /* Name.Variable.Class */
.vg { color: #ff99ff } /* Name.Variable.Global */
.vi { color: #ff99ff } /* Name.Variable.Instance */
.il { color: #009999 } /* Literal.Number.Integer.Long */
-36
View File
@@ -1,36 +0,0 @@
Welcome to Distribute's documentation!
======================================
`Distribute` is a fork of the `Setuptools` project.
Distribute is intended to replace Setuptools as the standard method for
working with Python module distributions.
For those who may wonder why they should switch to Distribute over Setuptools, its quite simple:
- Distribute is a drop-in replacement for Setuptools
- The code is actively maintained, and has over 10 commiters
- Distribute offers Python 3 support !
Documentation content:
.. toctree::
:maxdepth: 2
roadmap
python3
using
setuptools
easy_install
pkg_resources
.. image:: http://python-distribute.org/pip_distribute.png
Design done by Idan Gazit (http://pixane.com) - License: cc-by-3.0
Copy & paste::
curl -O http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip
File diff suppressed because it is too large Load Diff
-86
View File
@@ -1,86 +0,0 @@
=======
Roadmap
=======
Distribute has two branches:
- 0.6.x : provides a Setuptools-0.6cX compatible version
- 0.7.x : will provide a refactoring
0.6.x
=====
Not "much" is going to happen here, we want this branch to be helpful
to the community *today* by addressing the 40-or-so bugs
that were found in Setuptools and never fixed. This is eventually
happen soon because its development is
fast : there are up to 5 commiters that are working on it very often
(and the number grows weekly.)
The biggest issue with this branch is that it is providing the same
packages and modules setuptools does, and this
requires some bootstrapping work where we make sure once Distribute is
installed, all Distribution that requires Setuptools
will continue to work. This is done by faking the metadata of
Setuptools 0.6c9. That's the only way we found to do this.
There's one major thing though: thanks to the work of Lennart, Alex,
Martin, this branch supports Python 3,
which is great to have to speed up Py3 adoption.
The goal of the 0.6.x is to remove as much bugs as we can, and try if
possible to remove the patches done
on Distutils. We will support 0.6.x maintenance for years and we will
promote its usage everywhere instead of
Setuptools.
Some new commands are added there, when they are helpful and don't
interact with the rest. I am thinking
about "upload_docs" that let you upload documentation to PyPI. The
goal is to move it to Distutils
at some point, if the documentation feature of PyPI stays and starts to be used.
0.7.x
=====
We've started to refactor Distribute with this roadmap in mind (and
no, as someone said, it's not vaporware,
we've done a lot already)
- 0.7.x can be installed and used with 0.6.x
- easy_install is going to be deprecated ! use Pip !
- the version system will be deprecated, in favor of the one in Distutils
- no more Distutils monkey-patch that happens once you use the code
(things like 'from distutils import cmd; cmd.Command = CustomCommand')
- no more custom site.py (that is: if something misses in Python's
site.py we'll add it there instead of patching it)
- no more namespaced packages system, if PEP 382 (namespaces package
support) makes it to 2.7
- The code is splitted in many packages and might be distributed under
several distributions.
- distribute.resources: that's the old pkg_resources, but
reorganized in clean, pep-8 modules. This package will
only contain the query APIs and will focus on being PEP 376
compatible. We will promote its usage and see if Pip wants
to use it as a basis.
It will probably shrink a lot though, once the stdlib provides PEP 376 support.
- distribute.entrypoints: that's the old pkg_resources entry points
system, but on its own. it uses distribute.resources
- distribute.index: that's package_index and a few other things.
everything required to interact with PyPI. We will promote
its usage and see if Pip wants to use it as a basis.
- distribute.core (might be renamed to main): that's everything
else, and uses the other packages.
Goal: A first release before (or when) Python 2.7 / 3.2 is out.
File diff suppressed because it is too large Load Diff
-21
View File
@@ -1,21 +0,0 @@
================================
Using Distribute in your project
================================
To use Distribute in your project, the recommended way is to ship
`distribute_setup.py` alongside your `setup.py` script and call
it at the very begining of `setup.py` like this::
from distribute_setup import use_setuptools
use_setuptools()
Another way is to add ``Distribute`` in the ``install_requires`` option::
from setuptools import setup
setup(...
install_requires=['distribute']
)
XXX to be finished
-170
View File
@@ -1,170 +0,0 @@
#!/usr/bin/env python
"""
Script to fully automate the release process. Requires Python 2.6+
with sphinx installed and the 'hg' command on the path.
"""
from __future__ import print_function
import subprocess
import shutil
import os
import sys
import urllib2
import getpass
import collections
try:
import keyring
except Exception:
pass
VERSION = '0.6.36'
def get_next_version():
digits = map(int, VERSION.split('.'))
digits[-1] += 1
return '.'.join(map(str, digits))
NEXT_VERSION = get_next_version()
files_with_versions = ('docs/conf.py', 'setup.py', 'release.py',
'README.txt', 'distribute_setup.py')
def get_repo_name():
"""
Get the repo name from the hgrc default path.
"""
default = subprocess.check_output('hg paths default').strip()
parts = default.split('/')
if parts[-1] == '':
parts.pop()
return '/'.join(parts[-2:])
def get_mercurial_creds(system='https://bitbucket.org', username=None):
"""
Return named tuple of username,password in much the same way that
Mercurial would (from the keyring).
"""
# todo: consider getting this from .hgrc
username = username or getpass.getuser()
keyring_username = '@@'.join((username, system))
system = 'Mercurial'
password = (
keyring.get_password(system, keyring_username)
if 'keyring' in globals()
else None
)
if not password:
password = getpass.getpass()
Credential = collections.namedtuple('Credential', 'username password')
return Credential(username, password)
def add_milestone_and_version(version=NEXT_VERSION):
auth = 'Basic ' + ':'.join(get_mercurial_creds()).encode('base64').strip()
headers = {
'Authorization': auth,
}
base = 'https://api.bitbucket.org'
for type in 'milestones', 'versions':
url = (base + '/1.0/repositories/{repo}/issues/{type}'
.format(repo = get_repo_name(), type=type))
req = urllib2.Request(url = url, headers = headers,
data='name='+version)
try:
urllib2.urlopen(req)
except urllib2.HTTPError as e:
print(e.fp.read())
def bump_versions():
list(map(bump_version, files_with_versions))
def bump_version(filename):
with open(filename, 'rb') as f:
lines = [line.replace(VERSION, NEXT_VERSION) for line in f]
with open(filename, 'wb') as f:
f.writelines(lines)
def do_release():
assert all(map(os.path.exists, files_with_versions)), (
"Expected file(s) missing")
assert has_sphinx(), "You must have Sphinx installed to release"
res = raw_input('Have you read through the SCM changelog and '
'confirmed the changelog is current for releasing {VERSION}? '
.format(**globals()))
if not res.lower().startswith('y'):
print("Please do that")
raise SystemExit(1)
print("Travis-CI tests: http://travis-ci.org/#!/jaraco/distribute")
res = raw_input('Have you or has someone verified that the tests '
'pass on this revision? ')
if not res.lower().startswith('y'):
print("Please do that")
raise SystemExit(2)
subprocess.check_call(['hg', 'tag', VERSION])
subprocess.check_call(['hg', 'update', VERSION])
has_docs = build_docs()
if os.path.isdir('./dist'):
shutil.rmtree('./dist')
cmd = [sys.executable, 'setup.py', '-q', 'egg_info', '-RD', '-b', '',
'sdist', 'register', 'upload']
if has_docs:
cmd.append('upload_docs')
subprocess.check_call(cmd)
upload_bootstrap_script()
# update to the tip for the next operation
subprocess.check_call(['hg', 'update'])
# we just tagged the current version, bump for the next release.
bump_versions()
subprocess.check_call(['hg', 'ci', '-m',
'Bumped to {NEXT_VERSION} in preparation for next '
'release.'.format(**globals())])
# push the changes
subprocess.check_call(['hg', 'push'])
add_milestone_and_version()
def has_sphinx():
try:
devnull = open(os.path.devnull, 'wb')
subprocess.Popen(['sphinx-build', '--version'], stdout=devnull,
stderr=subprocess.STDOUT).wait()
except Exception:
return False
return True
def build_docs():
if not os.path.isdir('docs'):
return
if os.path.isdir('docs/build'):
shutil.rmtree('docs/build')
subprocess.check_call([
'sphinx-build',
'-b', 'html',
'-d', 'build/doctrees',
'.',
'build/html',
],
cwd='docs')
return True
def upload_bootstrap_script():
scp_command = 'pscp' if sys.platform.startswith('win') else 'scp'
try:
subprocess.check_call([scp_command, 'distribute_setup.py',
'pypi@ziade.org:python-distribute.org/'])
except:
print("Unable to upload bootstrap script. Ask Tarek to do it.")
if __name__ == '__main__':
do_release()
Binary file not shown.
Binary file not shown.
@@ -1,41 +0,0 @@
from distutils.command.bdist_wininst import bdist_wininst as _bdist_wininst
import os, sys
class bdist_wininst(_bdist_wininst):
def create_exe(self, arcname, fullname, bitmap=None):
_bdist_wininst.create_exe(self, arcname, fullname, bitmap)
dist_files = getattr(self.distribution, 'dist_files', [])
if self.target_version:
installer_name = os.path.join(self.dist_dir,
"%s.win32-py%s.exe" %
(fullname, self.target_version))
pyversion = self.target_version
# fix 2.5 bdist_wininst ignoring --target-version spec
bad = ('bdist_wininst','any',installer_name)
if bad in dist_files:
dist_files.remove(bad)
else:
installer_name = os.path.join(self.dist_dir,
"%s.win32.exe" % fullname)
pyversion = 'any'
good = ('bdist_wininst', pyversion, installer_name)
if good not in dist_files:
dist_files.append(good)
def reinitialize_command (self, command, reinit_subcommands=0):
cmd = self.distribution.reinitialize_command(
command, reinit_subcommands)
if command in ('install', 'install_lib'):
cmd.install_lib = None # work around distutils bug
return cmd
def run(self):
self._is_running = True
try:
_bdist_wininst.run(self)
finally:
self._is_running = False
-185
View File
@@ -1,185 +0,0 @@
"""distutils.command.upload
Implements the Distutils 'upload' subcommand (upload package to PyPI)."""
from distutils.errors import *
from distutils.core import Command
from distutils.spawn import spawn
from distutils import log
try:
from hashlib import md5
except ImportError:
from md5 import md5
import os
import socket
import platform
import ConfigParser
import httplib
import base64
import urlparse
import cStringIO as StringIO
class upload(Command):
description = "upload binary package to PyPI"
DEFAULT_REPOSITORY = 'http://pypi.python.org/pypi'
user_options = [
('repository=', 'r',
"url of repository [default: %s]" % DEFAULT_REPOSITORY),
('show-response', None,
'display full response text from server'),
('sign', 's',
'sign files to upload using gpg'),
('identity=', 'i', 'GPG identity used to sign files'),
]
boolean_options = ['show-response', 'sign']
def initialize_options(self):
self.username = ''
self.password = ''
self.repository = ''
self.show_response = 0
self.sign = False
self.identity = None
def finalize_options(self):
if self.identity and not self.sign:
raise DistutilsOptionError(
"Must use --sign for --identity to have meaning"
)
if os.environ.has_key('HOME'):
rc = os.path.join(os.environ['HOME'], '.pypirc')
if os.path.exists(rc):
self.announce('Using PyPI login from %s' % rc)
config = ConfigParser.ConfigParser({
'username':'',
'password':'',
'repository':''})
config.read(rc)
if not self.repository:
self.repository = config.get('server-login', 'repository')
if not self.username:
self.username = config.get('server-login', 'username')
if not self.password:
self.password = config.get('server-login', 'password')
if not self.repository:
self.repository = self.DEFAULT_REPOSITORY
def run(self):
if not self.distribution.dist_files:
raise DistutilsOptionError("No dist file created in earlier command")
for command, pyversion, filename in self.distribution.dist_files:
self.upload_file(command, pyversion, filename)
def upload_file(self, command, pyversion, filename):
# Sign if requested
if self.sign:
gpg_args = ["gpg", "--detach-sign", "-a", filename]
if self.identity:
gpg_args[2:2] = ["--local-user", self.identity]
spawn(gpg_args,
dry_run=self.dry_run)
# Fill in the data
f = open(filename,'rb')
content = f.read()
f.close()
basename = os.path.basename(filename)
comment = ''
if command=='bdist_egg' and self.distribution.has_ext_modules():
comment = "built on %s" % platform.platform(terse=1)
data = {
':action':'file_upload',
'protocol_version':'1',
'name':self.distribution.get_name(),
'version':self.distribution.get_version(),
'content':(basename,content),
'filetype':command,
'pyversion':pyversion,
'md5_digest':md5(content).hexdigest(),
}
if command == 'bdist_rpm':
dist, version, id = platform.dist()
if dist:
comment = 'built for %s %s' % (dist, version)
elif command == 'bdist_dumb':
comment = 'built for %s' % platform.platform(terse=1)
data['comment'] = comment
if self.sign:
asc_file = open(filename + ".asc")
data['gpg_signature'] = (os.path.basename(filename) + ".asc", asc_file.read())
asc_file.close()
# set up the authentication
auth = "Basic " + base64.encodestring(self.username + ":" + self.password).strip()
# Build up the MIME payload for the POST data
boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254'
sep_boundary = '\n--' + boundary
end_boundary = sep_boundary + '--'
body = StringIO.StringIO()
for key, value in data.items():
# handle multiple entries for the same name
if type(value) != type([]):
value = [value]
for value in value:
if type(value) is tuple:
fn = ';filename="%s"' % value[0]
value = value[1]
else:
fn = ""
value = str(value)
body.write(sep_boundary)
body.write('\nContent-Disposition: form-data; name="%s"'%key)
body.write(fn)
body.write("\n\n")
body.write(value)
if value and value[-1] == '\r':
body.write('\n') # write an extra newline (lurve Macs)
body.write(end_boundary)
body.write("\n")
body = body.getvalue()
self.announce("Submitting %s to %s" % (filename, self.repository), log.INFO)
# build the Request
# We can't use urllib2 since we need to send the Basic
# auth right with the first request
schema, netloc, url, params, query, fragments = \
urlparse.urlparse(self.repository)
assert not params and not query and not fragments
if schema == 'http':
http = httplib.HTTPConnection(netloc)
elif schema == 'https':
http = httplib.HTTPSConnection(netloc)
else:
raise AssertionError, "unsupported schema "+schema
data = ''
loglevel = log.INFO
try:
http.connect()
http.putrequest("POST", url)
http.putheader('Content-type',
'multipart/form-data; boundary=%s'%boundary)
http.putheader('Content-length', str(len(body)))
http.putheader('Authorization', auth)
http.endheaders()
http.send(body)
except socket.error, e:
self.announce(str(e), log.ERROR)
return
r = http.getresponse()
if r.status == 200:
self.announce('Server response (%s): %s' % (r.status, r.reason),
log.INFO)
else:
self.announce('Upload failed (%s): %s' % (r.status, r.reason),
log.ERROR)
if self.show_response:
print '-'*75, r.read(), '-'*75
@@ -1,6 +0,0 @@
# EASY-INSTALL-DEV-SCRIPT: %(spec)r,%(script_name)r
__requires__ = """%(spec)r"""
from pkg_resources import require; require("""%(spec)r""")
del require
__file__ = """%(dev_path)r"""
execfile(__file__)
-75
View File
@@ -1,75 +0,0 @@
import urllib2
import sys
import os
if os.path.exists('distribute_setup.py'):
print 'distribute_setup.py exists in the current dir, aborting'
sys.exit(2)
print '**** Starting Test'
print '\n\n'
is_jython = sys.platform.startswith('java')
if is_jython:
import subprocess
print 'Downloading bootstrap'
file = urllib2.urlopen('http://nightly.ziade.org/distribute_setup.py')
f = open('distribute_setup.py', 'w')
f.write(file.read())
f.close()
# running it
args = [sys.executable] + ['distribute_setup.py']
if is_jython:
res = subprocess.call(args)
else:
res = os.spawnv(os.P_WAIT, sys.executable, args)
if res != 0:
print '**** Test failed, please send me the output at tarek@ziade.org'
os.remove('distribute_setup.py')
sys.exit(2)
# now checking if Distribute is installed
script = """\
import sys
try:
import setuptools
except ImportError:
sys.exit(0)
sys.exit(hasattr(setuptools, "_distribute"))
"""
root = 'script'
seed = 0
script_name = '%s%d.py' % (root, seed)
while os.path.exists(script_name):
seed += 1
script_name = '%s%d.py' % (root, seed)
f = open(script_name, 'w')
try:
f.write(script)
finally:
f.close()
try:
args = [sys.executable] + [script_name]
if is_jython:
res = subprocess.call(args)
else:
res = os.spawnv(os.P_WAIT, sys.executable, args)
print '\n\n'
if res:
print '**** Test is OK'
else:
print '**** Test failed, please send me the output at tarek@ziade.org'
finally:
if os.path.exists(script_name):
os.remove(script_name)
os.remove('distribute_setup.py')
-776
View File
@@ -1,776 +0,0 @@
Metadata-Version: 1.1
Name: pip
Version: 1.3.1
Summary: A tool for installing and managing Python packages.
Home-page: http://www.pip-installer.org
Author: The pip developers
Author-email: python-virtualenv@groups.google.com
License: MIT
Description:
Project Info
============
* Project Page: https://github.com/pypa/pip
* Bug Tracking: https://github.com/pypa/pip/issues
* Mailing list: http://groups.google.com/group/python-virtualenv
* Docs: http://www.pip-installer.org
* IRC: #pip.
Quickstart
==========
Install a package:
::
$ pip install SomePackage==1.0
[...]
Successfully installed SomePackage
Show what files were installed:
::
$ pip show --files SomePackage
Name: SomePackage
Version: 1.0
Location: /my/env/lib/pythonx.x/site-packages
Files:
../somepackage/__init__.py
[...]
List what packages are outdated:
::
$ pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
Upgrade a package:
::
$ pip install --upgrade SomePackage
[...]
Found existing installation: SomePackage 1.0
Uninstalling SomePackage:
Successfully uninstalled SomePackage
Running setup.py install for SomePackage
Successfully installed SomePackage
Uninstall a package:
::
$ pip uninstall SomePackage
Uninstalling SomePackage:
/my/env/lib/pythonx.x/site-packages/somepackage
Proceed (y/n)? y
Successfully uninstalled SomePackage
Changelog
=========
1.3.1 (2013-03-08)
------------------
* Fixed a major backward incompatible change of parsing URLs to externally
hosted packages that got accidentily included in 1.3.
1.3 (2013-03-07)
----------------
* SSL Cert Verification; Make https the default for PyPI access.
Thanks James Cleveland, Giovanni Bajo, Marcus Smith and many others (Pull #789).
* Added "pip list" for listing installed packages and the latest version
available. Thanks Rafael Caricio, Miguel Araujo, Dmitry Gladkov (Pull #752)
* Fixed security issues with pip's use of temp build directories.
Thanks David (d1b) and Thomas Guttler. (Pull #780)
* Improvements to sphinx docs and cli help. (Pull #773)
* Fixed issue #707, dealing with OS X temp dir handling, which was causing
global NumPy installs to fail. (Pull #768)
* Split help output into general vs command-specific option groups.
Thanks Georgi Valkov. (Pull #744; Pull #721 contains preceding refactor)
* Fixed dependency resolution when installing from archives with uppercase
project names. (Pull #724)
* Fixed problem where re-installs always occurred when using file:// find-links.
(Pulls #683/#702)
* "pip install -v" now shows the full download url, not just the archive name.
Thanks Marc Abramowitz (Pull #687)
* Fix to prevent unnecessary PyPI redirects. Thanks Alex Gronholm (Pull #695)
* Fixed issue #670 - install failure under Python 3 when the same version
of a package is found under 2 different URLs. Thanks Paul Moore (Pull #671)
* Fix git submodule recursive updates. Thanks Roey Berman. (Pulls #674)
* Explicitly ignore rel='download' links while looking for html pages.
Thanks Maxime R. (Pull #677)
* --user/--upgrade install options now work together. Thanks 'eevee' for
discovering the problem. (Pull #705)
* Added check in ``install --download`` to prevent re-downloading if the target
file already exists. Thanks Andrey Bulgakov. (Pull #669)
* Added support for bare paths (including relative paths) as argument to
`--find-links`. Thanks Paul Moore for draft patch.
* Added support for --no-index in requirements files.
* Added "pip show" command to get information about an installed package.
Fixes #131. Thanks Kelsey Hightower and Rafael Caricio.
* Added `--root` option for "pip install" to specify root directory. Behaves
like the same option in distutils but also plays nice with pip's egg-info.
Thanks Przemek Wrzos. (Issue #253 / Pull #693)
1.2.1 (2012-09-06)
------------------
* Fixed a regression introduced in 1.2 about raising an exception when
not finding any files to uninstall in the current environment. Thanks for
the fix, Marcus Smith.
1.2 (2012-09-01)
----------------
* **Dropped support for Python 2.4** The minimum supported Python version is
now Python 2.5.
* Fixed issue #605 - pypi mirror support broken on some DNS responses. Thanks
philwhin.
* Fixed issue #355 - pip uninstall removes files it didn't install. Thanks
pjdelport.
* Fixed issues #493, #494, #440, and #573 related to improving support for the
user installation scheme. Thanks Marcus Smith.
* Write failure log to temp file if default location is not writable. Thanks
andreigc.
* Pull in submodules for git editable checkouts. Fixes #289 and #421. Thanks
Hsiaoming Yang and Markus Hametner.
* Use a temporary directory as the default build location outside of a
virtualenv. Fixes issues #339 and #381. Thanks Ben Rosser.
* Added support for specifying extras with local editables. Thanks Nick
Stenning.
* Added ``--egg`` flag to request egg-style rather than flat installation. Refs
issue #3. Thanks Kamal Bin Mustafa.
* Fixed issue #510 - prevent e.g. ``gmpy2-2.0.tar.gz`` from matching a request
to ``pip install gmpy``; sdist filename must begin with full project name
followed by a dash. Thanks casevh for the report.
* Fixed issue #504 - allow package URLS to have querystrings. Thanks W.
Trevor King.
* Fixed issue #58 - pip freeze now falls back to non-editable format rather
than blowing up if it can't determine the origin repository of an editable.
Thanks Rory McCann.
* Added a `__main__.py` file to enable `python -m pip` on Python versions
that support it. Thanks Alexey Luchko.
* Fixed issue #487 - upgrade from VCS url of project that does exist on
index. Thanks Andrew Knapp for the report.
* Fixed issue #486 - fix upgrade from VCS url of project with no distribution
on index. Thanks Andrew Knapp for the report.
* Fixed issue #427 - clearer error message on a malformed VCS url. Thanks
Thomas Fenzl.
* Added support for using any of the built in guaranteed algorithms in
``hashlib`` as a checksum hash.
* Fixed issue #321 - Raise an exception if current working directory can't be
found or accessed.
* Fixed issue #82 - Removed special casing of the user directory and use the
Python default instead.
* Fixed #436 - Only warn about version conflicts if there is actually one.
This re-enables using ``==dev`` in requirements files.
* Moved tests to be run on Travis CI: http://travis-ci.org/pypa/pip
* Added a better help formatter.
1.1 (2012-02-16)
----------------
* Fixed issue #326 - don't crash when a package's setup.py emits UTF-8 and
then fails. Thanks Marc Abramowitz.
* Added ``--target`` option for installing directly to arbitrary directory.
Thanks Stavros Korokithakis.
* Added support for authentication with Subversion repositories. Thanks
Qiangning Hong.
* Fixed issue #315 - ``--download`` now downloads dependencies as well.
Thanks Qiangning Hong.
* Errors from subprocesses will display the current working directory.
Thanks Antti Kaihola.
* Fixed issue #369 - compatibility with Subversion 1.7. Thanks Qiangning
Hong. Note that setuptools remains incompatible with Subversion 1.7; to
get the benefits of pip's support you must use Distribute rather than
setuptools.
* Fixed issue #57 - ignore py2app-generated OS X mpkg zip files in finder.
Thanks Rene Dudfield.
* Fixed issue #182 - log to ~/Library/Logs/ by default on OS X framework
installs. Thanks Dan Callahan for report and patch.
* Fixed issue #310 - understand version tags without minor version ("py3")
in sdist filenames. Thanks Stuart Andrews for report and Olivier Girardot for
patch.
* Fixed issue #7 - Pip now supports optionally installing setuptools
"extras" dependencies; e.g. "pip install Paste[openid]". Thanks Matt Maker
and Olivier Girardot.
* Fixed issue #391 - freeze no longer borks on requirements files with
--index-url or --find-links. Thanks Herbert Pfennig.
* Fixed issue #288 - handle symlinks properly. Thanks lebedov for the patch.
* Fixed issue #49 - pip install -U no longer reinstalls the same versions of
packages. Thanks iguananaut for the pull request.
* Removed ``-E``/``--environment`` option and ``PIP_RESPECT_VIRTUALENV``;
both use a restart-in-venv mechanism that's broken, and neither one is
useful since every virtualenv now has pip inside it. Replace ``pip -E
path/to/venv install Foo`` with ``virtualenv path/to/venv &&
path/to/venv/pip install Foo``.
* Fixed issue #366 - pip throws IndexError when it calls `scraped_rel_links`
* Fixed issue #22 - pip search should set and return a userful shell status code
* Fixed issue #351 and #365 - added global ``--exists-action`` command line
option to easier script file exists conflicts, e.g. from editable
requirements from VCS that have a changed repo URL.
1.0.2 (2011-07-16)
------------------
* Fixed docs issues.
* Fixed issue #295 - Reinstall a package when using the ``install -I`` option
* Fixed issue #283 - Finds a Git tag pointing to same commit as origin/master
* Fixed issue #279 - Use absolute path for path to docs in setup.py
* Fixed issue #314 - Correctly handle exceptions on Python3.
* Fixed issue #320 - Correctly parse ``--editable`` lines in requirements files
1.0.1 (2011-04-30)
------------------
* Start to use git-flow.
* Fixed issue #274 - `find_command` should not raise AttributeError
* Fixed issue #273 - respect Content-Disposition header. Thanks Bradley Ayers.
* Fixed issue #233 - pathext handling on Windows.
* Fixed issue #252 - svn+svn protocol.
* Fixed issue #44 - multiple CLI searches.
* Fixed issue #266 - current working directory when running setup.py clean.
1.0 (2011-04-04)
----------------
* Added Python 3 support! Huge thanks to Vinay Sajip, Vitaly Babiy, Kelsey
Hightower, and Alex Gronholm, among others.
* Download progress only shown on a real TTY. Thanks Alex Morega.
* Fixed finding of VCS binaries to not be fooled by same-named directories.
Thanks Alex Morega.
* Fixed uninstall of packages from system Python for users of Debian/Ubuntu
python-setuptools package (workaround until fixed in Debian and Ubuntu).
* Added `get-pip.py <https://raw.github.com/pypa/pip/master/contrib/get-pip.py>`_
installer. Simply download and execute it, using the Python interpreter of
your choice::
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ python get-pip.py
This may have to be run as root.
.. note::
Make sure you have `distribute <http://pypi.python.org/pypi/distribute>`_
installed before using the installer!
0.8.3
-----
* Moved main repository to Github: https://github.com/pypa/pip
* Transferred primary maintenance from Ian to Jannis Leidel, Carl Meyer, Brian Rosner
* Fixed issue #14 - No uninstall-on-upgrade with URL package. Thanks Oliver Tonnhofer
* Fixed issue #163 - Egg name not properly resolved. Thanks Igor Sobreira
* Fixed issue #178 - Non-alphabetical installation of requirements. Thanks Igor Sobreira
* Fixed issue #199 - Documentation mentions --index instead of --index-url. Thanks Kelsey Hightower
* Fixed issue #204 - rmtree undefined in mercurial.py. Thanks Kelsey Hightower
* Fixed bug in Git vcs backend that would break during reinstallation.
* Fixed bug in Mercurial vcs backend related to pip freeze and branch/tag resolution.
* Fixed bug in version string parsing related to the suffix "-dev".
0.8.2
-----
* Avoid redundant unpacking of bundles (from pwaller)
* Fixed issue #32, #150, #161 - Fixed checking out the correct
tag/branch/commit when updating an editable Git requirement.
* Fixed issue #49 - Added ability to install version control requirements
without making them editable, e.g.::
pip install git+https://github.com/pypa/pip/
* Fixed issue #175 - Correctly locate build and source directory on Mac OS X.
* Added ``git+https://`` scheme to Git VCS backend.
0.8.1
-----
* Added global --user flag as shortcut for --install-option="--user". From
Ronny Pfannschmidt.
* Added support for `PyPI mirrors <http://pypi.python.org/mirrors>`_ as
defined in `PEP 381 <http://www.python.org/dev/peps/pep-0381/>`_, from
Jannis Leidel.
* Fixed issue #138 - Git revisions ignored. Thanks John-Scott Atlakson.
* Fixed issue #95 - Initial editable install of github package from a tag fails. Thanks John-Scott Atlakson.
* Fixed issue #107 - Can't install if a directory in cwd has the same name as the package you're installing.
* Fixed issue #39 - --install-option="--prefix=~/.local" ignored with -e.
Thanks Ronny Pfannschmidt and Wil Tan.
0.8
---
* Track which ``build/`` directories pip creates, never remove directories
it doesn't create. From Hugo Lopes Tavares.
* Pip now accepts file:// index URLs. Thanks Dave Abrahams.
* Various cleanup to make test-running more consistent and less fragile.
Thanks Dave Abrahams.
* Real Windows support (with passing tests). Thanks Dave Abrahams.
* ``pip-2.7`` etc. scripts are created (Python-version specific scripts)
* ``contrib/build-standalone`` script creates a runnable ``.zip`` form of
pip, from Jannis Leidel
* Editable git repos are updated when reinstalled
* Fix problem with ``--editable`` when multiple ``.egg-info/`` directories
are found.
* A number of VCS-related fixes for ``pip freeze``, from Hugo Lopes Tavares.
* Significant test framework changes, from Hugo Lopes Tavares.
0.7.2
-----
* Set zip_safe=False to avoid problems some people are encountering where
pip is installed as a zip file.
0.7.1
-----
* Fixed opening of logfile with no directory name. Thanks Alexandre Conrad.
* Temporary files are consistently cleaned up, especially after
installing bundles, also from Alex Conrad.
* Tests now require at least ScriptTest 1.0.3.
0.7
---
* Fixed uninstallation on Windows
* Added ``pip search`` command.
* Tab-complete names of installed distributions for ``pip uninstall``.
* Support tab-completion when there is a global-option before the
subcommand.
* Install header files in standard (scheme-default) location when installing
outside a virtualenv. Install them to a slightly more consistent
non-standard location inside a virtualenv (since the standard location is
a non-writable symlink to the global location).
* pip now logs to a central location by default (instead of creating
``pip-log.txt`` all over the place) and constantly overwrites the
file in question. On Unix and Mac OS X this is ``'$HOME/.pip/pip.log'``
and on Windows it's ``'%HOME%\\pip\\pip.log'``. You are still able to
override this location with the ``$PIP_LOG_FILE`` environment variable.
For a complete (appended) logfile use the separate ``'--log'`` command line
option.
* Fixed an issue with Git that left an editable packge as a checkout of a
remote branch, even if the default behaviour would have been fine, too.
* Fixed installing from a Git tag with older versions of Git.
* Expand "~" in logfile and download cache paths.
* Speed up installing from Mercurial repositories by cloning without
updating the working copy multiple times.
* Fixed installing directly from directories (e.g.
``pip install path/to/dir/``).
* Fixed installing editable packages with ``svn+ssh`` URLs.
* Don't print unwanted debug information when running the freeze command.
* Create log file directory automatically. Thanks Alexandre Conrad.
* Make test suite easier to run successfully. Thanks Dave Abrahams.
* Fixed "pip install ." and "pip install .."; better error for directory
without setup.py. Thanks Alexandre Conrad.
* Support Debian/Ubuntu "dist-packages" in zip command. Thanks duckx.
* Fix relative --src folder. Thanks Simon Cross.
* Handle missing VCS with an error message. Thanks Alexandre Conrad.
* Added --no-download option to install; pairs with --no-install to separate
download and installation into two steps. Thanks Simon Cross.
* Fix uninstalling from requirements file containing -f, -i, or
--extra-index-url.
* Leftover build directories are now removed. Thanks Alexandre Conrad.
0.6.3
-----
* Fixed import error on Windows with regard to the backwards compatibility
package
0.6.2
-----
* Fixed uninstall when /tmp is on a different filesystem.
* Fixed uninstallation of distributions with namespace packages.
0.6.1
-----
* Added support for the ``https`` and ``http-static`` schemes to the
Mercurial and ``ftp`` scheme to the Bazaar backend.
* Fixed uninstallation of scripts installed with easy_install.
* Fixed an issue in the package finder that could result in an
infinite loop while looking for links.
* Fixed issue with ``pip bundle`` and local files (which weren't being
copied into the bundle), from Whit Morriss.
0.6
---
* Add ``pip uninstall`` and uninstall-before upgrade (from Carl
Meyer).
* Extended configurability with config files and environment variables.
* Allow packages to be upgraded, e.g., ``pip install Package==0.1``
then ``pip install Package==0.2``.
* Allow installing/upgrading to Package==dev (fix "Source version does not
match target version" errors).
* Added command and option completion for bash and zsh.
* Extended integration with virtualenv by providing an option to
automatically use an active virtualenv and an option to warn if no active
virtualenv is found.
* Fixed a bug with pip install --download and editable packages, where
directories were being set with 0000 permissions, now defaults to 755.
* Fixed uninstallation of easy_installed console_scripts.
* Fixed uninstallation on Mac OS X Framework layout installs
* Fixed bug preventing uninstall of editables with source outside venv.
* Creates download cache directory if not existing.
0.5.1
-----
* Fixed a couple little bugs, with git and with extensions.
0.5
---
* Added ability to override the default log file name (``pip-log.txt``)
with the environmental variable ``$PIP_LOG_FILE``.
* Made the freeze command print installed packages to stdout instead of
writing them to a file. Use simple redirection (e.g.
``pip freeze > stable-req.txt``) to get a file with requirements.
* Fixed problem with freezing editable packages from a Git repository.
* Added support for base URLs using ``<base href='...'>`` when parsing
HTML pages.
* Fixed installing of non-editable packages from version control systems.
* Fixed issue with Bazaar's bzr+ssh scheme.
* Added --download-dir option to the install command to retrieve package
archives. If given an editable package it will create an archive of it.
* Added ability to pass local file and directory paths to ``--find-links``,
e.g. ``--find-links=file:///path/to/my/private/archive``
* Reduced the amount of console log messages when fetching a page to find a
distribution was problematic. The full messages can be found in pip-log.txt.
* Added ``--no-deps`` option to install ignore package dependencies
* Added ``--no-index`` option to ignore the package index (PyPI) temporarily
* Fixed installing editable packages from Git branches.
* Fixes freezing of editable packages from Mercurial repositories.
* Fixed handling read-only attributes of build files, e.g. of Subversion and
Bazaar on Windows.
* When downloading a file from a redirect, use the redirected
location's extension to guess the compression (happens specifically
when redirecting to a bitbucket.org tip.gz file).
* Editable freeze URLs now always use revision hash/id rather than tip or
branch names which could move.
* Fixed comparison of repo URLs so incidental differences such as
presence/absence of final slashes or quoted/unquoted special
characters don't trigger "ignore/switch/wipe/backup" choice.
* Fixed handling of attempt to checkout editable install to a
non-empty, non-repo directory.
0.4
---
* Make ``-e`` work better with local hg repositories
* Construct PyPI URLs the exact way easy_install constructs URLs (you
might notice this if you use a custom index that is
slash-sensitive).
* Improvements on Windows (from `Ionel Maries Cristian
<http://ionelmc.wordpress.com/>`_).
* Fixed problem with not being able to install private git repositories.
* Make ``pip zip`` zip all its arguments, not just the first.
* Fix some filename issues on Windows.
* Allow the ``-i`` and ``--extra-index-url`` options in requirements
files.
* Fix the way bundle components are unpacked and moved around, to make
bundles work.
* Adds ``-s`` option to allow the access to the global site-packages if a
virtualenv is to be created.
* Fixed support for Subversion 1.6.
0.3.1
-----
* Improved virtualenv restart and various path/cleanup problems on win32.
* Fixed a regression with installing from svn repositories (when not
using ``-e``).
* Fixes when installing editable packages that put their source in a
subdirectory (like ``src/``).
* Improve ``pip -h``
0.3
---
* Added support for editable packages created from Git, Mercurial and Bazaar
repositories and ability to freeze them. Refactored support for version
control systems.
* Do not use ``sys.exit()`` from inside the code, instead use a
return. This will make it easier to invoke programmatically.
* Put the install record in ``Package.egg-info/installed-files.txt``
(previously they went in
``site-packages/install-record-Package.txt``).
* Fix a problem with ``pip freeze`` not including ``-e svn+`` when an
svn structure is peculiar.
* Allow ``pip -E`` to work with a virtualenv that uses a different
version of Python than the parent environment.
* Fixed Win32 virtualenv (``-E``) option.
* Search the links passed in with ``-f`` for packages.
* Detect zip files, even when the file doesn't have a ``.zip``
extension and it is served with the wrong Content-Type.
* Installing editable from existing source now works, like ``pip
install -e some/path/`` will install the package in ``some/path/``.
Most importantly, anything that package requires will also be
installed by pip.
* Add a ``--path`` option to ``pip un/zip``, so you can avoid zipping
files that are outside of where you expect.
* Add ``--simulate`` option to ``pip zip``.
0.2.1
-----
* Fixed small problem that prevented using ``pip.py`` without actually
installing pip.
* Fixed ``--upgrade``, which would download and appear to install
upgraded packages, but actually just reinstall the existing package.
* Fixed Windows problem with putting the install record in the right
place, and generating the ``pip`` script with Setuptools.
* Download links that include embedded spaces or other unsafe
characters (those characters get %-encoded).
* Fixed use of URLs in requirement files, and problems with some blank
lines.
* Turn some tar file errors into warnings.
0.2
---
* Renamed to ``pip``, and to install you now do ``pip install
PACKAGE``
* Added command ``pip zip PACKAGE`` and ``pip unzip PACKAGE``. This
is particularly intended for Google App Engine to manage libraries
to stay under the 1000-file limit.
* Some fixes to bundles, especially editable packages and when
creating a bundle using unnamed packages (like just an svn
repository without ``#egg=Package``).
0.1.4
-----
* Added an option ``--install-option`` to pass options to pass
arguments to ``setup.py install``
* ``.svn/`` directories are no longer included in bundles, as these
directories are specific to a version of svn -- if you build a
bundle on a system with svn 1.5, you can't use the checkout on a
system with svn 1.4. Instead a file ``svn-checkout.txt`` is
included that notes the original location and revision, and the
command you can use to turn it back into an svn checkout. (Probably
unpacking the bundle should, maybe optionally, recreate this
information -- but that is not currently implemented, and it would
require network access.)
* Avoid ambiguities over project name case, where for instance
MyPackage and mypackage would be considered different packages.
This in particular caused problems on Macs, where ``MyPackage/`` and
``mypackage/`` are the same directory.
* Added support for an environmental variable
``$PIP_DOWNLOAD_CACHE`` which will cache package downloads, so
future installations won't require large downloads. Network access
is still required, but just some downloads will be avoided when
using this.
0.1.3
-----
* Always use ``svn checkout`` (not ``export``) so that
``tag_svn_revision`` settings give the revision of the package.
* Don't update checkouts that came from ``.pybundle`` files.
0.1.2
-----
* Improve error text when there are errors fetching HTML pages when
seeking packages.
* Improve bundles: include empty directories, make them work with
editable packages.
* If you use ``-E env`` and the environment ``env/`` doesn't exist, a
new virtual environment will be created.
* Fix ``dependency_links`` for finding packages.
0.1.1
-----
* Fixed a NameError exception when running pip outside of a
virtualenv environment.
* Added HTTP proxy support (from Prabhu Ramachandran)
* Fixed use of ``hashlib.md5`` on python2.5+ (also from Prabhu
Ramachandran)
0.1
---
* Initial release
Keywords: easy_install distutils setuptools egg virtualenv
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Build Tools
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
-8
View File
@@ -1,8 +0,0 @@
Project Info
============
* Project Page: https://github.com/pypa/pip
* Bug Tracking: https://github.com/pypa/pip/issues
* Mailing list: http://groups.google.com/group/python-virtualenv
* Docs: http://www.pip-installer.org
* IRC: #pip.
-124
View File
@@ -1,124 +0,0 @@
.. _`Configuration`:
Configuration
=================
Config file
------------
pip allows you to set all command line option defaults in a standard ini
style config file.
The names and locations of the configuration files vary slightly across
platforms.
* On Unix and Mac OS X the configuration file is: :file:`$HOME/.pip/pip.conf`
* On Windows, the configuration file is: :file:`%HOME%\\pip\\pip.ini`
You can set a custom path location for the config file using the environment variable ``PIP_CONFIG_FILE``.
The names of the settings are derived from the long command line option, e.g.
if you want to use a different package index (``--index-url``) and set the
HTTP timeout (``--default-timeout``) to 60 seconds your config file would
look like this:
.. code-block:: ini
[global]
timeout = 60
index-url = http://download.zope.org/ppix
Each subcommand can be configured optionally in its own section so that every
global setting with the same name will be overridden; e.g. decreasing the
``timeout`` to ``10`` seconds when running the `freeze`
(`Freezing Requirements <./#freezing-requirements>`_) command and using
``60`` seconds for all other commands is possible with:
.. code-block:: ini
[global]
timeout = 60
[freeze]
timeout = 10
Boolean options like ``--ignore-installed`` or ``--no-dependencies`` can be
set like this:
.. code-block:: ini
[install]
ignore-installed = true
no-dependencies = yes
Appending options like ``--find-links`` can be written on multiple lines:
.. code-block:: ini
[global]
find-links =
http://download.example.com
[install]
find-links =
http://mirror1.example.com
http://mirror2.example.com
Environment Variables
---------------------
pip's command line options can be set with
environment variables using the format ``PIP_<UPPER_LONG_NAME>`` . Dashes (``-``) have to replaced with underscores (``_``).
For example, to set the default timeout::
export PIP_DEFAULT_TIMEOUT=60
This is the same as passing the option to pip directly::
pip --default-timeout=60 [...]
To set options that can be set multiple times on the command line, just add spaces in between values. For example::
export PIP_FIND_LINKS="http://mirror1.example.com http://mirror2.example.com"
is the same as calling::
pip install --find-links=http://mirror1.example.com --find-links=http://mirror2.example.com
Config Precedence
-----------------
Command line options have precedence over environment variables, which have precedence over the config file.
Within the config file, command specific sections have precedence over the global section.
Examples:
- ``--host=foo`` overrides ``PIP_HOST=foo``
- ``PIP_HOST=foo`` overrides a config file with ``[global] host = foo``
- A command specific section in the config file ``[<command>] host = bar``
overrides the option with same name in the ``[global]`` config file section
Command Completion
------------------
pip comes with support for command line completion in bash and zsh.
To setup for bash::
$ pip completion --bash >> ~/.profile
To setup for zsh::
$ pip completion --zsh >> ~/.zprofile
Alternatively, you can use the result of the ``completion`` command
directly with the eval function of you shell, e.g. by adding the following to your startup file::
eval "`pip completion --bash`"
-131
View File
@@ -1,131 +0,0 @@
============
Cookbook
============
.. _`Requirements Files`:
Requirements Files
******************
A key idea in pip is that package versions listed in requirement files (or as :ref:`pip install` arguments),
have precedence over those that are located during the normal dependency resolution process that uses "install_requires" metadata.
This allows users to be in control of specifying an environment of packages that are known to work together.
Instead of running something like ``pip install MyApp`` and getting whatever libraries come along,
you'd run ``pip install -r requirements.txt`` where "requirements.txt" contains something like::
MyApp
Framework==0.9.4
Library>=0.2
Regardless of what MyApp lists in ``setup.py``, you'll get a specific version
of Framework (0.9.4) and at least the 0.2 version of
Library. Additionally, you can add optional libraries and support tools that MyApp doesn't strictly
require, giving people a set of recommended libraries.
Requirement files are intended to exhaust an environment and to be *flat*.
Maybe ``MyApp`` requires ``Framework``, and ``Framework`` requires ``Library``.
It is encouraged to still list all these in a single requirement file.
It is the nature of Python programs that there are implicit bindings *directly*
between MyApp and Library. For instance, Framework might expose one
of Library's objects, and so if Library is updated it might directly
break MyApp. If that happens you can update the requirements file to
force an earlier version of Library, and you can do that without
having to re-release MyApp at all.
To create a new requirements file from a known working environment, use::
$ pip freeze > stable-req.txt
This will write a listing of *all* installed libraries to ``stable-req.txt``
with exact versions for every library.
For more information, see:
* :ref:`Requirements File Format`
* :ref:`pip freeze`
.. _`Downloading Archives`:
Downloading archives
********************
pip allows you to *just* download the source archives for your requirements, without installing anything and without regard to what's already installed.
::
$ pip install --download <DIR> -r requirements.txt
or, for a specific package::
$ pip install --download <DIR> SomePackage
Unpacking archives
******************
pip allows you to *just* unpack archives to a build directory without installing them to site-packages. This can be useful to troubleshoot install errors or to inspect what is being installed.
::
$ pip install --no-install SomePackage
If you're in a virtualenv, the build dir is ``<virtualenv path>/build``. Otherwise, it's ``<OS temp dir>/pip-build-<username>``
Afterwards, to finish the job of installing unpacked archives, run::
$ pip install --no-download SomePackage
.. _`Fast & Local Installs`:
Fast & Local Installs
*********************
Often, you will want a fast install from local archives, without probing PyPI.
First, :ref:`download the archives <Downloading Archives>` that fulfill your requirements::
$ pip install --download <DIR> -r requirements.txt
Then, install using :ref:`--find-links <--find-links>` and :ref:`--no-index <--no-index>`::
$ pip install --no-index --find-links=[file://]<DIR> -r requirements.txt
"Non-recursive" upgrades
************************
``pip install ---upgrade`` is currently written to perform a "recursive upgrade".
E.g. supposing:
* `SomePackage-1.0` requires `AnotherPackage>=1.0`
* `SomePackage-2.0` requires `AnotherPackage>=1.0` and `OneMorePoject==1.0`
* `SomePackage-1.0` and `AnotherPackage-1.0` are currently installed
* `SomePackage-2.0` and `AnotherPackage-2.0` are the latest versions available on PyPI.
Running ``pip install ---upgrade SomePackage`` would upgrade `SomePackage` *and* `AnotherPackage`
despite `AnotherPackage` already being satisifed.
If you would like to perform a "non-recursive upgrade" perform these 2 steps::
pip install --upgrade --no-deps SomePackage
pip install SomePackage
The first line will upgrade `SomePackage`, but not dependencies like `AnotherPackage`. The 2nd line will fill in new dependencies like `OneMorePackage`.
Ensuring Repeatability
**********************
Three things are required to fully guarantee a repeatable installation using requirements files.
1. The requirements file was generated by ``pip freeze`` or you're sure it only contains requirements that specify a specific version.
2. The installation is performed using :ref:`--no-deps <install_--no-deps>`. This guarantees that only what is explicitly listed in the requirements file is installed.
3. The installation is performed against an index or find-links location that is guaranteed to *not* allow archives to be changed and updated without a version increase.
-121
View File
@@ -1,121 +0,0 @@
===========
Development
===========
Pull Requests
=============
Submit Pull Requests against the `develop` branch.
Provide a good description of what you're doing and why.
Provide tests that cover your changes and try to run the tests locally first.
Automated Testing
=================
All pull requests and merges to 'develop' branch are tested in `Travis <https://travis-ci.org/>`_
based on our `.travis.yml file <https://github.com/pypa/pip/blob/develop/.travis.yml>`_.
Usually, a link to your specific travis build appears in pull requests, but if not,
you can find it on our `travis pull requests page <https://travis-ci.org/pypa/pip/pull_requests>`_
The only way to trigger Travis to run again for a pull request, is to submit another change to the pull branch.
We also have Jenkins CI that runs regularly for certain python versions on windows and centos.
Running tests
=============
OS Requirements: subversion, bazaar, git, and mercurial.
Python Requirements: nose, virtualenv, scripttest, and mock
Ways to run the tests locally:
::
$ python setup.py test # Using the setuptools test plugin
$ nosetests # Using nosetests directly
$ tox # Using tox against pip's tox.ini
Getting Involved
================
The pip project welcomes help in the following ways:
- Making Pull Requests for code, tests, or docs.
- Commenting on open issues and pull requests.
- Helping to answer questions on the mailing list.
If you want to become an official maintainer, start by helping out.
Later, when you think you're ready, get in touch with one of the maintainers,
and they will initiate a vote.
Release Process
===============
This process includes virtualenv, since pip releases necessitate a virtualenv release.
:<oldp>/<newp>: refers to the old and new versions of pip.
:<oldv>/<newv>: refers to the old and new versions of virtualenv.
1. Upgrade distribute, if needed:
#. Upgrade distribute in ``virtualenv:develop`` using the :ref:`Refresh virtualenv` process.
#. Create a pull request against ``pip:develop`` with a modified ``.travis.yml`` file that installs virtualenv from ``virtualenv:develop``, to confirm the travis builds are still passing.
2. Create Release branches:
#. Create ``pip:<newp>`` branch.
#. In ``pip:develop``, change ``pip.version`` to '<newp>.post1'.
#. Create ``virtualenv:<newv>`` branch.
#. In ``virtualenv:develop``, change ``virtualenv.version`` to '<newv>.post1'.
3. Prepare "rcX":
#. In ``pip:<newp>``, change ``pip.version`` to '<newp>rcX', and tag with '<newp>rcX'.
#. Build a pip sdist from ``pip:<newp>``, and build it into ``virtualenv:<newv>`` using the :ref:`Refresh virtualenv` process.
#. In ``virtualenv:<newv>``, change ``virtualenv.version`` to '<newv>rcX', and tag with '<newv>rcX'.
4. Announce ``pip-<newp>rcX`` and ``virtualenv-<newv>rcX`` with the :ref:`RC Install Instructions` and elicit feedback.
5. Apply fixes to 'rcX':
#. Apply fixes to ``pip:<newp>`` and ``virtualenv:<newv>``
#. Periodically merge fixes to ``pip:develop`` and ``virtualenv:develop``
6. Repeat #4 thru #6 if needed.
7. Final Release:
#. In ``pip:<newp>``, change ``pip.version`` to '<newp>', and tag with '<newp>'.
#. Merge ``pip:<newp>`` to ``pip:master``.
#. Build a pip sdist from ``pip:<newp>``, and load it into ``virtualenv:<newv>`` using the :ref:`Refresh virtualenv` process.
#. Merge ``vitualenv:<newv>`` to ``virtualenv:develop``.
#. In ``virtualenv:<newv>``, change ``virtualenv.version`` to '<newv>', and tag with '<newv>'.
#. Merge ``virtualenv:<newp>`` to ``virtualenv:master``
#. Build and upload pip and virtualenv sdists to PyPI.
.. _`Refresh virtualenv`:
Refresh virtualenv
++++++++++++++++++
#. Set the embedded versions of pip, distribute and setuptools in ``bin/refresh-support-files.py``
#. Additionally, set the version of distribute in ``virtualenv_embedded/distribute_setup.py``, and setuptools in ``virtualenv_embedded/ez_setup.py``
#. Run ``bin/refresh-support-files.py`` to download the latest versions.
When specifying a beta of pip not on pypi, the last part of this script will fail. In this case, the pip sdist needs to be placed manually into ``virtualenv_support``.
#. Run ``bin/rebuild-script.py`` to rebuild virtualenv based on the latest versions.
.. _`RC Install Instructions`:
RC Install Instructions
+++++++++++++++++++++++
#. Download and unpack ``https://github.com/pypa/virtualenv/archive/<newv>rcX.tar.gz``
#. Run: ``python virtualenv-<newv>rcX/virtualenv.py myVE``
#. ``myVE/bin/pip`` will be the <newp>rcX version of pip.
-25
View File
@@ -1,25 +0,0 @@
pip
===
A tool for installing and managing Python packages.
`Mailing list <http://groups.google.com/group/python-virtualenv>`_ ``|``
`Issues <https://github.com/pypa/pip/issues>`_ ``|``
`Github <https://github.com/pypa/pip>`_ ``|``
`PyPI <https://pypi.python.org/pypi/pip/>`_ ``|``
irc:#pip
.. toctree::
:maxdepth: 2
quickstart
installing
usage
cookbook
logic
configuration
other-tools
development
news
-93
View File
@@ -1,93 +0,0 @@
.. _`Installation`:
Installation
============
.. warning::
Prior to version 1.3, pip did not use SSL for downloading packages from PyPI, and thus left
users more vulnerable to security threats. We advise installing at least version 1.3.
If you're using `virtualenv <http://www.virtualenv.org>`_ to install pip, we advise installing
at least version 1.9, which contains pip version 1.3.
Python & OS Support
-------------------
pip works with CPython versions 2.5, 2.6, 2.7, 3.1, 3.2, 3.3 and also pypy.
pip works on Unix/Linux, OS X, and Windows.
Using virtualenv
----------------
The easiest way to install and use pip is with `virtualenv
<http://www.virtualenv.org>`_, since every virtualenv has pip (and it's dependencies) installed into it
automatically.
This does not require root access or modify your system Python
installation. For instance::
$ virtualenv my_env
$ . my_env/bin/activate
(my_env)$ pip install SomePackage
When used in this manner, pip will only affect the active virtual environment.
See the `virtualenv installation instructions <http://www.virtualenv.org/en/latest/#installation>`_.
Installing Globally
-------------------
pip can be installed globally in order to manage global packages.
Often this requires the installation to be performed as root.
.. warning::
We advise against using `easy_install <http://pythonhosted.org/distribute/easy_install.html>`_ to install pip, because easy_install
does not download from PyPI over SSL, so the installation might be insecure.
Since pip can then be used to install packages (which execute code on
your computer), it is better to go through a trusted path.
Requirements
++++++++++++
pip requires either `setuptools <https://pypi.python.org/pypi/setuptools>`_
or `distribute <https://pypi.python.org/pypi/distribute>`_.
See the `Distribute Install Instructions <https://pypi.python.org/pypi/distribute/>`_ or the
`Setuptools Install Instructions <https://pypi.python.org/pypi/setuptools#installation-instructions>`_
If installing pip using a linux package manager, these requirements will be installed for you.
.. warning::
If you are using Python 3.X you **must** use distribute; setuptools doesn't
support Python 3.X.
Using get-pip
+++++++++++++
After installing the requirements:
::
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ [sudo] python get-pip.py
Installing from source
++++++++++++++++++++++
After installing the requirements:
::
$ curl -O https://pypi.python.org/packages/source/p/pip/pip-X.X.tar.gz
$ tar xvfz pip-X.X.tar.gz
$ cd pip-X.X
$ [sudo] python setup.py install
-268
View File
@@ -1,268 +0,0 @@
.. _`pip logic`:
================
Internal Details
================
.. _`Requirements File Format`:
Requirements File Format
========================
Each line of the requirements file indicates something to be installed,
and like arguments to :ref:`pip install`, the following forms are supported::
<requirement specifier>
<archive url/path>
[-e] <local project path>
[-e] <vcs project url>
See the :ref:`pip install Examples<pip install Examples>` for examples of all these forms.
A line beginning with ``#`` is treated as a comment and ignored.
Additionally, the following :ref:`Package Index Options <Package Index Options>` are supported
* :ref:`-i, --index-url <--index-url>`
* :ref:`--extra-index-url <--extra-index-url>`
* :ref:`--no-index <--no-index>`
* :ref:`-f, --find-links <--find-links>`
For example, to specify :ref:`--no-index <--no-index>` and 2 :ref:`--find-links <--find-links>` locations:
::
--no-index
--find-links /my/local/archives
--find-links http://some.archives.com/archives
Lastly, if you wish, you can refer to other requirements files, like this::
-r more_requirements.txt
.. _`Requirement Specifiers`:
Requirement Specifiers
======================
pip supports installing from "requirement specifiers" as implemented in
`pkg_resources Requirements <http://packages.python.org/distribute/pkg_resources.html#requirement-objects>`_
Some Examples::
FooProject >= 1.2
Fizzy [foo, bar]
PickyThing<1.6,>1.9,!=1.9.6,<2.0a0,==2.4c1
SomethingWhoseVersionIDontCareAbout
.. _`VCS Support`:
VCS Support
===========
pip supports installing from Git, Mercurial, Subversion and Bazaar, and detects the type of VCS using url prefixes: "git+", "hg+", "bzr+", "svn+".
pip requires a working VCS command on your path: git, hg, svn, or bzr.
VCS projects can be installed in :ref:`editable mode <editable-installs>` (using the :ref:`--editable <install_--editable>` option) or not.
* For editable installs, the clone location by default is "<venv path>/src/SomeProject" in virtual environments, and "<cwd>/src/SomeProject" for global installs.
The :ref:`--src <install_--src>` option can be used to modify this location.
* For non-editable installs, the project is built locally in a temp dir and then installed normally.
The url suffix "egg=<project name>" is used by pip in it's dependency logic to identify the project prior to pip downloading and analyzing the metadata.
Git
~~~
pip currently supports cloning over ``git``, ``git+http`` and ``git+ssh``::
git+git://git.myproject.org/MyProject#egg=MyProject
git+http://git.myproject.org/MyProject#egg=MyProject
git+ssh://git.myproject.org/MyProject#egg=MyProject
Passing branch names, a commit hash or a tag name is also possible::
git://git.myproject.org/MyProject.git@master#egg=MyProject
git://git.myproject.org/MyProject.git@v1.0#egg=MyProject
git://git.myproject.org/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709#egg=MyProject
Mercurial
~~~~~~~~~
The supported schemes are: ``hg+http``, ``hg+https``,
``hg+static-http`` and ``hg+ssh``::
hg+http://hg.myproject.org/MyProject#egg=MyProject
hg+https://hg.myproject.org/MyProject#egg=MyProject
hg+ssh://hg.myproject.org/MyProject#egg=MyProject
You can also specify a revision number, a revision hash, a tag name or a local
branch name::
hg+http://hg.myproject.org/MyProject@da39a3ee5e6b#egg=MyProject
hg+http://hg.myproject.org/MyProject@2019#egg=MyProject
hg+http://hg.myproject.org/MyProject@v1.0#egg=MyProject
hg+http://hg.myproject.org/MyProject@special_feature#egg=MyProject
Subversion
~~~~~~~~~~
pip supports the URL schemes ``svn``, ``svn+svn``, ``svn+http``, ``svn+https``, ``svn+ssh``.
You can also give specific revisions to an SVN URL, like::
svn+svn://svn.myproject.org/svn/MyProject#egg=MyProject
svn+http://svn.myproject.org/svn/MyProject/trunk@2019#egg=MyProject
which will check out revision 2019. ``@{20080101}`` would also check
out the revision from 2008-01-01. You can only check out specific
revisions using ``-e svn+...``.
Bazaar
~~~~~~
pip supports Bazaar using the ``bzr+http``, ``bzr+https``, ``bzr+ssh``,
``bzr+sftp``, ``bzr+ftp`` and ``bzr+lp`` schemes::
bzr+http://bzr.myproject.org/MyProject/trunk#egg=MyProject
bzr+sftp://user@myproject.org/MyProject/trunk#egg=MyProject
bzr+ssh://user@myproject.org/MyProject/trunk#egg=MyProject
bzr+ftp://user@myproject.org/MyProject/trunk#egg=MyProject
bzr+lp:MyProject#egg=MyProject
Tags or revisions can be installed like this::
bzr+https://bzr.myproject.org/MyProject/trunk@2019#egg=MyProject
bzr+http://bzr.myproject.org/MyProject/trunk@v1.0#egg=MyProject
Finding Packages
================
pip searches for packages on `PyPI <http://pypi.python.org>`_ using the
`http simple interface <http://pypi.python.org/simple>`_,
which is documented `here <http://packages.python.org/distribute/easy_install.html#package-index-api>`_
and `there <http://www.python.org/dev/peps/pep-0301/>`_
pip offers a set of :ref:`Package Index Options <Package Index Options>` for modifying how packages are found.
See the :ref:`pip install Examples<pip install Examples>`.
.. _`SSL Certificate Verification`:
SSL Certificate Verification
============================
Starting with v1.3, pip provides SSL certificate verification over https, for the purpose
of providing secure, certified downloads from PyPI.
This is supported by default in all Python versions pip supports, except Python 2.5.
Python 2.5 users can :ref:`install an SSL backport <SSL Backport>`, which provides ssl support for older pythons.
Pip does not try to install this automatically because it requires a compiler, which not all systems will have.
Although not recommended, Python 2.5 users who are unable to install ssl, can use the global option,
``--insecure``, to allow access to PyPI w/o attempting SSL certificate verification. This option will only be visible
when ssl is not importable. This is *not* a general option.
.. _`SSL Backport`:
Installing the SSL Backport
~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. warning::
We advise against using ``pip`` itself to install the ssl backport, because it won't be secure
until *after* installing ssl. Likewise, `easy_install <http://pythonhosted.org/distribute/easy_install.html>`_ is not advised, because it
does not currently support ssl.
1. Download the ssl archive:
* Using a Browser:
1. Go to `this url <https://pypi.python.org/pypi/ssl/1.15>`_.
2. Confirm the identity of the site is valid.
Most browsers provide this information to the left of the URL bar in the form of padlock icon that you can click on to confirm the site is verified.
3. Scroll down, and click to download ``ssl-1.15.tar.gz``.
* Using curl, which supports ssl certificate verification:
::
$ curl -O https://pypi.python.org/packages/source/s/ssl/ssl-1.15.tar.gz
2. Confirm the md5sum:
::
$ md5sum ssl-1.15.tar.gz
81ea8a1175e437b4c769ae65b3290e0c ssl-1.15.tar.gz
3. Unpack the archive, and change into the ``ssl-1.15`` directory.
4. Run: ``python setup.py install``.
Hash Verification
=================
PyPI provides md5 hashes in the hash fragment of package download urls.
pip supports checking this, as well as any of the
guaranteed hashlib algorithms (sha1, sha224, sha384, sha256, sha512, md5).
The hash fragment is case sensitive (i.e. sha1 not SHA1).
This check is only intended to provide basic download corruption protection.
It is not intended to provide security against tampering. For that,
see :ref:`SSL Certificate Verification`
Download Cache
==============
pip offers a :ref:`--download-cache <install_--download-cache>` option for installs to prevent redundant downloads of archives from PyPI.
The point of this cache is *not* to circumvent the index crawling process, but to *just* prevent redundant downloads.
Items are stored in this cache based on the url the archive was found at, not simply the archive name.
If you want a fast/local install solution that circumvents crawling PyPI, see the :ref:`Fast & Local Installs` Cookbook entry.
Like all options, :ref:`--download-cache <install_--download-cache>`, can also be set as an environment variable, or placed into the pip config file.
See the :ref:`Configuration` section.
.. _`editable-installs`:
"Editable" Installs
===================
"Editable" installs are fundamentally `"setuptools develop mode" <http://packages.python.org/distribute/setuptools.html#development-mode>`_ installs.
You can install local projects or VCS projects in "editable" mode::
$ pip install -e path/to/SomeProject
$ pip install -e git+http://repo/my_project.git#egg=SomeProject
For local projects, the "SomeProject.egg-info" directory is created relative to the project path.
This is one advantage over just using ``setup.py develop``, which creates the "egg-info" directly relative the current working directory.
setuptools & pkg_resources
==========================
Internally, pip uses the `setuptools` package, and the `pkg_resources` module, which are available from the project, `Setuptools`_, or it's fork `Distribute`_.
pip can work with either `Setuptools`_ or `Distribute`_, although for Python 3, `Distribute`_ is required.
Here are some examples of how pip uses `setuptools` and `pkg_resources`:
* The core of pip's install process uses the `setuptools`'s "install" command.
* Editable ("-e") installs use the `setuptools`'s "develop" command.
* pip uses `pkg_resources` for version parsing, for detecting version conflicts, and to determine what projects are installed,
.. _Setuptools: http://pypi.python.org/pypi/setuptools/0.6c11
.. _Distribute: http://pypi.python.org/pypi/distribute/
-12
View File
@@ -1,12 +0,0 @@
========
News
========
Next Release
============
Beta and final releases of 1.3 are planned for Feb 2013.
.. include:: ../CHANGES.txt
-66
View File
@@ -1,66 +0,0 @@
===================
Other tools
===================
virtualenv
----------
pip is most nutritious when used with `virtualenv
<http://pypi.python.org/pypi/virtualenv>`__. One of the reasons pip
doesn't install "multi-version" eggs is that virtualenv removes much of the need
for it. Because pip is installed by virtualenv, just use
``path/to/my/environment/bin/pip`` to install things into that
specific environment.
To tell pip to only run if there is a virtualenv currently activated,
and to bail if not, use::
export PIP_REQUIRE_VIRTUALENV=true
easy_install
------------
pip was originally written to improve on `easy_install <http://pythonhosted.org/distribute/easy_install.html>`_ in the following ways:
* All packages are downloaded before installation. Partially-completed
installation doesn't occur as a result.
* Care is taken to present useful output on the console.
* The reasons for actions are kept track of. For instance, if a package is
being installed, pip keeps track of why that package was required.
* Error messages should be useful.
* The code is relatively concise and cohesive, making it easier to use
programmatically.
* Packages don't have to be installed as egg archives, they can be installed
flat (while keeping the egg metadata).
* Native support for other version control systems (Git, Mercurial and Bazaar)
* Uninstallation of packages.
* Simple to define fixed sets of requirements and reliably reproduce a
set of packages.
pip doesn't do everything that easy_install does. Specifically:
* It cannot install from eggs. It only installs from source. (In the
future it would be good if it could install binaries from Windows ``.exe``
or ``.msi`` -- binary install on other platforms is not a priority.)
* It is incompatible with some packages that extensively customize distutils
or setuptools in their ``setup.py`` files.
buildout
--------
If you are using `zc.buildout
<http://pypi.python.org/pypi/zc.buildout>`_ you should look at
`gp.recipe.pip <http://pypi.python.org/pypi/gp.recipe.pip>`_ as an
option to use pip and virtualenv in your buildouts.
-362
View File
@@ -1,362 +0,0 @@
==========
Usage
==========
.. _`General Options`:
**General Options:**
.. pip-general-options::
.. _`Package Index Options`:
**Package Index Options:**
.. pip-index-options::
.. _`pip install`:
pip install
-----------
Usage
********
.. pip-command-usage:: install
Description
***********
.. pip-command-description:: install
Options
*******
**Install Options:**
.. pip-command-options:: install
**Other Options:**
* :ref:`Package Index Options <Package Index Options>`
* :ref:`General Options <General Options>`
.. _`pip install Examples`:
Examples
********
1) Install `SomePackage` and it's dependencies from `PyPI`_ using :ref:`Requirement Specifiers`
::
$ pip install SomePackage # latest version
$ pip install SomePackage==1.0.4 # specific version
$ pip install SomePackage>=1.0.4 # minimum version
2) Install a list of requirements specified in a file. See the :ref:`Cookbook entry on Requirements files <Requirements Files>`.
::
$ pip install -r requirements.txt
3) Upgrade an already installed `SomePackage` to the latest from PyPI.
::
$ pip install --upgrade SomePackage
4) Install a local project in "editable" mode. See the section on :ref:`Editable Installs <editable-installs>`.
::
$ pip install -e . # project in current directory
$ pip install -e path/to/project # project in another directory
5) Install a project from VCS in "editable" mode. See the sections on :ref:`VCS Support <VCS Support>` and :ref:`Editable Installs <editable-installs>`.
::
$ pip install -e git+https://git.repo/some_pkg.git#egg=SomePackage # from git
$ pip install -e hg+https://hg.repo/some_pkg.git#egg=SomePackage # from mercurial
$ pip install -e svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage # from svn
$ pip install -e git+https://git.repo/some_pkg.git@feature#egg=SomePackage # from 'feature' branch
6) Install a package with `setuptools extras`_.
::
$ pip install SomePackage[PDF]
$ pip install SomePackage[PDF]==3.0
$ pip install -e .[PDF]==3.0 # editable project in current directory
7) Install a particular source archive file.
::
$ pip install ./downloads/SomePackage-1.0.4.tar.gz
$ pip install http://my.package.repo/SomePackage-1.0.4.zip
8) Install from alternative package repositories.
Install from a different index, and not `PyPI`_::
$ pip install --index-url http://my.package.repo/simple/ SomePackage
Search an additional index during install, in addition to `PyPI`_::
$ pip install --extra-index-url http://my.package.repo/simple SomePackage
Install from a local flat directory containing archives (and don't scan indexes)::
$ pip install --no-index --find-links:file:///local/dir/ SomePackage
$ pip install --no-index --find-links:/local/dir/ SomePackage
$ pip install --no-index --find-links:relative/dir/ SomePackage
.. _PyPI: http://pypi.python.org/pypi
.. _setuptools extras: http://packages.python.org/distribute/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies
pip uninstall
-------------
Usage
*****
.. pip-command-usage:: uninstall
Description
***********
.. pip-command-description:: uninstall
Options
*******
**Uninstall Options:**
.. pip-command-options:: uninstall
**Other Options:**
* :ref:`General Options <General Options>`
Examples
********
1) Uninstall a package.
::
$ pip uninstall simplejson
Uninstalling simplejson:
/home/me/env/lib/python2.7/site-packages/simplejson
/home/me/env/lib/python2.7/site-packages/simplejson-2.2.1-py2.7.egg-info
Proceed (y/n)? y
Successfully uninstalled simplejson
.. _`pip freeze`:
pip freeze
-----------
Usage
*****
.. pip-command-usage:: freeze
Description
***********
.. pip-command-description:: freeze
Options
*******
**Freeze Options:**
.. pip-command-options:: freeze
**Other Options:**
* :ref:`General Options <General Options>`
Examples
********
1) Generate output suitable for a requirements file.
::
$ pip freeze
Jinja2==2.6
Pygments==1.5
Sphinx==1.1.3
docutils==0.9.1
pip list
---------
Usage
*****
.. pip-command-usage:: list
Description
***********
.. pip-command-description:: list
Options
*******
**List Options:**
.. pip-command-options:: list
**Other Options:**
* :ref:`Package Index Options <Package Index Options>`
* :ref:`General Options <General Options>`
Examples
********
1) List installed packages.
::
$ pip list
Pygments (1.5)
docutils (0.9.1)
Sphinx (1.1.2)
Jinja2 (2.6)
2) List outdated packages (excluding editables), and the latest version available
::
$ pip list --outdated
docutils (Current: 0.9.1 Latest: 0.10)
Sphinx (Current: 1.1.2 Latest: 1.1.3)
pip show
--------
Usage
*****
.. pip-command-usage:: show
Description
***********
.. pip-command-description:: show
Options
*******
**Show Options:**
.. pip-command-options:: show
**Other Options:**
* :ref:`General Options <General Options>`
Examples
********
1. Show information about a package:
::
$ pip show sphinx
---
Name: Sphinx
Version: 1.1.3
Location: /my/env/lib/pythonx.x/site-packages
Requires: Pygments, Jinja2, docutils
pip search
----------
Usage
*****
.. pip-command-usage:: search
Description
***********
.. pip-command-description:: search
Options
*******
**Seach Options:**
.. pip-command-options:: search
**Other Options:**
* :ref:`General Options <General Options>`
Examples
********
1. Search for "peppercorn"
::
$ pip search peppercorn
pepperedform - Helpers for using peppercorn with formprocess.
peppercorn - A library for converting a token stream into [...]
pip zip
-------
Usage
*****
.. pip-command-usage:: zip
Description
***********
.. pip-command-description:: zip
Options
*******
**Zip Options:**
.. pip-command-options:: zip
**Other Options:**
* :ref:`General Options <General Options>`
@@ -1,44 +0,0 @@
"""
patch for py25 socket to work with http://pypi.python.org/pypi/ssl/
copy-paste from py2.6 stdlib socket.py
https://gist.github.com/zed/1347055
"""
import socket
import sys
_GLOBAL_DEFAULT_TIMEOUT = getattr(socket, '_GLOBAL_DEFAULT_TIMEOUT', object())
def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT,
source_address=None):
"""Connect to *address* and return the socket object.
Convenience function. Connect to *address* (a 2-tuple ``(host,
port)``) and return the socket object. Passing the optional
*timeout* parameter will set the timeout on the socket instance
before attempting to connect. If no *timeout* is supplied, the
global default timeout setting returned by :func:`getdefaulttimeout`
is used.
"""
host, port = address
err = None
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
sock = None
try:
sock = socket.socket(af, socktype, proto)
if timeout is not _GLOBAL_DEFAULT_TIMEOUT:
sock.settimeout(timeout)
if source_address:
sock.bind(source_address)
sock.connect(sa)
return sock
except socket.error:
err = sys.exc_info()[1]
if sock is not None:
sock.close()
if err is not None:
raise err
else:
raise socket.error("getaddrinfo returns an empty list")
@@ -1,60 +0,0 @@
"""The match_hostname() function from Python 3.2, essential when using SSL."""
import re
__version__ = '3.2a3'
class CertificateError(ValueError):
pass
def _dnsname_to_pat(dn):
pats = []
for frag in dn.split(r'.'):
if frag == '*':
# When '*' is a fragment by itself, it matches a non-empty dotless
# fragment.
pats.append('[^.]+')
else:
# Otherwise, '*' matches any dotless fragment.
frag = re.escape(frag)
pats.append(frag.replace(r'\*', '[^.]*'))
return re.compile(r'\A' + r'\.'.join(pats) + r'\Z', re.IGNORECASE)
def match_hostname(cert, hostname):
"""Verify that *cert* (in decoded format as returned by
SSLSocket.getpeercert()) matches the *hostname*. RFC 2818 rules
are mostly followed, but IP addresses are not accepted for *hostname*.
CertificateError is raised on failure. On success, the function
returns nothing.
"""
if not cert:
raise ValueError("empty or no certificate")
dnsnames = []
san = cert.get('subjectAltName', ())
for key, value in san:
if key == 'DNS':
if _dnsname_to_pat(value).match(hostname):
return
dnsnames.append(value)
if not san:
# The subject is only checked when subjectAltName is empty
for sub in cert.get('subject', ()):
for key, value in sub:
# XXX according to RFC 2818, the most specific Common Name
# must be used.
if key == 'commonName':
if _dnsname_to_pat(value).match(hostname):
return
dnsnames.append(value)
if len(dnsnames) > 1:
raise CertificateError("hostname %r "
"doesn't match either of %s"
% (hostname, ', '.join(map(repr, dnsnames))))
elif len(dnsnames) == 1:
raise CertificateError("hostname %r "
"doesn't match %r"
% (hostname, dnsnames[0]))
else:
raise CertificateError("no appropriate commonName or "
"subjectAltName fields were found")
-3895
View File
File diff suppressed because it is too large Load Diff
-80
View File
@@ -1,80 +0,0 @@
"""shared options and groups"""
from optparse import make_option, OptionGroup
def make_option_group(group, parser):
"""
Return an OptionGroup object
group -- assumed to be dict with 'name' and 'options' keys
parser -- an optparse Parser
"""
option_group = OptionGroup(parser, group['name'])
for option in group['options']:
option_group.add_option(option)
return option_group
###########
# options #
###########
index_url = make_option(
'-i', '--index-url', '--pypi-url',
dest='index_url',
metavar='URL',
default='https://pypi.python.org/simple/',
help='Base URL of Python Package Index (default %default).')
extra_index_url = make_option(
'--extra-index-url',
dest='extra_index_urls',
metavar='URL',
action='append',
default=[],
help='Extra URLs of package indexes to use in addition to --index-url.')
no_index = make_option(
'--no-index',
dest='no_index',
action='store_true',
default=False,
help='Ignore package index (only looking at --find-links URLs instead).')
find_links = make_option(
'-f', '--find-links',
dest='find_links',
action='append',
default=[],
metavar='url',
help="If a url or path to an html file, then parse for links to archives. If a local path or file:// url that's a directory, then look for archives in the directory listing.")
use_mirrors = make_option(
'-M', '--use-mirrors',
dest='use_mirrors',
action='store_true',
default=False,
help='Use the PyPI mirrors as a fallback in case the main index is down.')
mirrors = make_option(
'--mirrors',
dest='mirrors',
metavar='URL',
action='append',
default=[],
help='Specific mirror URLs to query when --use-mirrors is used.')
##########
# groups #
##########
index_group = {
'name': 'Package Index Options',
'options': [
index_url,
extra_index_url,
no_index,
find_links,
use_mirrors,
mirrors
]
}
-584
View File
@@ -1,584 +0,0 @@
import cgi
import getpass
import hashlib
import mimetypes
import os
import re
import shutil
import socket
import sys
import tempfile
from pip.backwardcompat import (xmlrpclib, urllib, urllib2, httplib,
urlparse, string_types, ssl)
if ssl:
from pip.backwardcompat import match_hostname, CertificateError
from pip.exceptions import InstallationError, PipError, NoSSLError
from pip.util import (splitext, rmtree, format_size, display_path,
backup_dir, ask_path_exists, unpack_file,
create_download_cache_folder, cache_download)
from pip.vcs import vcs
from pip.log import logger
from pip.locations import default_cert_path
__all__ = ['xmlrpclib_transport', 'get_file_content', 'urlopen',
'is_url', 'url_to_path', 'path_to_url', 'path_to_url2',
'geturl', 'is_archive_file', 'unpack_vcs_link',
'unpack_file_url', 'is_vcs_url', 'is_file_url', 'unpack_http_url']
xmlrpclib_transport = xmlrpclib.Transport()
def get_file_content(url, comes_from=None):
"""Gets the content of a file; it may be a filename, file: URL, or
http: URL. Returns (location, content)"""
match = _scheme_re.search(url)
if match:
scheme = match.group(1).lower()
if (scheme == 'file' and comes_from
and comes_from.startswith('http')):
raise InstallationError(
'Requirements file %s references URL %s, which is local'
% (comes_from, url))
if scheme == 'file':
path = url.split(':', 1)[1]
path = path.replace('\\', '/')
match = _url_slash_drive_re.match(path)
if match:
path = match.group(1) + ':' + path.split('|', 1)[1]
path = urllib.unquote(path)
if path.startswith('/'):
path = '/' + path.lstrip('/')
url = path
else:
## FIXME: catch some errors
resp = urlopen(url)
return geturl(resp), resp.read()
try:
f = open(url)
content = f.read()
except IOError:
e = sys.exc_info()[1]
raise InstallationError('Could not open requirements file: %s' % str(e))
else:
f.close()
return url, content
_scheme_re = re.compile(r'^(http|https|file):', re.I)
_url_slash_drive_re = re.compile(r'/*([a-z])\|', re.I)
class VerifiedHTTPSConnection(httplib.HTTPSConnection):
"""
A connection that wraps connections with ssl certificate verification.
"""
def connect(self):
self.connection_kwargs = {}
#TODO: refactor compatibility logic into backwardcompat?
# for > py2.5
if hasattr(self, 'timeout'):
self.connection_kwargs.update(timeout = self.timeout)
# for >= py2.7
if hasattr(self, 'source_address'):
self.connection_kwargs.update(source_address = self.source_address)
sock = socket.create_connection((self.host, self.port), **self.connection_kwargs)
# for >= py2.7
if getattr(self, '_tunnel_host', None):
self.sock = sock
self._tunnel()
# get alternate bundle or use our included bundle
cert_path = os.environ.get('PIP_CERT', '') or default_cert_path
self.sock = ssl.wrap_socket(sock,
self.key_file,
self.cert_file,
cert_reqs=ssl.CERT_REQUIRED,
ca_certs=cert_path)
try:
match_hostname(self.sock.getpeercert(), self.host)
except CertificateError:
self.sock.shutdown(socket.SHUT_RDWR)
self.sock.close()
raise
class VerifiedHTTPSHandler(urllib2.HTTPSHandler):
"""
A HTTPSHandler that uses our own VerifiedHTTPSConnection.
"""
def __init__(self, connection_class = VerifiedHTTPSConnection):
self.specialized_conn_class = connection_class
urllib2.HTTPSHandler.__init__(self)
def https_open(self, req):
return self.do_open(self.specialized_conn_class, req)
class URLOpener(object):
"""
pip's own URL helper that adds HTTP auth and proxy support
"""
def __init__(self):
self.passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
def __call__(self, url):
"""
If the given url contains auth info or if a normal request gets a 401
response, an attempt is made to fetch the resource using basic HTTP
auth.
"""
url, username, password, scheme = self.extract_credentials(url)
if username is None:
try:
response = self.get_opener(scheme=scheme).open(url)
except urllib2.HTTPError:
e = sys.exc_info()[1]
if e.code != 401:
raise
response = self.get_response(url)
else:
response = self.get_response(url, username, password)
return response
def get_request(self, url):
"""
Wraps the URL to retrieve to protects against "creative"
interpretation of the RFC: http://bugs.python.org/issue8732
"""
if isinstance(url, string_types):
url = urllib2.Request(url, headers={'Accept-encoding': 'identity'})
return url
def get_response(self, url, username=None, password=None):
"""
does the dirty work of actually getting the rsponse object using urllib2
and its HTTP auth builtins.
"""
scheme, netloc, path, query, frag = urlparse.urlsplit(url)
req = self.get_request(url)
stored_username, stored_password = self.passman.find_user_password(None, netloc)
# see if we have a password stored
if stored_username is None:
if username is None and self.prompting:
username = urllib.quote(raw_input('User for %s: ' % netloc))
password = urllib.quote(getpass.getpass('Password: '))
if username and password:
self.passman.add_password(None, netloc, username, password)
stored_username, stored_password = self.passman.find_user_password(None, netloc)
authhandler = urllib2.HTTPBasicAuthHandler(self.passman)
opener = self.get_opener(authhandler, scheme=scheme)
# FIXME: should catch a 401 and offer to let the user reenter credentials
return opener.open(req)
def get_opener(self, *args, **kwargs):
"""
Build an OpenerDirector instance based on the scheme, whether ssl is
importable and the --insecure parameter.
"""
if kwargs.get('scheme') == 'https':
if ssl:
https_handler = VerifiedHTTPSHandler()
director = urllib2.build_opener(https_handler, *args)
#strip out HTTPHandler to prevent MITM spoof
for handler in director.handlers:
if isinstance(handler, urllib2.HTTPHandler):
director.handlers.remove(handler)
return director
elif os.environ.get('PIP_INSECURE', '') == '1':
return urllib2.build_opener(*args)
else:
raise NoSSLError()
else:
return urllib2.build_opener(*args)
def setup(self, proxystr='', prompting=True):
"""
Sets the proxy handler given the option passed on the command
line. If an empty string is passed it looks at the HTTP_PROXY
environment variable.
"""
self.prompting = prompting
proxy = self.get_proxy(proxystr)
if proxy:
proxy_support = urllib2.ProxyHandler({"http": proxy, "ftp": proxy, "https": proxy})
opener = urllib2.build_opener(proxy_support, urllib2.CacheFTPHandler)
urllib2.install_opener(opener)
def parse_credentials(self, netloc):
if "@" in netloc:
userinfo = netloc.rsplit("@", 1)[0]
if ":" in userinfo:
return userinfo.split(":", 1)
return userinfo, None
return None, None
def extract_credentials(self, url):
"""
Extracts user/password from a url.
Returns a tuple:
(url-without-auth, username, password)
"""
if isinstance(url, urllib2.Request):
result = urlparse.urlsplit(url.get_full_url())
else:
result = urlparse.urlsplit(url)
scheme, netloc, path, query, frag = result
username, password = self.parse_credentials(netloc)
if username is None:
return url, None, None, scheme
elif password is None and self.prompting:
# remove the auth credentials from the url part
netloc = netloc.replace('%s@' % username, '', 1)
# prompt for the password
prompt = 'Password for %s@%s: ' % (username, netloc)
password = urllib.quote(getpass.getpass(prompt))
else:
# remove the auth credentials from the url part
netloc = netloc.replace('%s:%s@' % (username, password), '', 1)
target_url = urlparse.urlunsplit((scheme, netloc, path, query, frag))
return target_url, username, password, scheme
def get_proxy(self, proxystr=''):
"""
Get the proxy given the option passed on the command line.
If an empty string is passed it looks at the HTTP_PROXY
environment variable.
"""
if not proxystr:
proxystr = os.environ.get('HTTP_PROXY', '')
if proxystr:
if '@' in proxystr:
user_password, server_port = proxystr.split('@', 1)
if ':' in user_password:
user, password = user_password.split(':', 1)
else:
user = user_password
prompt = 'Password for %s@%s: ' % (user, server_port)
password = urllib.quote(getpass.getpass(prompt))
return '%s:%s@%s' % (user, password, server_port)
else:
return proxystr
else:
return None
urlopen = URLOpener()
def is_url(name):
"""Returns true if the name looks like a URL"""
if ':' not in name:
return False
scheme = name.split(':', 1)[0].lower()
return scheme in ['http', 'https', 'file', 'ftp'] + vcs.all_schemes
def url_to_path(url):
"""
Convert a file: URL to a path.
"""
assert url.startswith('file:'), (
"You can only turn file: urls into filenames (not %r)" % url)
path = url[len('file:'):].lstrip('/')
path = urllib.unquote(path)
if _url_drive_re.match(path):
path = path[0] + ':' + path[2:]
else:
path = '/' + path
return path
_drive_re = re.compile('^([a-z]):', re.I)
_url_drive_re = re.compile('^([a-z])[:|]', re.I)
def path_to_url(path):
"""
Convert a path to a file: URL. The path will be made absolute.
"""
path = os.path.normcase(os.path.abspath(path))
if _drive_re.match(path):
path = path[0] + '|' + path[2:]
url = urllib.quote(path)
url = url.replace(os.path.sep, '/')
url = url.lstrip('/')
return 'file:///' + url
def path_to_url2(path):
"""
Convert a path to a file: URL. The path will be made absolute and have
quoted path parts.
"""
path = os.path.normpath(os.path.abspath(path))
drive, path = os.path.splitdrive(path)
filepath = path.split(os.path.sep)
url = '/'.join([urllib.quote(part) for part in filepath])
if not drive:
url = url.lstrip('/')
return 'file:///' + drive + url
def geturl(urllib2_resp):
"""
Use instead of urllib.addinfourl.geturl(), which appears to have
some issues with dropping the double slash for certain schemes
(e.g. file://). This implementation is probably over-eager, as it
always restores '://' if it is missing, and it appears some url
schemata aren't always followed by '//' after the colon, but as
far as I know pip doesn't need any of those.
The URI RFC can be found at: http://tools.ietf.org/html/rfc1630
This function assumes that
scheme:/foo/bar
is the same as
scheme:///foo/bar
"""
url = urllib2_resp.geturl()
scheme, rest = url.split(':', 1)
if rest.startswith('//'):
return url
else:
# FIXME: write a good test to cover it
return '%s://%s' % (scheme, rest)
def is_archive_file(name):
"""Return True if `name` is a considered as an archive file."""
archives = ('.zip', '.tar.gz', '.tar.bz2', '.tgz', '.tar', '.pybundle')
ext = splitext(name)[1].lower()
if ext in archives:
return True
return False
def unpack_vcs_link(link, location, only_download=False):
vcs_backend = _get_used_vcs_backend(link)
if only_download:
vcs_backend.export(location)
else:
vcs_backend.unpack(location)
def unpack_file_url(link, location):
source = url_to_path(link.url)
content_type = mimetypes.guess_type(source)[0]
if os.path.isdir(source):
# delete the location since shutil will create it again :(
if os.path.isdir(location):
rmtree(location)
shutil.copytree(source, location)
else:
unpack_file(source, location, content_type, link)
def _get_used_vcs_backend(link):
for backend in vcs.backends:
if link.scheme in backend.schemes:
vcs_backend = backend(link.url)
return vcs_backend
def is_vcs_url(link):
return bool(_get_used_vcs_backend(link))
def is_file_url(link):
return link.url.lower().startswith('file:')
def _check_hash(download_hash, link):
if download_hash.digest_size != hashlib.new(link.hash_name).digest_size:
logger.fatal("Hash digest size of the package %d (%s) doesn't match the expected hash name %s!"
% (download_hash.digest_size, link, link.hash_name))
raise InstallationError('Hash name mismatch for package %s' % link)
if download_hash.hexdigest() != link.hash:
logger.fatal("Hash of the package %s (%s) doesn't match the expected hash %s!"
% (link, download_hash, link.hash))
raise InstallationError('Bad %s hash for package %s' % (link.hash_name, link))
def _get_hash_from_file(target_file, link):
try:
download_hash = hashlib.new(link.hash_name)
except (ValueError, TypeError):
logger.warn("Unsupported hash name %s for package %s" % (link.hash_name, link))
return None
fp = open(target_file, 'rb')
while True:
chunk = fp.read(4096)
if not chunk:
break
download_hash.update(chunk)
fp.close()
return download_hash
def _download_url(resp, link, temp_location):
fp = open(temp_location, 'wb')
download_hash = None
if link.hash and link.hash_name:
try:
download_hash = hashlib.new(link.hash_name)
except ValueError:
logger.warn("Unsupported hash name %s for package %s" % (link.hash_name, link))
try:
total_length = int(resp.info()['content-length'])
except (ValueError, KeyError, TypeError):
total_length = 0
downloaded = 0
show_progress = total_length > 40 * 1000 or not total_length
show_url = link.show_url
try:
if show_progress:
## FIXME: the URL can get really long in this message:
if total_length:
logger.start_progress('Downloading %s (%s): ' % (show_url, format_size(total_length)))
else:
logger.start_progress('Downloading %s (unknown size): ' % show_url)
else:
logger.notify('Downloading %s' % show_url)
logger.info('Downloading from URL %s' % link)
while True:
chunk = resp.read(4096)
if not chunk:
break
downloaded += len(chunk)
if show_progress:
if not total_length:
logger.show_progress('%s' % format_size(downloaded))
else:
logger.show_progress('%3i%% %s' % (100 * downloaded / total_length, format_size(downloaded)))
if download_hash is not None:
download_hash.update(chunk)
fp.write(chunk)
fp.close()
finally:
if show_progress:
logger.end_progress('%s downloaded' % format_size(downloaded))
return download_hash
def _copy_file(filename, location, content_type, link):
copy = True
download_location = os.path.join(location, link.filename)
if os.path.exists(download_location):
response = ask_path_exists(
'The file %s exists. (i)gnore, (w)ipe, (b)ackup ' %
display_path(download_location), ('i', 'w', 'b'))
if response == 'i':
copy = False
elif response == 'w':
logger.warn('Deleting %s' % display_path(download_location))
os.remove(download_location)
elif response == 'b':
dest_file = backup_dir(download_location)
logger.warn('Backing up %s to %s'
% (display_path(download_location), display_path(dest_file)))
shutil.move(download_location, dest_file)
if copy:
shutil.copy(filename, download_location)
logger.indent -= 2
logger.notify('Saved %s' % display_path(download_location))
def unpack_http_url(link, location, download_cache, download_dir=None):
temp_dir = tempfile.mkdtemp('-unpack', 'pip-')
target_url = link.url.split('#', 1)[0]
target_file = None
download_hash = None
if download_cache:
target_file = os.path.join(download_cache,
urllib.quote(target_url, ''))
if not os.path.isdir(download_cache):
create_download_cache_folder(download_cache)
already_downloaded = None
if download_dir:
already_downloaded = os.path.join(download_dir, link.filename)
if not os.path.exists(already_downloaded):
already_downloaded = None
if (target_file
and os.path.exists(target_file)
and os.path.exists(target_file + '.content-type')):
fp = open(target_file+'.content-type')
content_type = fp.read().strip()
fp.close()
if link.hash and link.hash_name:
download_hash = _get_hash_from_file(target_file, link)
temp_location = target_file
logger.notify('Using download cache from %s' % target_file)
elif already_downloaded:
temp_location = already_downloaded
content_type = mimetypes.guess_type(already_downloaded)
if link.hash:
download_hash = _get_hash_from_file(temp_location, link)
logger.notify('File was already downloaded %s' % already_downloaded)
else:
resp = _get_response_from_url(target_url, link)
content_type = resp.info()['content-type']
filename = link.filename # fallback
# Have a look at the Content-Disposition header for a better guess
content_disposition = resp.info().get('content-disposition')
if content_disposition:
type, params = cgi.parse_header(content_disposition)
# We use ``or`` here because we don't want to use an "empty" value
# from the filename param.
filename = params.get('filename') or filename
ext = splitext(filename)[1]
if not ext:
ext = mimetypes.guess_extension(content_type)
if ext:
filename += ext
if not ext and link.url != geturl(resp):
ext = os.path.splitext(geturl(resp))[1]
if ext:
filename += ext
temp_location = os.path.join(temp_dir, filename)
download_hash = _download_url(resp, link, temp_location)
if link.hash and link.hash_name:
_check_hash(download_hash, link)
if download_dir and not already_downloaded:
_copy_file(temp_location, download_dir, content_type, link)
unpack_file(temp_location, location, content_type, link)
if target_file and target_file != temp_location:
cache_download(target_file, temp_location, content_type)
if target_file is None and not already_downloaded:
os.unlink(temp_location)
os.rmdir(temp_dir)
def _get_response_from_url(target_url, link):
try:
resp = urlopen(target_url)
except urllib2.HTTPError:
e = sys.exc_info()[1]
logger.fatal("HTTP error %s while getting %s" % (e.code, link))
raise
except IOError:
e = sys.exc_info()[1]
# Typically an FTP error
logger.fatal("Error %s while getting %s" % (e, link))
raise
return resp
class Urllib2HeadRequest(urllib2.Request):
def get_method(self):
return "HEAD"
-56
View File
@@ -1,56 +0,0 @@
"""Exceptions used throughout package"""
import textwrap
class PipError(Exception):
"""Base pip exception"""
class InstallationError(PipError):
"""General exception during installation"""
class UninstallationError(PipError):
"""General exception during uninstallation"""
class DistributionNotFound(InstallationError):
"""Raised when a distribution cannot be found to satisfy a requirement"""
class BestVersionAlreadyInstalled(PipError):
"""Raised when the most up-to-date version of a package is already
installed. """
class BadCommand(PipError):
"""Raised when virtualenv or a command is not found"""
class CommandError(PipError):
"""Raised when there is an error in command-line arguments"""
class NoSSLError(PipError):
"""Raised when there's no ssl and not using '--insecure'"""
def __str__(self):
return textwrap.dedent("""
###################################################################
## You don't have an importable ssl module. You are most ##
## likely using Python 2.5, which did not include ssl ##
## support by default. In this state, we can not provide ##
## ssl certified downloads from PyPI. ##
## ##
## You can do one of 2 things: ##
## 1) Install this: https://pypi.python.org/pypi/ssl/ ##
## (It provides ssl support for older Pythons ) ##
## 2) Use the --insecure option to allow this insecurity ##
## ##
## For more details, go to the "SSL Certificate Verification" ##
## section located here: ##
## http://www.pip-installer.org/en/latest/logic.html ##
## ##
###################################################################
""")
-757
View File
@@ -1,757 +0,0 @@
"""Routines related to PyPI, indexes"""
import sys
import os
import re
import gzip
import mimetypes
import posixpath
import pkg_resources
import random
import socket
import string
import zlib
try:
import threading
except ImportError:
import dummy_threading as threading
from pip.log import logger
from pip.util import Inf, normalize_name, splitext
from pip.exceptions import DistributionNotFound, BestVersionAlreadyInstalled
from pip.backwardcompat import (WindowsError, BytesIO,
Queue, urlparse,
URLError, HTTPError, u,
product, url2pathname, ssl,
Empty as QueueEmpty)
if ssl:
from pip.backwardcompat import CertificateError
from pip.download import urlopen, path_to_url2, url_to_path, geturl, Urllib2HeadRequest
__all__ = ['PackageFinder']
DEFAULT_MIRROR_HOSTNAME = "last.pypi.python.org"
class PackageFinder(object):
"""This finds packages.
This is meant to match easy_install's technique for looking for
packages, by reading pages and looking for appropriate links
"""
def __init__(self, find_links, index_urls,
use_mirrors=False, mirrors=None, main_mirror_url=None):
self.find_links = find_links
self.index_urls = index_urls
self.dependency_links = []
self.cache = PageCache()
# These are boring links that have already been logged somehow:
self.logged_links = set()
if use_mirrors:
self.mirror_urls = self._get_mirror_urls(mirrors, main_mirror_url)
logger.info('Using PyPI mirrors: %s' % ', '.join(self.mirror_urls))
else:
self.mirror_urls = []
def add_dependency_links(self, links):
## FIXME: this shouldn't be global list this, it should only
## apply to requirements of the package that specifies the
## dependency_links value
## FIXME: also, we should track comes_from (i.e., use Link)
self.dependency_links.extend(links)
def _sort_locations(self, locations):
"""
Sort locations into "files" (archives) and "urls", and return
a pair of lists (files,urls)
"""
files = []
urls = []
# puts the url for the given file path into the appropriate list
def sort_path(path):
url = path_to_url2(path)
if mimetypes.guess_type(url, strict=False)[0] == 'text/html':
urls.append(url)
else:
files.append(url)
for url in locations:
is_local_path = os.path.exists(url)
is_file_url = url.startswith('file:')
is_find_link = url in self.find_links
if is_local_path or is_file_url:
if is_local_path:
path = url
else:
path = url_to_path(url)
if is_find_link and os.path.isdir(path):
path = os.path.realpath(path)
for item in os.listdir(path):
sort_path(os.path.join(path, item))
elif is_file_url and os.path.isdir(path):
urls.append(url)
elif os.path.isfile(path):
sort_path(path)
else:
urls.append(url)
return files, urls
def find_requirement(self, req, upgrade):
def mkurl_pypi_url(url):
loc = posixpath.join(url, url_name)
# For maximum compatibility with easy_install, ensure the path
# ends in a trailing slash. Although this isn't in the spec
# (and PyPI can handle it without the slash) some other index
# implementations might break if they relied on easy_install's behavior.
if not loc.endswith('/'):
loc = loc + '/'
return loc
url_name = req.url_name
# Only check main index if index URL is given:
main_index_url = None
if self.index_urls:
# Check that we have the url_name correctly spelled:
main_index_url = Link(mkurl_pypi_url(self.index_urls[0]))
# This will also cache the page, so it's okay that we get it again later:
page = self._get_page(main_index_url, req)
if page is None:
url_name = self._find_url_name(Link(self.index_urls[0]), url_name, req) or req.url_name
# Combine index URLs with mirror URLs here to allow
# adding more index URLs from requirements files
all_index_urls = self.index_urls + self.mirror_urls
if url_name is not None:
locations = [
mkurl_pypi_url(url)
for url in all_index_urls] + self.find_links
else:
locations = list(self.find_links)
locations.extend(self.dependency_links)
for version in req.absolute_versions:
if url_name is not None and main_index_url is not None:
locations = [
posixpath.join(main_index_url.url, version)] + locations
file_locations, url_locations = self._sort_locations(locations)
locations = [Link(url) for url in url_locations]
logger.debug('URLs to search for versions for %s:' % req)
for location in locations:
logger.debug('* %s' % location)
found_versions = []
found_versions.extend(
self._package_versions(
[Link(url, '-f') for url in self.find_links], req.name.lower()))
page_versions = []
for page in self._get_pages(locations, req):
logger.debug('Analyzing links from page %s' % page.url)
logger.indent += 2
try:
page_versions.extend(self._package_versions(page.links, req.name.lower()))
finally:
logger.indent -= 2
dependency_versions = list(self._package_versions(
[Link(url) for url in self.dependency_links], req.name.lower()))
if dependency_versions:
logger.info('dependency_links found: %s' % ', '.join([link.url for parsed, link, version in dependency_versions]))
file_versions = list(self._package_versions(
[Link(url) for url in file_locations], req.name.lower()))
if not found_versions and not page_versions and not dependency_versions and not file_versions:
logger.fatal('Could not find any downloads that satisfy the requirement %s' % req)
raise DistributionNotFound('No distributions at all found for %s' % req)
installed_version = []
if req.satisfied_by is not None:
installed_version = [(req.satisfied_by.parsed_version, InfLink, req.satisfied_by.version)]
if file_versions:
file_versions.sort(reverse=True)
logger.info('Local files found: %s' % ', '.join([url_to_path(link.url) for parsed, link, version in file_versions]))
#this is an intentional priority ordering
all_versions = installed_version + file_versions + found_versions + page_versions + dependency_versions
applicable_versions = []
for (parsed_version, link, version) in all_versions:
if version not in req.req:
logger.info("Ignoring link %s, version %s doesn't match %s"
% (link, version, ','.join([''.join(s) for s in req.req.specs])))
continue
applicable_versions.append((parsed_version, link, version))
#bring the latest version to the front, but maintains the priority ordering as secondary
applicable_versions = sorted(applicable_versions, key=lambda v: v[0], reverse=True)
existing_applicable = bool([link for parsed_version, link, version in applicable_versions if link is InfLink])
if not upgrade and existing_applicable:
if applicable_versions[0][1] is InfLink:
logger.info('Existing installed version (%s) is most up-to-date and satisfies requirement'
% req.satisfied_by.version)
else:
logger.info('Existing installed version (%s) satisfies requirement (most up-to-date version is %s)'
% (req.satisfied_by.version, applicable_versions[0][2]))
return None
if not applicable_versions:
logger.fatal('Could not find a version that satisfies the requirement %s (from versions: %s)'
% (req, ', '.join([version for parsed_version, link, version in all_versions])))
raise DistributionNotFound('No distributions matching the version for %s' % req)
if applicable_versions[0][1] is InfLink:
# We have an existing version, and its the best version
logger.info('Installed version (%s) is most up-to-date (past versions: %s)'
% (req.satisfied_by.version, ', '.join([version for parsed_version, link, version in applicable_versions[1:]]) or 'none'))
raise BestVersionAlreadyInstalled
if len(applicable_versions) > 1:
logger.info('Using version %s (newest of versions: %s)' %
(applicable_versions[0][2], ', '.join([version for parsed_version, link, version in applicable_versions])))
return applicable_versions[0][1]
def _find_url_name(self, index_url, url_name, req):
"""Finds the true URL name of a package, when the given name isn't quite correct.
This is usually used to implement case-insensitivity."""
if not index_url.url.endswith('/'):
# Vaguely part of the PyPI API... weird but true.
## FIXME: bad to modify this?
index_url.url += '/'
page = self._get_page(index_url, req)
if page is None:
logger.fatal('Cannot fetch index base URL %s' % index_url)
return
norm_name = normalize_name(req.url_name)
for link in page.links:
base = posixpath.basename(link.path.rstrip('/'))
if norm_name == normalize_name(base):
logger.notify('Real name of requirement %s is %s' % (url_name, base))
return base
return None
def _get_pages(self, locations, req):
"""Yields (page, page_url) from the given locations, skipping
locations that have errors, and adding download/homepage links"""
pending_queue = Queue()
for location in locations:
pending_queue.put(location)
done = []
seen = set()
threads = []
for i in range(min(10, len(locations))):
t = threading.Thread(target=self._get_queued_page, args=(req, pending_queue, done, seen))
t.setDaemon(True)
threads.append(t)
t.start()
for t in threads:
t.join()
return done
_log_lock = threading.Lock()
def _get_queued_page(self, req, pending_queue, done, seen):
while 1:
try:
location = pending_queue.get(False)
except QueueEmpty:
return
if location in seen:
continue
seen.add(location)
page = self._get_page(location, req)
if page is None:
continue
done.append(page)
for link in page.rel_links():
pending_queue.put(link)
_egg_fragment_re = re.compile(r'#egg=([^&]*)')
_egg_info_re = re.compile(r'([a-z0-9_.]+)-([a-z0-9_.-]+)', re.I)
_py_version_re = re.compile(r'-py([123]\.?[0-9]?)$')
def _sort_links(self, links):
"Returns elements of links in order, non-egg links first, egg links second, while eliminating duplicates"
eggs, no_eggs = [], []
seen = set()
for link in links:
if link not in seen:
seen.add(link)
if link.egg_fragment:
eggs.append(link)
else:
no_eggs.append(link)
return no_eggs + eggs
def _package_versions(self, links, search_name):
for link in self._sort_links(links):
for v in self._link_package_versions(link, search_name):
yield v
def _link_package_versions(self, link, search_name):
"""
Return an iterable of triples (pkg_resources_version_key,
link, python_version) that can be extracted from the given
link.
Meant to be overridden by subclasses, not called by clients.
"""
if link.egg_fragment:
egg_info = link.egg_fragment
else:
egg_info, ext = link.splitext()
if not ext:
if link not in self.logged_links:
logger.debug('Skipping link %s; not a file' % link)
self.logged_links.add(link)
return []
if egg_info.endswith('.tar'):
# Special double-extension case:
egg_info = egg_info[:-4]
ext = '.tar' + ext
if ext not in ('.tar.gz', '.tar.bz2', '.tar', '.tgz', '.zip'):
if link not in self.logged_links:
logger.debug('Skipping link %s; unknown archive format: %s' % (link, ext))
self.logged_links.add(link)
return []
if "macosx10" in link.path and ext == '.zip':
if link not in self.logged_links:
logger.debug('Skipping link %s; macosx10 one' % (link))
self.logged_links.add(link)
return []
version = self._egg_info_matches(egg_info, search_name, link)
if version is None:
logger.debug('Skipping link %s; wrong project name (not %s)' % (link, search_name))
return []
match = self._py_version_re.search(version)
if match:
version = version[:match.start()]
py_version = match.group(1)
if py_version != sys.version[:3]:
logger.debug('Skipping %s because Python version is incorrect' % link)
return []
logger.debug('Found link %s, version: %s' % (link, version))
return [(pkg_resources.parse_version(version),
link,
version)]
def _egg_info_matches(self, egg_info, search_name, link):
match = self._egg_info_re.search(egg_info)
if not match:
logger.debug('Could not parse version from link: %s' % link)
return None
name = match.group(0).lower()
# To match the "safe" name that pkg_resources creates:
name = name.replace('_', '-')
# project name and version must be separated by a dash
look_for = search_name.lower() + "-"
if name.startswith(look_for):
return match.group(0)[len(look_for):]
else:
return None
def _get_page(self, link, req):
return HTMLPage.get_page(link, req, cache=self.cache)
def _get_mirror_urls(self, mirrors=None, main_mirror_url=None):
"""Retrieves a list of URLs from the main mirror DNS entry
unless a list of mirror URLs are passed.
"""
if not mirrors:
mirrors = get_mirrors(main_mirror_url)
# Should this be made "less random"? E.g. netselect like?
random.shuffle(mirrors)
mirror_urls = set()
for mirror_url in mirrors:
mirror_url = mirror_url.rstrip('/')
# Make sure we have a valid URL
if not any([mirror_url.startswith(scheme) for scheme in ["http://", "https://", "file://"]]):
mirror_url = "http://%s" % mirror_url
if not mirror_url.endswith("/simple"):
mirror_url = "%s/simple" % mirror_url
mirror_urls.add(mirror_url + '/')
return list(mirror_urls)
class PageCache(object):
"""Cache of HTML pages"""
failure_limit = 3
def __init__(self):
self._failures = {}
self._pages = {}
self._archives = {}
def too_many_failures(self, url):
return self._failures.get(url, 0) >= self.failure_limit
def get_page(self, url):
return self._pages.get(url)
def is_archive(self, url):
return self._archives.get(url, False)
def set_is_archive(self, url, value=True):
self._archives[url] = value
def add_page_failure(self, url, level):
self._failures[url] = self._failures.get(url, 0)+level
def add_page(self, urls, page):
for url in urls:
self._pages[url] = page
class HTMLPage(object):
"""Represents one page, along with its URL"""
## FIXME: these regexes are horrible hacks:
_homepage_re = re.compile(r'<th>\s*home\s*page', re.I)
_download_re = re.compile(r'<th>\s*download\s+url', re.I)
## These aren't so aweful:
_rel_re = re.compile("""<[^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*>""", re.I)
_href_re = re.compile('href=(?:"([^"]*)"|\'([^\']*)\'|([^>\\s\\n]*))', re.I|re.S)
_base_re = re.compile(r"""<base\s+href\s*=\s*['"]?([^'">]+)""", re.I)
def __init__(self, content, url, headers=None):
self.content = content
self.url = url
self.headers = headers
def __str__(self):
return self.url
@classmethod
def get_page(cls, link, req, cache=None, skip_archives=True):
url = link.url
url = url.split('#', 1)[0]
if cache.too_many_failures(url):
return None
# Check for VCS schemes that do not support lookup as web pages.
from pip.vcs import VcsSupport
for scheme in VcsSupport.schemes:
if url.lower().startswith(scheme) and url[len(scheme)] in '+:':
logger.debug('Cannot look at %(scheme)s URL %(link)s' % locals())
return None
if cache is not None:
inst = cache.get_page(url)
if inst is not None:
return inst
try:
if skip_archives:
if cache is not None:
if cache.is_archive(url):
return None
filename = link.filename
for bad_ext in ['.tar', '.tar.gz', '.tar.bz2', '.tgz', '.zip']:
if filename.endswith(bad_ext):
content_type = cls._get_content_type(url)
if content_type.lower().startswith('text/html'):
break
else:
logger.debug('Skipping page %s because of Content-Type: %s' % (link, content_type))
if cache is not None:
cache.set_is_archive(url)
return None
logger.debug('Getting page %s' % url)
# Tack index.html onto file:// URLs that point to directories
(scheme, netloc, path, params, query, fragment) = urlparse.urlparse(url)
if scheme == 'file' and os.path.isdir(url2pathname(path)):
# add trailing slash if not present so urljoin doesn't trim final segment
if not url.endswith('/'):
url += '/'
url = urlparse.urljoin(url, 'index.html')
logger.debug(' file: URL is directory, getting %s' % url)
resp = urlopen(url)
real_url = geturl(resp)
headers = resp.info()
contents = resp.read()
encoding = headers.get('Content-Encoding', None)
#XXX need to handle exceptions and add testing for this
if encoding is not None:
if encoding == 'gzip':
contents = gzip.GzipFile(fileobj=BytesIO(contents)).read()
if encoding == 'deflate':
contents = zlib.decompress(contents)
inst = cls(u(contents), real_url, headers)
except (HTTPError, URLError, socket.timeout, socket.error, OSError, WindowsError):
e = sys.exc_info()[1]
desc = str(e)
if isinstance(e, socket.timeout):
log_meth = logger.info
level =1
desc = 'timed out'
elif isinstance(e, URLError):
#ssl/certificate error
if ssl and hasattr(e, 'reason') and (isinstance(e.reason, ssl.SSLError) or isinstance(e.reason, CertificateError)):
desc = 'There was a problem confirming the ssl certificate: %s' % e
log_meth = logger.notify
else:
log_meth = logger.info
if hasattr(e, 'reason') and isinstance(e.reason, socket.timeout):
desc = 'timed out'
level = 1
else:
level = 2
elif isinstance(e, HTTPError) and e.code == 404:
## FIXME: notify?
log_meth = logger.info
level = 2
else:
log_meth = logger.info
level = 1
log_meth('Could not fetch URL %s: %s' % (link, desc))
log_meth('Will skip URL %s when looking for download links for %s' % (link.url, req))
if cache is not None:
cache.add_page_failure(url, level)
return None
if cache is not None:
cache.add_page([url, real_url], inst)
return inst
@staticmethod
def _get_content_type(url):
"""Get the Content-Type of the given url, using a HEAD request"""
scheme, netloc, path, query, fragment = urlparse.urlsplit(url)
if not scheme in ('http', 'https', 'ftp', 'ftps'):
## FIXME: some warning or something?
## assertion error?
return ''
req = Urllib2HeadRequest(url, headers={'Host': netloc})
resp = urlopen(req)
try:
if hasattr(resp, 'code') and resp.code != 200 and scheme not in ('ftp', 'ftps'):
## FIXME: doesn't handle redirects
return ''
return resp.info().get('content-type', '')
finally:
resp.close()
@property
def base_url(self):
if not hasattr(self, "_base_url"):
match = self._base_re.search(self.content)
if match:
self._base_url = match.group(1)
else:
self._base_url = self.url
return self._base_url
@property
def links(self):
"""Yields all links in the page"""
for match in self._href_re.finditer(self.content):
url = match.group(1) or match.group(2) or match.group(3)
url = self.clean_link(urlparse.urljoin(self.base_url, url))
yield Link(url, self)
def rel_links(self):
for url in self.explicit_rel_links():
yield url
for url in self.scraped_rel_links():
yield url
def explicit_rel_links(self, rels=('homepage', 'download')):
"""Yields all links with the given relations"""
for match in self._rel_re.finditer(self.content):
found_rels = match.group(1).lower().split()
for rel in rels:
if rel in found_rels:
break
else:
continue
match = self._href_re.search(match.group(0))
if not match:
continue
url = match.group(1) or match.group(2) or match.group(3)
url = self.clean_link(urlparse.urljoin(self.base_url, url))
yield Link(url, self)
def scraped_rel_links(self):
for regex in (self._homepage_re, self._download_re):
match = regex.search(self.content)
if not match:
continue
href_match = self._href_re.search(self.content, pos=match.end())
if not href_match:
continue
url = href_match.group(1) or href_match.group(2) or href_match.group(3)
if not url:
continue
url = self.clean_link(urlparse.urljoin(self.base_url, url))
yield Link(url, self)
_clean_re = re.compile(r'[^a-z0-9$&+,/:;=?@.#%_\\|-]', re.I)
def clean_link(self, url):
"""Makes sure a link is fully encoded. That is, if a ' ' shows up in
the link, it will be rewritten to %20 (while not over-quoting
% or other characters)."""
return self._clean_re.sub(
lambda match: '%%%2x' % ord(match.group(0)), url)
class Link(object):
def __init__(self, url, comes_from=None):
self.url = url
self.comes_from = comes_from
def __str__(self):
if self.comes_from:
return '%s (from %s)' % (self.url, self.comes_from)
else:
return str(self.url)
def __repr__(self):
return '<Link %s>' % self
def __eq__(self, other):
return self.url == other.url
def __ne__(self, other):
return self.url != other.url
def __lt__(self, other):
return self.url < other.url
def __le__(self, other):
return self.url <= other.url
def __gt__(self, other):
return self.url > other.url
def __ge__(self, other):
return self.url >= other.url
def __hash__(self):
return hash(self.url)
@property
def filename(self):
_, netloc, path, _, _ = urlparse.urlsplit(self.url)
name = posixpath.basename(path.rstrip('/')) or netloc
assert name, ('URL %r produced no filename' % self.url)
return name
@property
def scheme(self):
return urlparse.urlsplit(self.url)[0]
@property
def path(self):
return urlparse.urlsplit(self.url)[2]
def splitext(self):
return splitext(posixpath.basename(self.path.rstrip('/')))
@property
def url_without_fragment(self):
scheme, netloc, path, query, fragment = urlparse.urlsplit(self.url)
return urlparse.urlunsplit((scheme, netloc, path, query, None))
_egg_fragment_re = re.compile(r'#egg=([^&]*)')
@property
def egg_fragment(self):
match = self._egg_fragment_re.search(self.url)
if not match:
return None
return match.group(1)
_hash_re = re.compile(r'(sha1|sha224|sha384|sha256|sha512|md5)=([a-f0-9]+)')
@property
def hash(self):
match = self._hash_re.search(self.url)
if match:
return match.group(2)
return None
@property
def hash_name(self):
match = self._hash_re.search(self.url)
if match:
return match.group(1)
return None
@property
def show_url(self):
return posixpath.basename(self.url.split('#', 1)[0].split('?', 1)[0])
#An "Infinite Link" that compares greater than other links
InfLink = Link(Inf) #this object is not currently used as a sortable
def get_requirement_from_url(url):
"""Get a requirement from the URL, if possible. This looks for #egg
in the URL"""
link = Link(url)
egg_info = link.egg_fragment
if not egg_info:
egg_info = splitext(link.filename)[0]
return package_to_requirement(egg_info)
def package_to_requirement(package_name):
"""Translate a name like Foo-1.2 to Foo==1.3"""
match = re.search(r'^(.*?)-(dev|\d.*)', package_name)
if match:
name = match.group(1)
version = match.group(2)
else:
name = package_name
version = ''
if version:
return '%s==%s' % (name, version)
else:
return name
def get_mirrors(hostname=None):
"""Return the list of mirrors from the last record found on the DNS
entry::
>>> from pip.index import get_mirrors
>>> get_mirrors()
['a.pypi.python.org', 'b.pypi.python.org', 'c.pypi.python.org',
'd.pypi.python.org']
Originally written for the distutils2 project by Alexis Metaireau.
"""
if hostname is None:
hostname = DEFAULT_MIRROR_HOSTNAME
# return the last mirror registered on PyPI.
last_mirror_hostname = None
try:
last_mirror_hostname = socket.gethostbyname_ex(hostname)[0]
except socket.gaierror:
return []
if not last_mirror_hostname or last_mirror_hostname == DEFAULT_MIRROR_HOSTNAME:
last_mirror_hostname = "z.pypi.python.org"
end_letter = last_mirror_hostname.split(".", 1)
# determine the list from the last one.
return ["%s.%s" % (s, end_letter[1]) for s in string_range(end_letter[0])]
def string_range(last):
"""Compute the range of string between "a" and last.
This works for simple "a to z" lists, but also for "a to zz" lists.
"""
for k in range(len(last)):
for x in product(string.ascii_lowercase, repeat=k+1):
result = ''.join(x)
yield result
if result == last:
return
-100
View File
@@ -1,100 +0,0 @@
"""Locations where we look for configs, install stuff, etc"""
import sys
import site
import os
import tempfile
import getpass
from pip.backwardcompat import get_python_lib
import pip.exceptions
default_cert_path = os.path.join(os.path.dirname(__file__), 'cacert.pem')
def running_under_virtualenv():
"""
Return True if we're running inside a virtualenv, False otherwise.
"""
return hasattr(sys, 'real_prefix')
def virtualenv_no_global():
"""
Return True if in a venv and no system site packages.
"""
#this mirrors the logic in virtualenv.py for locating the no-global-site-packages.txt file
site_mod_dir = os.path.dirname(os.path.abspath(site.__file__))
no_global_file = os.path.join(site_mod_dir, 'no-global-site-packages.txt')
if running_under_virtualenv() and os.path.isfile(no_global_file):
return True
def _get_build_prefix():
""" Returns a safe build_prefix """
path = os.path.join(tempfile.gettempdir(), 'pip-build-%s' % \
getpass.getuser())
if sys.platform == 'win32':
""" on windows(tested on 7) temp dirs are isolated """
return path
try:
os.mkdir(path)
except OSError:
file_uid = None
try:
fd = os.open(path, os.O_RDONLY | os.O_NOFOLLOW)
file_uid = os.fstat(fd).st_uid
os.close(fd)
except OSError:
file_uid = None
if file_uid != os.getuid():
msg = "The temporary folder for building (%s) is not owned by your user!" \
% path
print (msg)
print("pip will not work until the temporary folder is " + \
"either deleted or owned by your user account.")
raise pip.exceptions.InstallationError(msg)
return path
if running_under_virtualenv():
build_prefix = os.path.join(sys.prefix, 'build')
src_prefix = os.path.join(sys.prefix, 'src')
else:
# Use tempfile to create a temporary folder for build
# Note: we are NOT using mkdtemp so we can have a consistent build dir
# Note: using realpath due to tmp dirs on OSX being symlinks
build_prefix = _get_build_prefix()
## FIXME: keep src in cwd for now (it is not a temporary folder)
try:
src_prefix = os.path.join(os.getcwd(), 'src')
except OSError:
# In case the current working directory has been renamed or deleted
sys.exit("The folder you are executing pip from can no longer be found.")
# under Mac OS X + virtualenv sys.prefix is not properly resolved
# it is something like /path/to/python/bin/..
build_prefix = os.path.abspath(os.path.realpath(build_prefix))
src_prefix = os.path.abspath(src_prefix)
# FIXME doesn't account for venv linked to global site-packages
site_packages = get_python_lib()
user_dir = os.path.expanduser('~')
if sys.platform == 'win32':
bin_py = os.path.join(sys.prefix, 'Scripts')
# buildout uses 'bin' on Windows too?
if not os.path.exists(bin_py):
bin_py = os.path.join(sys.prefix, 'bin')
default_storage_dir = os.path.join(user_dir, 'pip')
default_config_file = os.path.join(default_storage_dir, 'pip.ini')
default_log_file = os.path.join(default_storage_dir, 'pip.log')
else:
bin_py = os.path.join(sys.prefix, 'bin')
default_storage_dir = os.path.join(user_dir, '.pip')
default_config_file = os.path.join(default_storage_dir, 'pip.conf')
default_log_file = os.path.join(default_storage_dir, 'pip.log')
# Forcing to use /usr/local/bin for standard Mac OS X framework installs
# Also log to ~/Library/Logs/ for use with the Console.app log viewer
if sys.platform[:6] == 'darwin' and sys.prefix[:16] == '/System/Library/':
bin_py = '/usr/local/bin'
default_log_file = os.path.join(user_dir, 'Library/Logs/pip.log')
-11
View File
@@ -1,11 +0,0 @@
[nosetests]
where = tests
[aliases]
dev = develop easy_install pip[testing]
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
-61
View File
@@ -1,61 +0,0 @@
import codecs
import os
import re
import sys
import textwrap
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
# intentionally *not* adding an encoding option to open
# see here: https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
return codecs.open(os.path.join(here, *parts), 'r').read()
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
long_description = "\n" + "\n".join([
read('PROJECT.txt'),
read('docs', 'quickstart.txt'),
read('CHANGES.txt')])
tests_require = ['nose', 'virtualenv>=1.7', 'scripttest>=1.1.1', 'mock']
setup(name="pip",
version=find_version('pip', '__init__.py'),
description="A tool for installing and managing Python packages.",
long_description=long_description,
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Topic :: Software Development :: Build Tools',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.5',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.1',
'Programming Language :: Python :: 3.2',
],
keywords='easy_install distutils setuptools egg virtualenv',
author='The pip developers',
author_email='python-virtualenv@groups.google.com',
url='http://www.pip-installer.org',
license='MIT',
packages=['pip', 'pip.commands', 'pip.vcs', 'pip.backwardcompat'],
package_data={'pip': ['*.pem']},
entry_points=dict(console_scripts=['pip=pip:main', 'pip-%s=pip:main' % sys.version[:3]]),
test_suite='nose.collector',
tests_require=tests_require,
zip_safe=False,
extras_require = {
'testing':tests_require,
},
)
@@ -1,61 +1,99 @@
Alex Gaynor
Alex Grönholm Alex Grönholm
Alex Morega Alex Morega
Alexandre Conrad Alexandre Conrad
Andrey Bulgakov Andrey Bulgakov
Anrs Hu
Anton Patrushev
Antti Kaihola Antti Kaihola
Armin Ronacher Armin Ronacher
Aziz Köksal Aziz Köksal
Ben Rosser Ben Rosser
Bernardo B. Marques
Bradley Ayers
Brian Rosner Brian Rosner
Carl Meyer Carl Meyer
Chris McDonough Chris McDonough
Christian Oudard Christian Oudard
Clay McClure Clay McClure
Cody Soyland Cody Soyland
Craig Kerstiens
Cristian Sorinel
Dan Sully
Daniel Holth Daniel Holth
Dave Abrahams Dave Abrahams
David (d1b) David (d1b)
David Aguilar
David Evans
David Pursehouse
dengzhp
Dmitry Gladkov Dmitry Gladkov
Donald Stufft Donald Stufft
Endoh Takanao
enoch
Erik M. Bray
Francesco Francesco
Gabriel de Perthuis
Garry Polley
Geoffrey Lehée Geoffrey Lehée
George Song
Georgi Valkov Georgi Valkov
Herbert Pfennig
hetmankp
Hugo Lopes Tavares Hugo Lopes Tavares
Hynek Schlawack
Ian Bicking Ian Bicking
Igor Sobreira Igor Sobreira
Ionel Maries Cristian Ionel Maries Cristian
Jakub Vysoky Jakub Vysoky
James Cleveland James Cleveland
Jannis Leidel Jannis Leidel
Jakub Stasiak
Jay Graves Jay Graves
Jeff Dairiki
John-Scott Atlakson John-Scott Atlakson
Jon Parise Jon Parise
Jonas Nockert Jonas Nockert
Jon Parise
Jorge Niedbalski
Josh Bronson Josh Bronson
Josh Hansen
Kamal Bin Mustafa Kamal Bin Mustafa
Kelsey Hightower Kelsey Hightower
Kenneth Belitzky Kenneth Belitzky
Kenneth Reitz
Kevin Frommelt
Kumar McMillan Kumar McMillan
Lev Givon
Lincoln de Sousa
Luke Macken Luke Macken
Masklinn Masklinn
Marc Abramowitz Marc Abramowitz
Marc Tamlyn
Marcus Smith Marcus Smith
Markus Hametner Markus Hametner
Matt Maker Matt Maker
Maxime R. Maxime Rouyrre
Miguel Araujo Michael Williamson
Miguel Araujo Perez
Monty Taylor
Nick Stenning Nick Stenning
Nowell Strite Nowell Strite
Oliver Tonnhofer Oliver Tonnhofer
Olivier Girardot Olivier Girardot
Ollie Rutherfurd
Oren Held
Patrick Jenkins Patrick Jenkins
Patrick Dubroy
Paul Moore Paul Moore
Paul Nasrat Paul Nasrat
Paul Oswald Paul Oswald
Paul van der Linden Paul van der Linden
Peter Waller Peter Waller
Phil Freo
Phil Whelan Phil Whelan
Piet Delport Piet Delport
Preston Holmes
Przemek Wrzos Przemek Wrzos
Qiangning Hong Qiangning Hong
Rafael Caricio Rafael Caricio
@@ -63,12 +101,20 @@ Rene Dudfield
Roey Berman Roey Berman
Ronny Pfannschmidt Ronny Pfannschmidt
Rory McCann Rory McCann
Ross Brattain
Sergey Vasilyev
Seth Woodworth
Simon Cross Simon Cross
Stavros Korokithakis Stavros Korokithakis
Stéphane Klein
Steven Myint
Takayuki SHIMIZUKAWA
Thomas Fenzl Thomas Fenzl
Thomas Johansson Thomas Johansson
Toshio Kuratomi
Travis Swicegood
Vinay Sajip Vinay Sajip
Vitaly Babiy Vitaly Babiy
W Trevor King W. Trevor King
Wil Tan Wil Tan
Hsiaoming Yang Hsiaoming Yang
+291 -66
View File
@@ -1,23 +1,222 @@
Changelog **1.5.4 (2014-02-21)**
=========
* Correct deprecation warning for ``pip install --build`` to only notify when
the `--build` value is different than the default.
**1.5.3 (2014-02-20)**
* **DEPRECATION** ``pip install --build`` and ``pip install --no-clean`` are now
deprecated. See Issue #906 for discussion.
* Fixed #1112. Couldn't download directly from wheel paths/urls, and when wheel
downloads did occur using requirement specifiers, dependencies weren't
downloaded (PR #1527)
* Fixed #1320. ``pip wheel`` was not downloading wheels that already existed (PR
#1524)
* Fixed #1111. ``pip install --download`` was failing using local
``--find-links`` (PR #1524)
* Workaround for Python bug http://bugs.python.org/issue20053 (PR #1544)
* Don't pass a unicode __file__ to setup.py on Python 2.x (PR #1583)
* Verify that the Wheel version is compatible with this pip (PR #1569)
**1.5.2 (2014-01-26)**
* Upgraded the vendored ``pkg_resources`` and ``_markerlib`` to setuptools 2.1.
* Fixed an error that prevented accessing PyPI when pyopenssl, ndg-httpsclient,
and pyasn1 are installed
* Fixed an issue that caused trailing comments to be incorrectly included as
part of the URL in a requirements file
**1.5.1 (2014-01-20)**
* pip now only requires setuptools (any setuptools, not a certain version) when
installing distributions from src (i.e. not from wheel). (Pull #1434).
* `get-pip.py` now installs setuptools, when it's not already installed (Pull
#1475)
* Don't decode downloaded files that have a ``Content-Encoding`` header. (Pull
#1435)
* Fix to correctly parse wheel filenames with single digit versions. (Pull
#1445)
* If `--allow-unverified` is used assume it also means `--allow-external`. (Pull
#1457)
**1.5 (2014-01-01)**
* **BACKWARD INCOMPATIBLE** pip no longer supports the ``--use-mirrors``,
``-M``, and ``--mirrors`` flags. The mirroring support has been removed. In
order to use a mirror specify it as the primary index with ``-i`` or
``--index-url``, or as an additional index with ``--extra-index-url``. (Pull #1098, CVE-2013-5123)
* **BACKWARD INCOMPATIBLE** pip no longer will scrape insecure external urls by
default nor will it install externally hosted files by default. Users may opt
into installing externally hosted or insecure files or urls using
``--allow-external PROJECT`` and ``--allow-unverified PROJECT``. (Pull #1055)
* **BACKWARD INCOMPATIBLE** pip no longer respects dependency links by default.
Users may opt into respecting them again using ``--process-dependency-links``.
* **DEPRECATION** ``pip install --no-install`` and ``pip install
--no-download`` are now formally deprecated. See Issue #906 for discussion on
possible alternatives, or lack thereof, in future releases.
* **DEPRECATION** ``pip zip`` and ``pip unzip`` are now formally deprecated.
* pip will now install Mac OSX platform wheels from PyPI. (Pull #1278)
* pip now generates the appropriate platform-specific console scripts when
installing wheels. (Pull #1251)
* Pip now confirms a wheel is supported when installing directly from a path or
url. (Pull #1315)
* Fixed #1097, ``--ignore-installed`` now behaves again as designed, after it was
unintentionally broke in v0.8.3 when fixing Issue #14 (Pull #1352).
* Fixed a bug where global scripts were being removed when uninstalling --user
installed packages (Pull #1353).
* Fixed #1163, --user wasn't being respected when installing scripts from wheels (Pull #1176).
* Fixed #1150, we now assume '_' means '-' in versions from wheel filenames (Pull #1158).
* Fixed #219, error when using --log with a failed install (Pull #1205).
* Fixed #1131, logging was buffered and choppy in Python 3.
* Fixed #70, --timeout was being ignored (Pull #1202).
* Fixed #772, error when setting PIP_EXISTS_ACTION (Pull #1201).
* Added colors to the logging output in order to draw attention to important
warnings and errors. (Pull #1109)
* Added warnings when using an insecure index, find-link, or dependency link. (Pull #1121)
* Added support for installing packages from a subdirectory using the ``subdirectory``
editable option. ( Pull #1082 )
* Fixed #1192. "TypeError: bad operand type for unary" in some cases when
installing wheels using --find-links (Pull #1218).
* Fixed #1133 and #317. Archive contents are now written based on system
defaults and umask (i.e. permissions are not preserved), except that regular
files with any execute permissions have the equivalent of "chmod +x" applied
after being written (Pull #1146).
* PreviousBuildDirError now returns a non-zero exit code and prevents the
previous build dir from being cleaned in all cases (Pull #1162).
* Renamed --allow-insecure to --allow-unverified, however the old name will
continue to work for a period of time (Pull #1257).
* Fixed #1006, error when installing local projects with symlinks in
Python 3. (Pull #1311)
* The previously hidden ``--log-file`` otion, is now shown as a general option.
(Pull #1316)
**1.4.1 (2013-08-07)**
* **New Signing Key** Release 1.4.1 is using a different key than normal with
fingerprint: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
* Fixed issues with installing from pybundle files (Pull #1116).
* Fixed error when sysconfig module throws an exception (Pull #1095).
* Don't ignore already installed pre-releases (Pull #1076).
* Fixes related to upgrading setuptools (Pull #1092).
* Fixes so that --download works with wheel archives (Pull #1113).
* Fixes related to recognizing and cleaning global build dirs (Pull #1080).
**1.4 (2013-07-23)**
* **BACKWARD INCOMPATIBLE** pip now only installs stable versions by default,
and offers a new ``--pre`` option to also find pre-release and development
versions. (Pull #834)
* **BACKWARD INCOMPATIBLE** Dropped support for Python 2.5. The minimum
supported Python version for pip 1.4 is Python 2.6.
* Added support for installing and building wheel archives.
Thanks Daniel Holth, Marcus Smith, Paul Moore, and Michele Lacchia
(Pull #845)
* Applied security patch to pip's ssl support related to certificate DNS
wildcard matching (http://bugs.python.org/issue17980).
* To satisfy pip's setuptools requirement, pip now recommends setuptools>=0.8,
not distribute. setuptools and distribute are now merged into one project
called 'setuptools'. (Pull #1003)
* pip will now warn when installing a file that is either hosted externally to
the index or cannot be verified with a hash. In the future pip will default
to not installing them and will require the flags --allow-external NAME, and
--allow-insecure NAME respectively. (Pull #985)
* If an already-downloaded or cached file has a bad hash, re-download it rather
than erroring out. (Issue #963).
* ``pip bundle`` and support for installing from pybundle files is now
considered deprecated and will be removed in pip v1.5.
* Fixed a number of issues (#413, #709, #634, #602, and #939) related to
cleaning up and not reusing build directories. (Pull #865, #948)
* Added a User Agent so that pip is identifiable in logs. (Pull #901)
* Added ssl and --user support to get-pip.py. Thanks Gabriel de Perthuis.
(Pull #895)
* Fixed the proxy support, which was broken in pip 1.3.x (Pull #840)
* Fixed issue #32 - pip fails when server does not send content-type header.
Thanks Hugo Lopes Tavares and Kelsey Hightower (Pull #872).
* "Vendorized" distlib as pip.vendor.distlib (https://distlib.readthedocs.org/).
* Fixed git VCS backend with git 1.8.3. (Pull #967)
**1.3.1 (2013-03-08)**
1.3.1 (2013-03-08)
------------------
* Fixed a major backward incompatible change of parsing URLs to externally * Fixed a major backward incompatible change of parsing URLs to externally
hosted packages that got accidentily included in 1.3. hosted packages that got accidentily included in 1.3.
1.3 (2013-03-07)
---------------- **1.3 (2013-03-07)**
* SSL Cert Verification; Make https the default for PyPI access. * SSL Cert Verification; Make https the default for PyPI access.
Thanks James Cleveland, Giovanni Bajo, Marcus Smith and many others (Pull #789). Thanks James Cleveland, Giovanni Bajo, Marcus Smith and many others (Pull #791, CVE-2013-1629).
* Added "pip list" for listing installed packages and the latest version * Added "pip list" for listing installed packages and the latest version
available. Thanks Rafael Caricio, Miguel Araujo, Dmitry Gladkov (Pull #752) available. Thanks Rafael Caricio, Miguel Araujo, Dmitry Gladkov (Pull #752)
* Fixed security issues with pip's use of temp build directories. * Fixed security issues with pip's use of temp build directories.
Thanks David (d1b) and Thomas Guttler. (Pull #780) Thanks David (d1b) and Thomas Guttler. (Pull #780, CVE-2013-1888)
* Improvements to sphinx docs and cli help. (Pull #773) * Improvements to sphinx docs and cli help. (Pull #773)
@@ -64,15 +263,17 @@ Changelog
like the same option in distutils but also plays nice with pip's egg-info. like the same option in distutils but also plays nice with pip's egg-info.
Thanks Przemek Wrzos. (Issue #253 / Pull #693) Thanks Przemek Wrzos. (Issue #253 / Pull #693)
1.2.1 (2012-09-06)
------------------ **1.2.1 (2012-09-06)**
* Fixed a regression introduced in 1.2 about raising an exception when * Fixed a regression introduced in 1.2 about raising an exception when
not finding any files to uninstall in the current environment. Thanks for not finding any files to uninstall in the current environment. Thanks for
the fix, Marcus Smith. the fix, Marcus Smith.
1.2 (2012-09-01)
---------------- **1.2 (2012-09-01)**
* **Dropped support for Python 2.4** The minimum supported Python version is * **Dropped support for Python 2.4** The minimum supported Python version is
now Python 2.5. now Python 2.5.
@@ -140,8 +341,9 @@ Changelog
* Added a better help formatter. * Added a better help formatter.
1.1 (2012-02-16)
---------------- **1.1 (2012-02-16)**
* Fixed issue #326 - don't crash when a package's setup.py emits UTF-8 and * Fixed issue #326 - don't crash when a package's setup.py emits UTF-8 and
then fails. Thanks Marc Abramowitz. then fails. Thanks Marc Abramowitz.
@@ -200,8 +402,8 @@ Changelog
requirements from VCS that have a changed repo URL. requirements from VCS that have a changed repo URL.
1.0.2 (2011-07-16) **1.0.2 (2011-07-16)**
------------------
* Fixed docs issues. * Fixed docs issues.
* Fixed issue #295 - Reinstall a package when using the ``install -I`` option * Fixed issue #295 - Reinstall a package when using the ``install -I`` option
@@ -210,8 +412,9 @@ Changelog
* Fixed issue #314 - Correctly handle exceptions on Python3. * Fixed issue #314 - Correctly handle exceptions on Python3.
* Fixed issue #320 - Correctly parse ``--editable`` lines in requirements files * Fixed issue #320 - Correctly parse ``--editable`` lines in requirements files
1.0.1 (2011-04-30)
------------------ **1.0.1 (2011-04-30)**
* Start to use git-flow. * Start to use git-flow.
* Fixed issue #274 - `find_command` should not raise AttributeError * Fixed issue #274 - `find_command` should not raise AttributeError
@@ -221,8 +424,9 @@ Changelog
* Fixed issue #44 - multiple CLI searches. * Fixed issue #44 - multiple CLI searches.
* Fixed issue #266 - current working directory when running setup.py clean. * Fixed issue #266 - current working directory when running setup.py clean.
1.0 (2011-04-04)
---------------- **1.0 (2011-04-04)**
* Added Python 3 support! Huge thanks to Vinay Sajip, Vitaly Babiy, Kelsey * Added Python 3 support! Huge thanks to Vinay Sajip, Vitaly Babiy, Kelsey
Hightower, and Alex Gronholm, among others. Hightower, and Alex Gronholm, among others.
@@ -249,8 +453,9 @@ Changelog
Make sure you have `distribute <http://pypi.python.org/pypi/distribute>`_ Make sure you have `distribute <http://pypi.python.org/pypi/distribute>`_
installed before using the installer! installed before using the installer!
0.8.3
----- **0.8.3**
* Moved main repository to Github: https://github.com/pypa/pip * Moved main repository to Github: https://github.com/pypa/pip
@@ -272,8 +477,9 @@ Changelog
* Fixed bug in version string parsing related to the suffix "-dev". * Fixed bug in version string parsing related to the suffix "-dev".
0.8.2
----- **0.8.2**
* Avoid redundant unpacking of bundles (from pwaller) * Avoid redundant unpacking of bundles (from pwaller)
@@ -289,8 +495,9 @@ Changelog
* Added ``git+https://`` scheme to Git VCS backend. * Added ``git+https://`` scheme to Git VCS backend.
0.8.1
----- **0.8.1**
* Added global --user flag as shortcut for --install-option="--user". From * Added global --user flag as shortcut for --install-option="--user". From
Ronny Pfannschmidt. Ronny Pfannschmidt.
@@ -309,9 +516,8 @@ Changelog
Thanks Ronny Pfannschmidt and Wil Tan. Thanks Ronny Pfannschmidt and Wil Tan.
**0.8**
0.8
---
* Track which ``build/`` directories pip creates, never remove directories * Track which ``build/`` directories pip creates, never remove directories
it doesn't create. From Hugo Lopes Tavares. it doesn't create. From Hugo Lopes Tavares.
@@ -337,14 +543,16 @@ Changelog
* Significant test framework changes, from Hugo Lopes Tavares. * Significant test framework changes, from Hugo Lopes Tavares.
0.7.2
----- **0.7.2**
* Set zip_safe=False to avoid problems some people are encountering where * Set zip_safe=False to avoid problems some people are encountering where
pip is installed as a zip file. pip is installed as a zip file.
0.7.1
----- **0.7.1**
* Fixed opening of logfile with no directory name. Thanks Alexandre Conrad. * Fixed opening of logfile with no directory name. Thanks Alexandre Conrad.
@@ -353,8 +561,9 @@ Changelog
* Tests now require at least ScriptTest 1.0.3. * Tests now require at least ScriptTest 1.0.3.
0.7
--- **0.7**
* Fixed uninstallation on Windows * Fixed uninstallation on Windows
* Added ``pip search`` command. * Added ``pip search`` command.
@@ -395,21 +604,24 @@ Changelog
--extra-index-url. --extra-index-url.
* Leftover build directories are now removed. Thanks Alexandre Conrad. * Leftover build directories are now removed. Thanks Alexandre Conrad.
0.6.3
----- **0.6.3**
* Fixed import error on Windows with regard to the backwards compatibility * Fixed import error on Windows with regard to the backwards compatibility
package package
0.6.2
----- **0.6.2**
* Fixed uninstall when /tmp is on a different filesystem. * Fixed uninstall when /tmp is on a different filesystem.
* Fixed uninstallation of distributions with namespace packages. * Fixed uninstallation of distributions with namespace packages.
0.6.1
----- **0.6.1**
* Added support for the ``https`` and ``http-static`` schemes to the * Added support for the ``https`` and ``http-static`` schemes to the
Mercurial and ``ftp`` scheme to the Bazaar backend. Mercurial and ``ftp`` scheme to the Bazaar backend.
@@ -422,8 +634,9 @@ Changelog
* Fixed issue with ``pip bundle`` and local files (which weren't being * Fixed issue with ``pip bundle`` and local files (which weren't being
copied into the bundle), from Whit Morriss. copied into the bundle), from Whit Morriss.
0.6
--- **0.6**
* Add ``pip uninstall`` and uninstall-before upgrade (from Carl * Add ``pip uninstall`` and uninstall-before upgrade (from Carl
Meyer). Meyer).
@@ -453,13 +666,15 @@ Changelog
* Creates download cache directory if not existing. * Creates download cache directory if not existing.
0.5.1
----- **0.5.1**
* Fixed a couple little bugs, with git and with extensions. * Fixed a couple little bugs, with git and with extensions.
0.5
--- **0.5**
* Added ability to override the default log file name (``pip-log.txt``) * Added ability to override the default log file name (``pip-log.txt``)
with the environmental variable ``$PIP_LOG_FILE``. with the environmental variable ``$PIP_LOG_FILE``.
@@ -511,8 +726,9 @@ Changelog
* Fixed handling of attempt to checkout editable install to a * Fixed handling of attempt to checkout editable install to a
non-empty, non-repo directory. non-empty, non-repo directory.
0.4
--- **0.4**
* Make ``-e`` work better with local hg repositories * Make ``-e`` work better with local hg repositories
@@ -540,8 +756,9 @@ Changelog
* Fixed support for Subversion 1.6. * Fixed support for Subversion 1.6.
0.3.1
----- **0.3.1**
* Improved virtualenv restart and various path/cleanup problems on win32. * Improved virtualenv restart and various path/cleanup problems on win32.
@@ -553,8 +770,9 @@ Changelog
* Improve ``pip -h`` * Improve ``pip -h``
0.3
--- **0.3**
* Added support for editable packages created from Git, Mercurial and Bazaar * Added support for editable packages created from Git, Mercurial and Bazaar
repositories and ability to freeze them. Refactored support for version repositories and ability to freeze them. Refactored support for version
@@ -590,8 +808,9 @@ Changelog
* Add ``--simulate`` option to ``pip zip``. * Add ``--simulate`` option to ``pip zip``.
0.2.1
----- **0.2.1**
* Fixed small problem that prevented using ``pip.py`` without actually * Fixed small problem that prevented using ``pip.py`` without actually
installing pip. installing pip.
@@ -610,8 +829,9 @@ Changelog
* Turn some tar file errors into warnings. * Turn some tar file errors into warnings.
0.2
--- **0.2**
* Renamed to ``pip``, and to install you now do ``pip install * Renamed to ``pip``, and to install you now do ``pip install
PACKAGE`` PACKAGE``
@@ -624,8 +844,9 @@ Changelog
creating a bundle using unnamed packages (like just an svn creating a bundle using unnamed packages (like just an svn
repository without ``#egg=Package``). repository without ``#egg=Package``).
0.1.4
----- **0.1.4**
* Added an option ``--install-option`` to pass options to pass * Added an option ``--install-option`` to pass options to pass
arguments to ``setup.py install`` arguments to ``setup.py install``
@@ -651,16 +872,18 @@ Changelog
is still required, but just some downloads will be avoided when is still required, but just some downloads will be avoided when
using this. using this.
0.1.3
----- **0.1.3**
* Always use ``svn checkout`` (not ``export``) so that * Always use ``svn checkout`` (not ``export``) so that
``tag_svn_revision`` settings give the revision of the package. ``tag_svn_revision`` settings give the revision of the package.
* Don't update checkouts that came from ``.pybundle`` files. * Don't update checkouts that came from ``.pybundle`` files.
0.1.2
----- **0.1.2**
* Improve error text when there are errors fetching HTML pages when * Improve error text when there are errors fetching HTML pages when
seeking packages. seeking packages.
@@ -673,8 +896,9 @@ Changelog
* Fix ``dependency_links`` for finding packages. * Fix ``dependency_links`` for finding packages.
0.1.1
----- **0.1.1**
* Fixed a NameError exception when running pip outside of a * Fixed a NameError exception when running pip outside of a
virtualenv environment. virtualenv environment.
@@ -684,7 +908,8 @@ Changelog
* Fixed use of ``hashlib.md5`` on python2.5+ (also from Prabhu * Fixed use of ``hashlib.md5`` on python2.5+ (also from Prabhu
Ramachandran) Ramachandran)
0.1
--- **0.1**
* Initial release * Initial release
@@ -1,4 +1,4 @@
Copyright (c) 2008-2013 The pip developers (see AUTHORS.txt file) Copyright (c) 2008-2014 The pip developers (see AUTHORS.txt file)
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
@@ -18,22 +18,3 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License for Bundle of CA Root Certificates (pip/cacert.pem)
===========================================================
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301
@@ -3,7 +3,7 @@ include LICENSE.txt
include CHANGES.txt include CHANGES.txt
include PROJECT.txt include PROJECT.txt
include pip/cacert.pem include pip/cacert.pem
recursive-include docs *.txt recursive-include docs *.rst
recursive-include docs *.html recursive-include docs *.html
recursive-exclude docs/_build *.txt recursive-exclude docs/_build *.rst
prune docs/_build/_sources prune docs/_build/_sources
+91
View File
@@ -0,0 +1,91 @@
Metadata-Version: 1.1
Name: pip
Version: 1.5.4
Summary: A tool for installing and managing Python packages.
Home-page: http://www.pip-installer.org
Author: The pip developers
Author-email: python-virtualenv@groups.google.com
License: MIT
Description:
Project Info
============
* Project Page: https://github.com/pypa/pip
* Install howto: http://www.pip-installer.org/en/latest/installing.html
* Changelog: http://www.pip-installer.org/en/latest/news.html
* Bug Tracking: https://github.com/pypa/pip/issues
* Mailing list: http://groups.google.com/group/python-virtualenv
* Docs: http://www.pip-installer.org/
* User IRC: #pip on Freenode.
* Dev IRC: #pypa on Freenode.
Quickstart
==========
First, :doc:`Install pip <installing>`.
Install a package from `PyPI`_:
::
$ pip install SomePackage
[...]
Successfully installed SomePackage
Show what files were installed:
::
$ pip show --files SomePackage
Name: SomePackage
Version: 1.0
Location: /my/env/lib/pythonx.x/site-packages
Files:
../somepackage/__init__.py
[...]
List what packages are outdated:
::
$ pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
Upgrade a package:
::
$ pip install --upgrade SomePackage
[...]
Found existing installation: SomePackage 1.0
Uninstalling SomePackage:
Successfully uninstalled SomePackage
Running setup.py install for SomePackage
Successfully installed SomePackage
Uninstall a package:
::
$ pip uninstall SomePackage
Uninstalling SomePackage:
/my/env/lib/pythonx.x/site-packages/somepackage
Proceed (y/n)? y
Successfully uninstalled SomePackage
.. _PyPI: http://pypi.python.org/pypi/
Keywords: easy_install distutils setuptools egg virtualenv
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Build Tools
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
+11
View File
@@ -0,0 +1,11 @@
Project Info
============
* Project Page: https://github.com/pypa/pip
* Install howto: http://www.pip-installer.org/en/latest/installing.html
* Changelog: http://www.pip-installer.org/en/latest/news.html
* Bug Tracking: https://github.com/pypa/pip/issues
* Mailing list: http://groups.google.com/group/python-virtualenv
* Docs: http://www.pip-installer.org/
* User IRC: #pip on Freenode.
* Dev IRC: #pypa on Freenode.
@@ -1,6 +1,9 @@
pip pip
=== ===
.. image:: https://pypip.in/v/pip/badge.png
:target: https://crate.io/packages/pip
.. image:: https://secure.travis-ci.org/pypa/pip.png?branch=develop .. image:: https://secure.travis-ci.org/pypa/pip.png?branch=develop
:target: http://travis-ci.org/pypa/pip :target: http://travis-ci.org/pypa/pip
+8
View File
@@ -0,0 +1,8 @@
:orphan:
Configuration
=============
This content is now covered in the :doc:`User Guide <user_guide>`
+8
View File
@@ -0,0 +1,8 @@
:orphan:
============
Cookbook
============
This content is now covered in the :doc:`User Guide <user_guide>`
+126
View File
@@ -0,0 +1,126 @@
===========
Development
===========
Pull Requests
=============
Submit Pull Requests against the `develop` branch.
Provide a good description of what you're doing and why.
Provide tests that cover your changes and try to run the tests locally first.
Automated Testing
=================
All pull requests and merges to 'develop' branch are tested in `Travis <https://travis-ci.org/>`_
based on our `.travis.yml file <https://github.com/pypa/pip/blob/develop/.travis.yml>`_.
Usually, a link to your specific travis build appears in pull requests, but if not,
you can find it on our `travis pull requests page <https://travis-ci.org/pypa/pip/pull_requests>`_
The only way to trigger Travis to run again for a pull request, is to submit another change to the pull branch.
We also have Jenkins CI that runs regularly for certain python versions on windows and centos.
Running tests
=============
OS Requirements: subversion, bazaar, git, and mercurial.
Python Requirements: tox or pytest, virtualenv, scripttest, and mock
Ways to run the tests locally:
::
$ tox -e py33 # The preferred way to run the tests, can use pyNN to
# run for a particular version or leave off the -e to
# run for all versions.
$ python setup.py test # Using the setuptools test plugin
$ py.test # Using py.test directly
$ tox # Using tox against pip's tox.ini
Getting Involved
================
The pip project welcomes help in the following ways:
- Making Pull Requests for code, tests, or docs.
- Commenting on open issues and pull requests.
- Helping to answer questions on the mailing list.
If you want to become an official maintainer, start by helping out.
Later, when you think you're ready, get in touch with one of the maintainers,
and they will initiate a vote.
Release Process
===============
This process includes virtualenv, since pip releases necessitate a virtualenv release.
As an example, the instructions assume we're releasing pip-1.4, and virtualenv-1.10.
1. Upgrade setuptools, if needed:
#. Upgrade setuptools in ``virtualenv/develop`` using the :ref:`Refresh virtualenv` process.
#. Create a pull request against ``pip/develop`` with a modified ``.travis.yml`` file that installs virtualenv from ``virtualenv/develop``, to confirm the travis builds are still passing.
2. Create Release branches:
#. Create ``pip/release-1.4`` branch.
#. In ``pip/develop``, change ``pip.version`` to '1.5.dev1'.
#. Create ``virtualenv/release-1.10`` branch.
#. In ``virtualenv/develop``, change ``virtualenv.version`` to '1.11.dev1'.
3. Prepare "rcX":
#. In ``pip/release-1.4``, change ``pip.version`` to '1.4rcX', and tag with '1.4rcX'.
#. Build a pip sdist from ``pip/release-1.4``, and build it into ``virtualenv/release-1.10`` using the :ref:`Refresh virtualenv` process.
#. In ``virtualenv/release-1.10``, change ``virtualenv.version`` to '1.10rcX', and tag with '1.10rcX'.
4. Announce ``pip-1.4rcX`` and ``virtualenv-1.10rcX`` with the :ref:`RC Install Instructions` and elicit feedback.
5. Apply fixes to 'rcX':
#. Apply fixes to ``pip/release-1.4`` and ``virtualenv/release-1.10``
#. Periodically merge fixes to ``pip/develop`` and ``virtualenv/develop``
6. Repeat #4 thru #6 if needed.
7. Final Release:
#. In ``pip/release-1.4``, change ``pip.version`` to '1.4', and tag with '1.4'.
#. Merge ``pip/release-1.4`` to ``pip/master``.
#. Build a pip sdist from ``pip/release-1.4``, and load it into ``virtualenv/release-1.10`` using the :ref:`Refresh virtualenv` process.
#. Merge ``vitualenv/release-1.10`` to ``virtualenv/develop``.
#. In ``virtualenv/release-1.10``, change ``virtualenv.version`` to '1.10', and tag with '1.10'.
#. Merge ``virtualenv/release-1.10`` to ``virtualenv/master``
#. Build and upload pip and virtualenv sdists to PyPI.
.. _`Refresh virtualenv`:
Refresh virtualenv
++++++++++++++++++
#. Update the embedded versions of pip and setuptools in ``virtualenv_support``.
#. Run ``bin/rebuild-script.py`` to rebuild virtualenv based on the latest versions.
.. _`RC Install Instructions`:
RC Install Instructions
+++++++++++++++++++++++
::
$ curl -L -O https://github.com/pypa/virtualenv/archive/1.10rc1.tar.gz
$ echo "<md5sum value> 1.10rc1.tar.gz" | md5sum -c
1.10rc1.tar.gz: OK
$ tar zxf 1.10rc1.tar.gz
$ python virtualenv-1.10rc1/virtualenv.py myVE
$ myVE/bin/pip install SomePackage
+69
View File
@@ -0,0 +1,69 @@
:orphan:
"ImportError: No module named setuptools"
+++++++++++++++++++++++++++++++++++++++++
Although using ``pip install --upgrade setuptools`` to upgrade from distribute
to setuptools works in isolation, it's possible to get "ImportError: No module
named setuptools" when using pip<1.4 to upgrade a package that depends on
setuptools or distribute.
e.g. when running a command like this: `pip install --upgrade pyramid`
Solution
~~~~~~~~
To prevent the problem in *new* environments (that aren't broken yet):
* Option 1:
* *First* run `pip install -U setuptools`,
* *Then* run the command to upgrade your package (e.g. `pip install --upgrade pyramid`)
* Option 2:
* Upgrade pip using :ref:`get-pip <get-pip>`
* *Then* run the command to upgrade your package (e.g. `pip install --upgrade pyramid`)
To fix the problem once it's occurred, you'll need to manually install the new
setuptools, then rerun the upgrade that failed.
1. Download `ez_setup.py` (https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py)
2. Run `python ez_setup.py`
3. Then rerun your upgrade (e.g. `pip install --upgrade pyramid`)
Cause
~~~~~
distribute-0.7.3 is just an empty wrapper that only serves to require the new
setuptools (setuptools>=0.7) so that it will be installed. (If you don't know
yet, the "new setuptools" is a merge of distribute and setuptools back into one
project).
distribute-0.7.3 does its job well, when the upgrade is done in isolation.
E.g. if you're currently on distribute-0.6.X, then running `pip install -U
setuptools` works fine to upgrade you to setuptools>=0.7.
The problem occurs when:
1. you are currently using an older distribute (i.e. 0.6.X)
2. and you try to use pip to upgrade a package that *depends* on setuptools or
distribute.
As part of the upgrade process, pip builds an install list that ends up
including distribute-0.7.3 and setuptools>=0.7 , but they can end up being
separated by other dependencies in the list, so what can happen is this:
1. pip uninstalls the existing distribute
2. pip installs distribute-0.7.3 (which has no importable setuptools, that pip
*needs* internally to function)
3. pip moves on to install another dependency (before setuptools>=0.7) and is
unable to proceed without the setuptools package
Note that pip v1.4 has fixes to prevent this. distribute-0.7.3 (or
setuptools>=0.7) by themselves cannot prevent this kind of problem.
.. _setuptools: https://pypi.python.org/pypi/setuptools
.. _distribute: https://pypi.python.org/pypi/distribute
+25
View File
@@ -0,0 +1,25 @@
pip
===
`User list <http://groups.google.com/group/python-virtualenv>`_ |
`Dev list <http://groups.google.com/group/pypa-dev>`_ |
`Github <https://github.com/pypa/pip>`_ |
`PyPI <https://pypi.python.org/pypi/pip/>`_ |
User IRC: #pip |
Dev IRC: #pypa
The `PyPA recommended
<https://python-packaging-user-guide.readthedocs.org/en/latest/current.html>`_
tool for installing and managing Python packages.
.. toctree::
:maxdepth: 2
quickstart
installing
user_guide
reference/index
development
news
+66
View File
@@ -0,0 +1,66 @@
.. _`Installation`:
Installation
============
Python & OS Support
-------------------
pip works with CPython versions 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 and also pypy.
pip works on Unix/Linux, OS X, and Windows.
.. note::
Python 2.5 was supported through v1.3.1, and Python 2.4 was supported through v1.1.
.. _`get-pip`:
Install or Upgrade pip
----------------------
To install or upgrade pip, securely download `get-pip.py
<https://raw.github.com/pypa/pip/master/contrib/get-pip.py>`_. [1]_
Then run the following (which may require administrator access)::
$ python get-pip.py
If `setuptools`_ (or `distribute`_) is not already installed, ``get-pip.py`` will
install `setuptools`_ for you. [2]_
To upgrade an existing `setuptools`_ (or `distribute`_), run ``pip install -U setuptools`` [3]_
Using Package Managers
----------------------
On Linux, pip will generally be available for the system install of python using
the system package manager, although often the latest version will be
unavailable.
On Debian and Ubuntu::
$ sudo apt-get install python-pip
On Fedora::
$ sudo yum install python-pip
.. [1] "Secure" in this context means using a modern browser or a
tool like `curl` that verifies SSL certificates when downloading from
https URLs.
.. [2] Beginning with pip v1.5.1, ``get-pip.py`` stopped requiring setuptools to
be installed first.
.. [3] Although using ``pip install --upgrade setuptools`` to upgrade from
distribute to setuptools works in isolation, it's possible to get
"ImportError: No module named setuptools" when using pip<1.4 to upgrade a
package that depends on setuptools or distribute. See :doc:`here for
details <distribute_setuptools>`.
.. _setuptools: https://pypi.python.org/pypi/setuptools
.. _distribute: https://pypi.python.org/pypi/distribute
+8
View File
@@ -0,0 +1,8 @@
:orphan:
================
Internal Details
================
This content is now covered in the :doc:`Reference Guide <reference/index>`
+5
View File
@@ -0,0 +1,5 @@
=============
Release Notes
=============
.. include:: ../CHANGES.txt
@@ -1,12 +1,13 @@
Quickstart Quickstart
========== ==========
Install a package: First, :doc:`Install pip <installing>`.
Install a package from `PyPI`_:
:: ::
$ pip install SomePackage==1.0 $ pip install SomePackage
[...] [...]
Successfully installed SomePackage Successfully installed SomePackage
@@ -51,3 +52,5 @@ Uninstall a package:
Proceed (y/n)? y Proceed (y/n)? y
Successfully uninstalled SomePackage Successfully uninstalled SomePackage
.. _PyPI: http://pypi.python.org/pypi/
+17
View File
@@ -0,0 +1,17 @@
===============
Reference Guide
===============
.. toctree::
:maxdepth: 2
pip
pip_install
pip_uninstall
pip_freeze
pip_list
pip_show
pip_search
pip_wheel
+80
View File
@@ -0,0 +1,80 @@
pip
---
.. contents::
Usage
*****
::
pip <command> [options]
Description
***********
.. _`Logging`:
Logging
=======
Console logging
~~~~~~~~~~~~~~~
pip offers :ref:`-v, --verbose <--verbose>` and :ref:`-q, --quiet <--quiet>`
to control the console log level. Each option can be used multiple times and
used together. One ``-v`` increases the verbosity by one, whereas one ``-q`` decreases it by
one.
The series of log levels, in order, are as follows::
VERBOSE_DEBUG, DEBUG, INFO, NOTIFY, WARN, ERROR, FATAL
``NOTIFY`` is the default level.
A few examples on how the parameters work to affect the level:
* specifying nothing results in ``NOTIFY``
* ``-v`` results in ``INFO``
* ``-vv`` results in ``DEBUG``
* ``-q`` results in ``WARN``
* ``-vq`` results in ``NOTIFY``
The most practical use case for users is either ``-v`` or ``-vv`` to see
additional logging to help troubleshoot an issue.
.. _`FileLogging`:
File logging
~~~~~~~~~~~~
pip offers the :ref:`--log <--log>` option for specifying a file where a maximum
verbosity log will be kept. This option is empty by default. This log appends
to previous logging.
Additionally, when commands fail (i.e. return a non-zero exit code), pip writes
a "failure log" for the failed command. This log overwrites previous
logging. The default location is as follows:
* On Unix and Mac OS X: :file:`$HOME/.pip/pip.log`
* On Windows, the configuration file is: :file:`%HOME%\\pip\\pip.log`
The option for the failure log, is :ref:`--log-file <--log-file>`.
Both logs add a line per execution to specify the date and what pip executable wrote the log.
Like all pip options, ``--log`` and ``log-file``, can also be set as an environment
variable, or placed into the pip config file. See the :ref:`Configuration`
section.
.. _`General Options`:
General Options
***************
.. pip-general-options::
+46
View File
@@ -0,0 +1,46 @@
.. _`pip freeze`:
pip freeze
-----------
.. contents::
Usage
*****
.. pip-command-usage:: freeze
Description
***********
.. pip-command-description:: freeze
Options
*******
.. pip-command-options:: freeze
Examples
********
1) Generate output suitable for a requirements file.
::
$ pip freeze
Jinja2==2.6
Pygments==1.5
Sphinx==1.1.3
docutils==0.9.1
2) Generate a requirements file and then install from it in another environment.
::
$ env1/bin/pip freeze > requirements.txt
$ env2/bin/pip install -r requirements.txt
+439
View File
@@ -0,0 +1,439 @@
.. _`pip install`:
pip install
-----------
.. contents::
Usage
*****
.. pip-command-usage:: install
Description
***********
.. pip-command-description:: install
.. _`Requirements File Format`:
Requirements File Format
++++++++++++++++++++++++
Each line of the requirements file indicates something to be installed,
and like arguments to :ref:`pip install`, the following forms are supported::
<requirement specifier>
<archive url/path>
[-e] <local project path>
[-e] <vcs project url>
See the :ref:`pip install Examples<pip install Examples>` for examples of all these forms.
A line beginning with ``#`` is treated as a comment and ignored.
Additionally, the following Package Index Options are supported:
* :ref:`-i, --index-url <--index-url>`
* :ref:`--extra-index-url <--extra-index-url>`
* :ref:`--no-index <--no-index>`
* :ref:`-f, --find-links <--find-links>`
* :ref:`--allow-external <--allow-external>`
* :ref:`--allow-all-external <--allow-external>`
* :ref:`--allow-unverified <--allow-unverified>`
For example, to specify :ref:`--no-index <--no-index>` and 2 :ref:`--find-links <--find-links>` locations:
::
--no-index
--find-links /my/local/archives
--find-links http://some.archives.com/archives
Lastly, if you wish, you can refer to other requirements files, like this::
-r more_requirements.txt
.. _`Requirement Specifiers`:
Requirement Specifiers
++++++++++++++++++++++
pip supports installing from "requirement specifiers" as implemented in
`pkg_resources Requirements <http://packages.python.org/setuptools/pkg_resources.html#requirement-objects>`_
Some Examples:
::
'FooProject >= 1.2'
Fizzy [foo, bar]
'PickyThing<1.6,>1.9,!=1.9.6,<2.0a0,==2.4c1'
SomethingWhoseVersionIDontCareAbout
.. note::
Use single or double quotes around specifiers to avoid ``>`` and ``<`` being
interpreted as shell redirects. e.g. ``pip install 'FooProject>=1.2'``.
.. _`Pre Release Versions`:
Pre-release Versions
++++++++++++++++++++
Starting with v1.4, pip will only install stable versions as specified by
`PEP426`_ by default. If a version cannot be parsed as a compliant `PEP426`_
version then it is assumed to be a pre-release.
If a Requirement specifier includes a pre-release or development version
(e.g. ``>=0.0.dev0``) then pip will allow pre-release and development versions
for that requirement. This does not include the != flag.
The ``pip install`` command also supports a :ref:`--pre <install_--pre>` flag
that will enable installing pre-releases and development releases.
.. _PEP426: http://www.python.org/dev/peps/pep-0426
.. _`Externally Hosted Files`:
Externally Hosted Files
+++++++++++++++++++++++
Starting with v1.4, pip will warn about installing any file that does not come
from the primary index. As of version 1.5, pip defaults to ignoring these files
unless asked to consider them.
The ``pip install`` command supports a
:ref:`--allow-external PROJECT <--allow-external>` option that will enable
installing links that are linked directly from the simple index but to an
external host that also have a supported hash fragment. Externally hosted
files for all projects may be enabled using the
:ref:`--allow-all-external <--allow-all-external>` flag to the ``pip install``
command.
The ``pip install`` command also supports a
:ref:`--allow-unverified PROJECT <--allow-unverified>` option that will enable
installing insecurely linked files. These are either directly linked (as above)
files without a hash, or files that are linked from either the home page or the
download url of a package.
These options can be used in a requirements file. Assuming some fictional
`ExternalPackage` that is hosted external and unverified, then your requirements
file would be like so::
--allow-external ExternalPackage
--allow-unverified ExternalPackage
ExternalPackage
.. _`VCS Support`:
VCS Support
+++++++++++
pip supports installing from Git, Mercurial, Subversion and Bazaar, and detects
the type of VCS using url prefixes: "git+", "hg+", "bzr+", "svn+".
pip requires a working VCS command on your path: git, hg, svn, or bzr.
VCS projects can be installed in :ref:`editable mode <editable-installs>` (using
the :ref:`--editable <install_--editable>` option) or not.
* For editable installs, the clone location by default is "<venv
path>/src/SomeProject" in virtual environments, and "<cwd>/src/SomeProject"
for global installs. The :ref:`--src <install_--src>` option can be used to
modify this location.
* For non-editable installs, the project is built locally in a temp dir and then
installed normally.
The url suffix "egg=<project name>" is used by pip in it's dependency logic to
identify the project prior to pip downloading and analyzing the metadata.
Git
~~~
pip currently supports cloning over ``git``, ``git+https`` and ``git+ssh``:
Here are the supported forms::
[-e] git+git://git.myproject.org/MyProject#egg=MyProject
[-e] git+https://git.myproject.org/MyProject#egg=MyProject
[-e] git+ssh://git.myproject.org/MyProject#egg=MyProject
-e git+git@git.myproject.org:MyProject#egg=MyProject
Passing branch names, a commit hash or a tag name is possible like so::
[-e] git://git.myproject.org/MyProject.git@master#egg=MyProject
[-e] git://git.myproject.org/MyProject.git@v1.0#egg=MyProject
[-e] git://git.myproject.org/MyProject.git@da39a3ee5e6b4b0d3255bfef95601890afd80709#egg=MyProject
Mercurial
~~~~~~~~~
The supported schemes are: ``hg+http``, ``hg+https``,
``hg+static-http`` and ``hg+ssh``.
Here are the supported forms::
[-e] hg+http://hg.myproject.org/MyProject#egg=MyProject
[-e] hg+https://hg.myproject.org/MyProject#egg=MyProject
[-e] hg+ssh://hg.myproject.org/MyProject#egg=MyProject
You can also specify a revision number, a revision hash, a tag name or a local
branch name like so::
[-e] hg+http://hg.myproject.org/MyProject@da39a3ee5e6b#egg=MyProject
[-e] hg+http://hg.myproject.org/MyProject@2019#egg=MyProject
[-e] hg+http://hg.myproject.org/MyProject@v1.0#egg=MyProject
[-e] hg+http://hg.myproject.org/MyProject@special_feature#egg=MyProject
Subversion
~~~~~~~~~~
pip supports the URL schemes ``svn``, ``svn+svn``, ``svn+http``, ``svn+https``, ``svn+ssh``.
You can also give specific revisions to an SVN URL, like so::
[-e] svn+svn://svn.myproject.org/svn/MyProject#egg=MyProject
[-e] svn+http://svn.myproject.org/svn/MyProject/trunk@2019#egg=MyProject
which will check out revision 2019. ``@{20080101}`` would also check
out the revision from 2008-01-01. You can only check out specific
revisions using ``-e svn+...``.
Bazaar
~~~~~~
pip supports Bazaar using the ``bzr+http``, ``bzr+https``, ``bzr+ssh``,
``bzr+sftp``, ``bzr+ftp`` and ``bzr+lp`` schemes.
Here are the supported forms::
[-e] bzr+http://bzr.myproject.org/MyProject/trunk#egg=MyProject
[-e] bzr+sftp://user@myproject.org/MyProject/trunk#egg=MyProject
[-e] bzr+ssh://user@myproject.org/MyProject/trunk#egg=MyProject
[-e] bzr+ftp://user@myproject.org/MyProject/trunk#egg=MyProject
[-e] bzr+lp:MyProject#egg=MyProject
Tags or revisions can be installed like so::
[-e] bzr+https://bzr.myproject.org/MyProject/trunk@2019#egg=MyProject
[-e] bzr+http://bzr.myproject.org/MyProject/trunk@v1.0#egg=MyProject
Finding Packages
++++++++++++++++
pip searches for packages on `PyPI`_ using the
`http simple interface <http://pypi.python.org/simple>`_,
which is documented `here <http://packages.python.org/setuptools/easy_install.html#package-index-api>`_
and `there <http://www.python.org/dev/peps/pep-0301/>`_
pip offers a number of Package Index Options for modifying how packages are found.
See the :ref:`pip install Examples<pip install Examples>`.
.. _`SSL Certificate Verification`:
SSL Certificate Verification
++++++++++++++++++++++++++++
Starting with v1.3, pip provides SSL certificate verification over https, for the purpose
of providing secure, certified downloads from PyPI.
Hash Verification
+++++++++++++++++
PyPI provides md5 hashes in the hash fragment of package download urls.
pip supports checking this, as well as any of the
guaranteed hashlib algorithms (sha1, sha224, sha384, sha256, sha512, md5).
The hash fragment is case sensitive (i.e. sha1 not SHA1).
This check is only intended to provide basic download corruption protection.
It is not intended to provide security against tampering. For that,
see :ref:`SSL Certificate Verification`
Download Cache
++++++++++++++
pip offers a :ref:`--download-cache <install_--download-cache>` option for
installs to prevent redundant downloads of archives from PyPI.
The point of this cache is *not* to circumvent the index crawling process, but
to *just* prevent redundant downloads.
Items are stored in this cache based on the url the archive was found at, not
simply the archive name.
If you want a fast/local install solution that circumvents crawling PyPI, see
the :ref:`Fast & Local Installs`.
Like all options, :ref:`--download-cache <install_--download-cache>`, can also
be set as an environment variable, or placed into the pip config file. See the
:ref:`Configuration` section.
.. _`editable-installs`:
"Editable" Installs
+++++++++++++++++++
"Editable" installs are fundamentally `"setuptools develop mode"
<http://packages.python.org/setuptools/setuptools.html#development-mode>`_
installs.
You can install local projects or VCS projects in "editable" mode::
$ pip install -e path/to/SomeProject
$ pip install -e git+http://repo/my_project.git#egg=SomeProject
For local projects, the "SomeProject.egg-info" directory is created relative to
the project path. This is one advantage over just using ``setup.py develop``,
which creates the "egg-info" directly relative the current working directory.
Controlling setup_requires
++++++++++++++++++++++++++
Setuptools offers the ``setup_requires`` `setup() keyword
<http://pythonhosted.org/setuptools/setuptools.html#new-and-changed-setup-keywords>`_
for specifying dependencies that need to be present in order for the `setup.py`
script to run. Internally, Setuptools uses ``easy_install`` to fulfill these
dependencies.
pip has no way to control how these dependencies are located. None of the
Package Index Options have an effect.
The solution is to configure a "system" or "personal" `Distutils configuration
file
<http://docs.python.org/2/install/index.html#distutils-configuration-files>`_ to
manage the fulfillment.
For example, to have the dependency located at an alternate index, add this:
::
[easy_install]
index_url = https://my.index-mirror.com
To have the dependency located from a local directory and not crawl PyPI, add this:
::
[easy_install]
allow_hosts = ''
find_links = file:///path/to/local/archives
Options
*******
.. pip-command-options:: install
.. pip-index-options::
.. _`pip install Examples`:
Examples
********
1) Install `SomePackage` and it's dependencies from `PyPI`_ using :ref:`Requirement Specifiers`
::
$ pip install SomePackage # latest version
$ pip install SomePackage==1.0.4 # specific version
$ pip install 'SomePackage>=1.0.4' # minimum version
2) Install a list of requirements specified in a file. See the :ref:`Requirements files <Requirements Files>`.
::
$ pip install -r requirements.txt
3) Upgrade an already installed `SomePackage` to the latest from PyPI.
::
$ pip install --upgrade SomePackage
4) Install a local project in "editable" mode. See the section on :ref:`Editable Installs <editable-installs>`.
::
$ pip install -e . # project in current directory
$ pip install -e path/to/project # project in another directory
5) Install a project from VCS in "editable" mode. See the sections on :ref:`VCS Support <VCS Support>` and :ref:`Editable Installs <editable-installs>`.
::
$ pip install -e git+https://git.repo/some_pkg.git#egg=SomePackage # from git
$ pip install -e hg+https://hg.repo/some_pkg.git#egg=SomePackage # from mercurial
$ pip install -e svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage # from svn
$ pip install -e git+https://git.repo/some_pkg.git@feature#egg=SomePackage # from 'feature' branch
$ pip install -e git+https://git.repo/some_repo.git@egg=subdir&subdirectory=subdir_path # install a python package from a repo subdirectory
6) Install a package with `setuptools extras`_.
::
$ pip install SomePackage[PDF]
$ pip install SomePackage[PDF]==3.0
$ pip install -e .[PDF]==3.0 # editable project in current directory
7) Install a particular source archive file.
::
$ pip install ./downloads/SomePackage-1.0.4.tar.gz
$ pip install http://my.package.repo/SomePackage-1.0.4.zip
8) Install from alternative package repositories.
Install from a different index, and not `PyPI`_ ::
$ pip install --index-url http://my.package.repo/simple/ SomePackage
Search an additional index during install, in addition to `PyPI`_ ::
$ pip install --extra-index-url http://my.package.repo/simple SomePackage
Install from a local flat directory containing archives (and don't scan indexes)::
$ pip install --no-index --find-links=file:///local/dir/ SomePackage
$ pip install --no-index --find-links=/local/dir/ SomePackage
$ pip install --no-index --find-links=relative/dir/ SomePackage
9) Find pre-release and development versions, in addition to stable versions. By default, pip only finds stable versions.
::
$ pip install --pre SomePackage
.. _PyPI: http://pypi.python.org/pypi/
.. _setuptools extras: http://packages.python.org/setuptools/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies
+45
View File
@@ -0,0 +1,45 @@
.. _`pip list`:
pip list
---------
.. contents::
Usage
*****
.. pip-command-usage:: list
Description
***********
.. pip-command-description:: list
Options
*******
.. pip-command-options:: list
.. pip-index-options::
Examples
********
1) List installed packages.
::
$ pip list
Pygments (1.5)
docutils (0.9.1)
Sphinx (1.1.2)
Jinja2 (2.6)
2) List outdated packages (excluding editables), and the latest version available
::
$ pip list --outdated
docutils (Current: 0.9.1 Latest: 0.10)
Sphinx (Current: 1.1.2 Latest: 1.1.3)
+36
View File
@@ -0,0 +1,36 @@
.. _`pip search`:
pip search
----------
.. contents::
Usage
*****
.. pip-command-usage:: search
Description
***********
.. pip-command-description:: search
Options
*******
.. pip-command-options:: search
Examples
********
1. Search for "peppercorn"
::
$ pip search peppercorn
pepperedform - Helpers for using peppercorn with formprocess.
peppercorn - A library for converting a token stream into [...]
.. _`pip wheel`:
+37
View File
@@ -0,0 +1,37 @@
.. _`pip show`:
pip show
--------
.. contents::
Usage
*****
.. pip-command-usage:: show
Description
***********
.. pip-command-description:: show
Options
*******
.. pip-command-options:: show
Examples
********
1. Show information about a package:
::
$ pip show sphinx
---
Name: Sphinx
Version: 1.1.3
Location: /my/env/lib/pythonx.x/site-packages
Requires: Pygments, Jinja2, docutils
+37
View File
@@ -0,0 +1,37 @@
.. _`pip uninstall`:
pip uninstall
-------------
.. contents::
Usage
*****
.. pip-command-usage:: uninstall
Description
***********
.. pip-command-description:: uninstall
Options
*******
.. pip-command-options:: uninstall
Examples
********
1) Uninstall a package.
::
$ pip uninstall simplejson
Uninstalling simplejson:
/home/me/env/lib/python2.7/site-packages/simplejson
/home/me/env/lib/python2.7/site-packages/simplejson-2.2.1-py2.7.egg-info
Proceed (y/n)? y
Successfully uninstalled simplejson
+37
View File
@@ -0,0 +1,37 @@
.. _`pip wheel`:
pip wheel
---------
.. contents::
Usage
*****
.. pip-command-usage:: wheel
Description
***********
.. pip-command-description:: wheel
Options
*******
.. pip-command-options:: wheel
.. pip-index-options::
Examples
********
1. Build wheels for a requirement (and all its dependencies), and then install
::
$ pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
$ pip install --no-index --find-links=/tmp/wheelhouse SomePackage
+8
View File
@@ -0,0 +1,8 @@
:orphan:
==========
Usage
==========
The "Usage" section is now covered in the :doc:`Reference Guide <reference/index>`
+516
View File
@@ -0,0 +1,516 @@
==========
User Guide
==========
.. contents::
Installing Packages
*******************
pip supports installing from `PyPI`_, version control, local projects, and
directly from distribution files.
The most common scenario is to install from `PyPI`_ using :ref:`Requirement
Specifiers`
::
$ pip install SomePackage # latest version
$ pip install SomePackage==1.0.4 # specific version
$ pip install 'SomePackage>=1.0.4' # minimum version
For more information and examples, see the :ref:`pip install` reference.
.. _`Requirements Files`:
Requirements Files
******************
"Requirements files" are files containing a list of items to be
installed using :ref:`pip install` like so:
::
pip install -r requirements.txt
Details on the format of the files are here: :ref:`Requirements File Format`.
Logically, a Requirements file is just a list of :ref:`pip install` arguments
placed in a file.
In practice, there are 4 common uses of Requirements files:
1. Requirements files are used to hold the result from :ref:`pip freeze` for the
purpose of achieving :ref:`repeatable installations <Repeatability>`. In
this case, your requirement file contains a pinned version of everything that
was installed when `pip freeze` was run.
::
pip freeze > requirements.txt
pip install -r requirements.txt
2. Requirements files are used to force pip to properly resolve dependencies.
As it is now, pip `doesn't have true dependency resolution
<https://github.com/pypa/pip/issues/988>`_, but instead simply uses the first
specification it finds for a project. E.g if `pkg1` requires `pkg3>=1.0` and
`pkg2` requires `pkg3>=1.0,<=2.0`, and if `pkg1` is resolved first, pip will
only use `pkg3>=1.0`, and could easily end up installing a version of `pkg3`
that conflicts with the needs of `pkg2`. To solve this problem, you can
place `pkg3>=1.0,<=2.0` (i.e. the correct specification) into your
requirements file directly along with the other top level requirements. Like
so:
::
pkg1
pkg2
pkg3>=1.0,<=2.0
3. Requirements files are used to force pip to install an alternate version of a
sub-dependency. For example, suppose `ProjectA` in your requirements file
requires `ProjectB`, but the latest version (v1.3) has a bug, you can force
pip to accept earlier versions like so:
::
ProjectA
ProjectB<1.3
4. Requirements files are used to override a dependency with a local patch that
lives in version control. For example, suppose a dependency,
`SomeDependency` from PyPI has a bug, and you can't wait for an upstream fix.
You could clone/copy the src, make the fix, and place it in vcs with the tag
`sometag`. You'd reference it in your requirements file with a line like so:
::
git+https://myvcs.com/some_dependency@sometag#egg=SomeDependency
If `SomeDependency` was previously a top-level requirement in your
requirements file, then **replace** that line with the new line. If
`SomeDependency` is a sub-dependency, then **add** the new line.
It's important to be clear that pip determines package dependencies using
`install_requires metadata
<http://pythonhosted.org/setuptools/setuptools.html#declaring-dependencies>`_,
not by discovering `requirements.txt` files embedded in projects.
See also:
* :ref:`Requirements File Format`
* :ref:`pip freeze`
* `"setup.py vs requirements.txt" (an article by Donald Stufft)
<https://caremad.io/blog/setup-vs-requirement/>`_
.. _`Installing from Wheels`:
Installing from Wheels
**********************
"Wheel" is a built, archive format that can greatly speed installation compared
to building and installing from source archives. For more information, see the
`Wheel docs <http://wheel.readthedocs.org>`_ ,
`PEP427 <http://www.python.org/dev/peps/pep-0427>`_, and
`PEP425 <http://www.python.org/dev/peps/pep-0425>`_
Pip prefers Wheels where they are available. To disable this, use the
:ref:`--no-use-wheel <install_--no-use-wheel>` flag for :ref:`pip install`.
If no satisfactory wheels are found, pip will default to finding source archives.
To install directly from a wheel archive:
::
pip install SomePackage-1.0-py2.py3-none-any.whl
For the cases where wheels are not available, pip offers :ref:`pip wheel` as a
convenience, to build wheels for all your requirements and dependencies.
:ref:`pip wheel` requires the `wheel package
<https://pypi.python.org/pypi/wheel>`_ to be installed, which provides the
"bdist_wheel" setuptools extension that it uses.
To build wheels for your requirements and all their dependencies to a local directory:
::
pip install wheel
pip wheel --wheel-dir=/local/wheels -r requirements.txt
And *then* to install those requirements just using your local directory of wheels (and not from PyPI):
::
pip install --no-index --find-links=/local/wheels -r requirements.txt
Uninstalling Packages
*********************
pip is able to uninstall most packages like so:
::
$ pip uninstall SomePackage
pip also performs an automatic uninstall of an old version of a package
before upgrading to a newer version.
For more information and examples, see the :ref:`pip uninstall` reference.
Listing Packages
****************
To list installed packages:
::
$ pip list
Pygments (1.5)
docutils (0.9.1)
Sphinx (1.1.2)
Jinja2 (2.6)
To list outdated packages, and show the latest version available:
::
$ pip list --outdated
docutils (Current: 0.9.1 Latest: 0.10)
Sphinx (Current: 1.1.2 Latest: 1.1.3)
To show details about an installed package:
::
$ pip show sphinx
---
Name: Sphinx
Version: 1.1.3
Location: /my/env/lib/pythonx.x/site-packages
Requires: Pygments, Jinja2, docutils
For more information and examples, see the :ref:`pip list` and :ref:`pip show`
reference pages.
Searching for Packages
**********************
pip can search `PyPI`_ for packages using the ``pip search``
command::
$ pip search "query"
The query will be used to search the names and summaries of all
packages.
For more information and examples, see the :ref:`pip search` reference.
.. _`Configuration`:
Configuration
*************
.. _config-file:
Config file
------------
pip allows you to set all command line option defaults in a standard ini
style config file.
The names and locations of the configuration files vary slightly across
platforms.
* On Unix and Mac OS X the configuration file is: :file:`$HOME/.pip/pip.conf`
* On Windows, the configuration file is: :file:`%HOME%\\pip\\pip.ini`
You can set a custom path location for the config file using the environment variable ``PIP_CONFIG_FILE``.
In a virtual environment, an additional config file will be read from the base
directory of the virtualenv (``sys.prefix`` as reported by Python). The base
name of the file is the same as the user configuration file (:file:`pip.conf`
on Unix and OSX, :file:`pip.ini` on Windows). Values in the virtualenv-specific
configuration file take precedence over those in the user's configuration file
(whether from the user home or specified via ``PIP_CONFIG_FILE``).
The names of the settings are derived from the long command line option, e.g.
if you want to use a different package index (``--index-url``) and set the
HTTP timeout (``--default-timeout``) to 60 seconds your config file would
look like this:
.. code-block:: ini
[global]
timeout = 60
index-url = http://download.zope.org/ppix
Each subcommand can be configured optionally in its own section so that every
global setting with the same name will be overridden; e.g. decreasing the
``timeout`` to ``10`` seconds when running the `freeze`
(`Freezing Requirements <./#freezing-requirements>`_) command and using
``60`` seconds for all other commands is possible with:
.. code-block:: ini
[global]
timeout = 60
[freeze]
timeout = 10
Boolean options like ``--ignore-installed`` or ``--no-dependencies`` can be
set like this:
.. code-block:: ini
[install]
ignore-installed = true
no-dependencies = yes
Appending options like ``--find-links`` can be written on multiple lines:
.. code-block:: ini
[global]
find-links =
http://download.example.com
[install]
find-links =
http://mirror1.example.com
http://mirror2.example.com
Environment Variables
---------------------
pip's command line options can be set with environment variables using the
format ``PIP_<UPPER_LONG_NAME>`` . Dashes (``-``) have to be replaced with
underscores (``_``).
For example, to set the default timeout::
export PIP_DEFAULT_TIMEOUT=60
This is the same as passing the option to pip directly::
pip --default-timeout=60 [...]
To set options that can be set multiple times on the command line, just add
spaces in between values. For example::
export PIP_FIND_LINKS="http://mirror1.example.com http://mirror2.example.com"
is the same as calling::
pip install --find-links=http://mirror1.example.com --find-links=http://mirror2.example.com
Config Precedence
-----------------
Command line options have precedence over environment variables, which have precedence over the config file.
Within the config file, command specific sections have precedence over the global section.
Examples:
- ``--host=foo`` overrides ``PIP_HOST=foo``
- ``PIP_HOST=foo`` overrides a config file with ``[global] host = foo``
- A command specific section in the config file ``[<command>] host = bar``
overrides the option with same name in the ``[global]`` config file section
Command Completion
------------------
pip comes with support for command line completion in bash and zsh.
To setup for bash::
$ pip completion --bash >> ~/.profile
To setup for zsh::
$ pip completion --zsh >> ~/.zprofile
Alternatively, you can use the result of the ``completion`` command
directly with the eval function of you shell, e.g. by adding the following to your startup file::
eval "`pip completion --bash`"
.. _`Fast & Local Installs`:
Fast & Local Installs
*********************
Often, you will want a fast install from local archives, without probing PyPI.
First, download the archives that fulfill your requirements::
$ pip install --download <DIR> -r requirements.txt
Then, install using :ref:`--find-links <--find-links>` and :ref:`--no-index <--no-index>`::
$ pip install --no-index --find-links=[file://]<DIR> -r requirements.txt
Non-recursive upgrades
************************
``pip install --upgrade`` is currently written to perform a recursive upgrade.
E.g. supposing:
* `SomePackage-1.0` requires `AnotherPackage>=1.0`
* `SomePackage-2.0` requires `AnotherPackage>=1.0` and `OneMorePoject==1.0`
* `SomePackage-1.0` and `AnotherPackage-1.0` are currently installed
* `SomePackage-2.0` and `AnotherPackage-2.0` are the latest versions available on PyPI.
Running ``pip install --upgrade SomePackage`` would upgrade `SomePackage` *and* `AnotherPackage`
despite `AnotherPackage` already being satisifed.
If you would like to perform a non-recursive upgrade perform these 2 steps::
pip install --upgrade --no-deps SomePackage
pip install SomePackage
The first line will upgrade `SomePackage`, but not dependencies like `AnotherPackage`. The 2nd line will fill in new dependencies like `OneMorePackage`.
User Installs
*************
With Python 2.6 came the `"user scheme" for installation
<http://docs.python.org/install/index.html#alternate-installation-the-user-scheme>`_,
which means that all Python distributions support an alternative install
location that is specific to a user. The default location for each OS is
explained in the python documentation for the `site.USER_BASE
<http://docs.python.org/library/site.html#site.USER_BASE>`_ variable. This mode
of installation can be turned on by specifying the :ref:`--user
<install_--user>` option to ``pip install``.
Moreover, the "user scheme" can be customized by setting the
``PYTHONUSERBASE`` environment variable, which updates the value of ``site.USER_BASE``.
To install "SomePackage" into an environment with site.USER_BASE customized to '/myappenv', do the following::
export PYTHONUSERBASE=/myappenv
pip install --user SomePackage
``pip install --user`` follows four rules:
#. When globally installed packages are on the python path, and they *conflict*
with the installation requirements, they are ignored, and *not*
uninstalled.
#. When globally installed packages are on the python path, and they *satisfy*
the installation requirements, pip does nothing, and reports that
requirement is satisfied (similar to how global packages can satisfy
requirements when installing packages in a ``--system-site-packages``
virtualenv).
#. pip will not perform a ``--user`` install in a ``--no-site-packages``
virtualenv (i.e. the default kind of virtualenv), due to the user site not
being on the python path. The installation would be pointless.
#. In a ``--system-site-packages`` virtualenv, pip will not install a package
that conflicts with a package in the virtualenv site-packages. The --user
installation would lack sys.path precedence and be pointless.
To make the rules clearer, here are some examples:
From within a ``--no-site-packages`` virtualenv (i.e. the default kind)::
$ pip install --user SomePackage
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
From within a ``--system-site-packages`` virtualenv where ``SomePackage==0.3`` is already installed in the virtualenv::
$ pip install --user SomePackage==0.4
Will not install to the user site because it will lack sys.path precedence
From within a real python, where ``SomePackage`` is *not* installed globally::
$ pip install --user SomePackage
[...]
Successfully installed SomePackage
From within a real python, where ``SomePackage`` *is* installed globally, but is *not* the latest version::
$ pip install --user SomePackage
[...]
Requirement already satisfied (use --upgrade to upgrade)
$ pip install --user --upgrade SomePackage
[...]
Successfully installed SomePackage
From within a real python, where ``SomePackage`` *is* installed globally, and is the latest version::
$ pip install --user SomePackage
[...]
Requirement already satisfied (use --upgrade to upgrade)
$ pip install --user --upgrade SomePackage
[...]
Requirement already up-to-date: SomePackage
# force the install
$ pip install --user --ignore-installed SomePackage
[...]
Successfully installed SomePackage
.. _`Repeatability`:
Ensuring Repeatability
**********************
Three things are required to fully guarantee a repeatable installation using requirements files.
1. The requirements file was generated by ``pip freeze`` or you're sure it only
contains requirements that specify a specific version.
2. The installation is performed using :ref:`--no-deps <install_--no-deps>`.
This guarantees that only what is explicitly listed in the requirements file is
installed.
3. The installation is performed against an index or find-links location that is
guaranteed to *not* allow archives to be changed and updated without a
version increase. Unfortunately, this is *not* true on PyPI. It is possible
for the same pypi distribution to have a different hash over time. Project
authors are allowed to delete a distribution, and then upload a new one with
the same name and version, but a different hash. See `Issue #1175
<https://github.com/pypa/pip/issues/1175>`_ for plans to add hash
confirmation to pip, or a new "lock file" notion, but for now, know that the `peep
project <https://pypi.python.org/pypi/peep>`_ offers this feature on top of pip
using requirements file comments.
.. _PyPI: http://pypi.python.org/pypi/
+91
View File
@@ -0,0 +1,91 @@
Metadata-Version: 1.1
Name: pip
Version: 1.5.4
Summary: A tool for installing and managing Python packages.
Home-page: http://www.pip-installer.org
Author: The pip developers
Author-email: python-virtualenv@groups.google.com
License: MIT
Description:
Project Info
============
* Project Page: https://github.com/pypa/pip
* Install howto: http://www.pip-installer.org/en/latest/installing.html
* Changelog: http://www.pip-installer.org/en/latest/news.html
* Bug Tracking: https://github.com/pypa/pip/issues
* Mailing list: http://groups.google.com/group/python-virtualenv
* Docs: http://www.pip-installer.org/
* User IRC: #pip on Freenode.
* Dev IRC: #pypa on Freenode.
Quickstart
==========
First, :doc:`Install pip <installing>`.
Install a package from `PyPI`_:
::
$ pip install SomePackage
[...]
Successfully installed SomePackage
Show what files were installed:
::
$ pip show --files SomePackage
Name: SomePackage
Version: 1.0
Location: /my/env/lib/pythonx.x/site-packages
Files:
../somepackage/__init__.py
[...]
List what packages are outdated:
::
$ pip list --outdated
SomePackage (Current: 1.0 Latest: 2.0)
Upgrade a package:
::
$ pip install --upgrade SomePackage
[...]
Found existing installation: SomePackage 1.0
Uninstalling SomePackage:
Successfully uninstalled SomePackage
Running setup.py install for SomePackage
Successfully installed SomePackage
Uninstall a package:
::
$ pip uninstall SomePackage
Uninstalling SomePackage:
/my/env/lib/pythonx.x/site-packages/somepackage
Proceed (y/n)? y
Successfully uninstalled SomePackage
.. _PyPI: http://pypi.python.org/pypi/
Keywords: easy_install distutils setuptools egg virtualenv
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Software Development :: Build Tools
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.1
Classifier: Programming Language :: Python :: 3.2
Classifier: Programming Language :: Python :: 3.3
+250
View File
@@ -0,0 +1,250 @@
AUTHORS.txt
CHANGES.txt
LICENSE.txt
MANIFEST.in
PROJECT.txt
README.rst
setup.cfg
setup.py
docs/configuration.rst
docs/cookbook.rst
docs/development.rst
docs/distribute_setuptools.rst
docs/index.rst
docs/installing.rst
docs/logic.rst
docs/news.rst
docs/quickstart.rst
docs/usage.rst
docs/user_guide.rst
docs/reference/index.rst
docs/reference/pip.rst
docs/reference/pip_freeze.rst
docs/reference/pip_install.rst
docs/reference/pip_list.rst
docs/reference/pip_search.rst
docs/reference/pip_show.rst
docs/reference/pip_uninstall.rst
docs/reference/pip_wheel.rst
pip/__init__.py
pip/__main__.py
pip/basecommand.py
pip/baseparser.py
pip/cmdoptions.py
pip/download.py
pip/exceptions.py
pip/index.py
pip/locations.py
pip/log.py
pip/pep425tags.py
pip/req.py
pip/runner.py
pip/status_codes.py
pip/util.py
pip/wheel.py
pip.egg-info/PKG-INFO
pip.egg-info/SOURCES.txt
pip.egg-info/dependency_links.txt
pip.egg-info/entry_points.txt
pip.egg-info/not-zip-safe
pip.egg-info/requires.txt
pip.egg-info/top_level.txt
pip/_vendor/__init__.py
pip/_vendor/pkg_resources.py
pip/_vendor/re-vendor.py
pip/_vendor/six.py
pip/_vendor/_markerlib/__init__.py
pip/_vendor/_markerlib/markers.py
pip/_vendor/colorama/__init__.py
pip/_vendor/colorama/ansi.py
pip/_vendor/colorama/ansitowin32.py
pip/_vendor/colorama/initialise.py
pip/_vendor/colorama/win32.py
pip/_vendor/colorama/winterm.py
pip/_vendor/distlib/__init__.py
pip/_vendor/distlib/compat.py
pip/_vendor/distlib/database.py
pip/_vendor/distlib/index.py
pip/_vendor/distlib/locators.py
pip/_vendor/distlib/manifest.py
pip/_vendor/distlib/markers.py
pip/_vendor/distlib/metadata.py
pip/_vendor/distlib/resources.py
pip/_vendor/distlib/scripts.py
pip/_vendor/distlib/t32.exe
pip/_vendor/distlib/t64.exe
pip/_vendor/distlib/util.py
pip/_vendor/distlib/version.py
pip/_vendor/distlib/w32.exe
pip/_vendor/distlib/w64.exe
pip/_vendor/distlib/wheel.py
pip/_vendor/distlib/_backport/__init__.py
pip/_vendor/distlib/_backport/misc.py
pip/_vendor/distlib/_backport/shutil.py
pip/_vendor/distlib/_backport/sysconfig.cfg
pip/_vendor/distlib/_backport/sysconfig.py
pip/_vendor/distlib/_backport/tarfile.py
pip/_vendor/html5lib/__init__.py
pip/_vendor/html5lib/constants.py
pip/_vendor/html5lib/html5parser.py
pip/_vendor/html5lib/ihatexml.py
pip/_vendor/html5lib/inputstream.py
pip/_vendor/html5lib/sanitizer.py
pip/_vendor/html5lib/tokenizer.py
pip/_vendor/html5lib/utils.py
pip/_vendor/html5lib/filters/__init__.py
pip/_vendor/html5lib/filters/_base.py
pip/_vendor/html5lib/filters/alphabeticalattributes.py
pip/_vendor/html5lib/filters/inject_meta_charset.py
pip/_vendor/html5lib/filters/lint.py
pip/_vendor/html5lib/filters/optionaltags.py
pip/_vendor/html5lib/filters/sanitizer.py
pip/_vendor/html5lib/filters/whitespace.py
pip/_vendor/html5lib/serializer/__init__.py
pip/_vendor/html5lib/serializer/htmlserializer.py
pip/_vendor/html5lib/treebuilders/__init__.py
pip/_vendor/html5lib/treebuilders/_base.py
pip/_vendor/html5lib/treebuilders/dom.py
pip/_vendor/html5lib/treebuilders/etree.py
pip/_vendor/html5lib/treebuilders/etree_lxml.py
pip/_vendor/html5lib/treewalkers/__init__.py
pip/_vendor/html5lib/treewalkers/_base.py
pip/_vendor/html5lib/treewalkers/dom.py
pip/_vendor/html5lib/treewalkers/etree.py
pip/_vendor/html5lib/treewalkers/genshistream.py
pip/_vendor/html5lib/treewalkers/lxmletree.py
pip/_vendor/html5lib/treewalkers/pulldom.py
pip/_vendor/html5lib/trie/__init__.py
pip/_vendor/html5lib/trie/_base.py
pip/_vendor/html5lib/trie/datrie.py
pip/_vendor/html5lib/trie/py.py
pip/_vendor/requests/__init__.py
pip/_vendor/requests/adapters.py
pip/_vendor/requests/api.py
pip/_vendor/requests/auth.py
pip/_vendor/requests/cacert.pem
pip/_vendor/requests/certs.py
pip/_vendor/requests/compat.py
pip/_vendor/requests/cookies.py
pip/_vendor/requests/exceptions.py
pip/_vendor/requests/hooks.py
pip/_vendor/requests/models.py
pip/_vendor/requests/sessions.py
pip/_vendor/requests/status_codes.py
pip/_vendor/requests/structures.py
pip/_vendor/requests/utils.py
pip/_vendor/requests/packages/__init__.py
pip/_vendor/requests/packages/charade/__init__.py
pip/_vendor/requests/packages/charade/__main__.py
pip/_vendor/requests/packages/charade/big5freq.py
pip/_vendor/requests/packages/charade/big5prober.py
pip/_vendor/requests/packages/charade/chardistribution.py
pip/_vendor/requests/packages/charade/charsetgroupprober.py
pip/_vendor/requests/packages/charade/charsetprober.py
pip/_vendor/requests/packages/charade/codingstatemachine.py
pip/_vendor/requests/packages/charade/compat.py
pip/_vendor/requests/packages/charade/constants.py
pip/_vendor/requests/packages/charade/cp949prober.py
pip/_vendor/requests/packages/charade/escprober.py
pip/_vendor/requests/packages/charade/escsm.py
pip/_vendor/requests/packages/charade/eucjpprober.py
pip/_vendor/requests/packages/charade/euckrfreq.py
pip/_vendor/requests/packages/charade/euckrprober.py
pip/_vendor/requests/packages/charade/euctwfreq.py
pip/_vendor/requests/packages/charade/euctwprober.py
pip/_vendor/requests/packages/charade/gb2312freq.py
pip/_vendor/requests/packages/charade/gb2312prober.py
pip/_vendor/requests/packages/charade/hebrewprober.py
pip/_vendor/requests/packages/charade/jisfreq.py
pip/_vendor/requests/packages/charade/jpcntx.py
pip/_vendor/requests/packages/charade/langbulgarianmodel.py
pip/_vendor/requests/packages/charade/langcyrillicmodel.py
pip/_vendor/requests/packages/charade/langgreekmodel.py
pip/_vendor/requests/packages/charade/langhebrewmodel.py
pip/_vendor/requests/packages/charade/langhungarianmodel.py
pip/_vendor/requests/packages/charade/langthaimodel.py
pip/_vendor/requests/packages/charade/latin1prober.py
pip/_vendor/requests/packages/charade/mbcharsetprober.py
pip/_vendor/requests/packages/charade/mbcsgroupprober.py
pip/_vendor/requests/packages/charade/mbcssm.py
pip/_vendor/requests/packages/charade/sbcharsetprober.py
pip/_vendor/requests/packages/charade/sbcsgroupprober.py
pip/_vendor/requests/packages/charade/sjisprober.py
pip/_vendor/requests/packages/charade/universaldetector.py
pip/_vendor/requests/packages/charade/utf8prober.py
pip/_vendor/requests/packages/chardet/__init__.py
pip/_vendor/requests/packages/chardet/big5freq.py
pip/_vendor/requests/packages/chardet/big5prober.py
pip/_vendor/requests/packages/chardet/chardetect.py
pip/_vendor/requests/packages/chardet/chardistribution.py
pip/_vendor/requests/packages/chardet/charsetgroupprober.py
pip/_vendor/requests/packages/chardet/charsetprober.py
pip/_vendor/requests/packages/chardet/codingstatemachine.py
pip/_vendor/requests/packages/chardet/compat.py
pip/_vendor/requests/packages/chardet/constants.py
pip/_vendor/requests/packages/chardet/cp949prober.py
pip/_vendor/requests/packages/chardet/escprober.py
pip/_vendor/requests/packages/chardet/escsm.py
pip/_vendor/requests/packages/chardet/eucjpprober.py
pip/_vendor/requests/packages/chardet/euckrfreq.py
pip/_vendor/requests/packages/chardet/euckrprober.py
pip/_vendor/requests/packages/chardet/euctwfreq.py
pip/_vendor/requests/packages/chardet/euctwprober.py
pip/_vendor/requests/packages/chardet/gb2312freq.py
pip/_vendor/requests/packages/chardet/gb2312prober.py
pip/_vendor/requests/packages/chardet/hebrewprober.py
pip/_vendor/requests/packages/chardet/jisfreq.py
pip/_vendor/requests/packages/chardet/jpcntx.py
pip/_vendor/requests/packages/chardet/langbulgarianmodel.py
pip/_vendor/requests/packages/chardet/langcyrillicmodel.py
pip/_vendor/requests/packages/chardet/langgreekmodel.py
pip/_vendor/requests/packages/chardet/langhebrewmodel.py
pip/_vendor/requests/packages/chardet/langhungarianmodel.py
pip/_vendor/requests/packages/chardet/langthaimodel.py
pip/_vendor/requests/packages/chardet/latin1prober.py
pip/_vendor/requests/packages/chardet/mbcharsetprober.py
pip/_vendor/requests/packages/chardet/mbcsgroupprober.py
pip/_vendor/requests/packages/chardet/mbcssm.py
pip/_vendor/requests/packages/chardet/sbcharsetprober.py
pip/_vendor/requests/packages/chardet/sbcsgroupprober.py
pip/_vendor/requests/packages/chardet/sjisprober.py
pip/_vendor/requests/packages/chardet/universaldetector.py
pip/_vendor/requests/packages/chardet/utf8prober.py
pip/_vendor/requests/packages/urllib3/__init__.py
pip/_vendor/requests/packages/urllib3/_collections.py
pip/_vendor/requests/packages/urllib3/connection.py
pip/_vendor/requests/packages/urllib3/connectionpool.py
pip/_vendor/requests/packages/urllib3/exceptions.py
pip/_vendor/requests/packages/urllib3/fields.py
pip/_vendor/requests/packages/urllib3/filepost.py
pip/_vendor/requests/packages/urllib3/poolmanager.py
pip/_vendor/requests/packages/urllib3/request.py
pip/_vendor/requests/packages/urllib3/response.py
pip/_vendor/requests/packages/urllib3/util.py
pip/_vendor/requests/packages/urllib3/contrib/__init__.py
pip/_vendor/requests/packages/urllib3/contrib/ntlmpool.py
pip/_vendor/requests/packages/urllib3/contrib/pyopenssl.py
pip/_vendor/requests/packages/urllib3/packages/__init__.py
pip/_vendor/requests/packages/urllib3/packages/ordered_dict.py
pip/_vendor/requests/packages/urllib3/packages/six.py
pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/__init__.py
pip/_vendor/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py
pip/backwardcompat/__init__.py
pip/commands/__init__.py
pip/commands/bundle.py
pip/commands/completion.py
pip/commands/freeze.py
pip/commands/help.py
pip/commands/install.py
pip/commands/list.py
pip/commands/search.py
pip/commands/show.py
pip/commands/uninstall.py
pip/commands/unzip.py
pip/commands/wheel.py
pip/commands/zip.py
pip/vcs/__init__.py
pip/vcs/bazaar.py
pip/vcs/git.py
pip/vcs/mercurial.py
pip/vcs/subversion.py
+5
View File
@@ -0,0 +1,5 @@
[console_scripts]
pip = pip:main
pip2.7 = pip:main
pip2 = pip:main
+1
View File
@@ -0,0 +1 @@
+7
View File
@@ -0,0 +1,7 @@
[testing]
pytest
virtualenv>=1.10
scripttest>=1.3
mock
+1
View File
@@ -0,0 +1 @@
pip
@@ -9,12 +9,17 @@ from pip.exceptions import InstallationError, CommandError, PipError
from pip.log import logger from pip.log import logger
from pip.util import get_installed_distributions, get_prog from pip.util import get_installed_distributions, get_prog
from pip.vcs import git, mercurial, subversion, bazaar # noqa from pip.vcs import git, mercurial, subversion, bazaar # noqa
from pip.baseparser import create_main_parser from pip.baseparser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip.commands import commands, get_similar_commands, get_summaries from pip.commands import commands, get_summaries, get_similar_commands
# This fixes a peculiarity when importing via __import__ - as we are
# initialising the pip module, "from pip import cmdoptions" is recursive
# and appears not to work properly in that situation.
import pip.cmdoptions
cmdoptions = pip.cmdoptions
# The version as used in the setup.py and the docs conf.py # The version as used in the setup.py and the docs conf.py
__version__ = "1.3.1" __version__ = "1.5.4"
def autocomplete(): def autocomplete():
@@ -60,7 +65,7 @@ def autocomplete():
print(dist) print(dist)
sys.exit(1) sys.exit(1)
subcommand = commands[subcommand_name](parser) subcommand = commands[subcommand_name]()
options += [(opt.get_opt_string(), opt.nargs) options += [(opt.get_opt_string(), opt.nargs)
for opt in subcommand.parser.option_list_all for opt in subcommand.parser.option_list_all
if opt.help != optparse.SUPPRESS_HELP] if opt.help != optparse.SUPPRESS_HELP]
@@ -90,45 +95,76 @@ def autocomplete():
sys.exit(1) sys.exit(1)
def parseopts(args): def create_main_parser():
parser = create_main_parser() parser_kw = {
'usage': '\n%prog <command> [options]',
'add_help_option': False,
'formatter': UpdatingDefaultsHelpFormatter(),
'name': 'global',
'prog': get_prog(),
}
parser = ConfigOptionParser(**parser_kw)
parser.disable_interspersed_args()
pip_pkg_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
parser.version = 'pip %s from %s (python %s)' % (
__version__, pip_pkg_dir, sys.version[:3])
# add the general options
gen_opts = cmdoptions.make_option_group(cmdoptions.general_group, parser)
parser.add_option_group(gen_opts)
parser.main = True # so the help formatter knows parser.main = True # so the help formatter knows
# create command listing # create command listing for description
command_summaries = get_summaries() command_summaries = get_summaries()
description = [''] + ['%-27s %s' % (i, j) for i, j in command_summaries] description = [''] + ['%-27s %s' % (i, j) for i, j in command_summaries]
parser.description = '\n'.join(description) parser.description = '\n'.join(description)
options, args = parser.parse_args(args) return parser
if options.version:
def parseopts(args):
parser = create_main_parser()
# Note: parser calls disable_interspersed_args(), so the result of this call
# is to split the initial args into the general options before the
# subcommand and everything else.
# For example:
# args: ['--timeout=5', 'install', '--user', 'INITools']
# general_options: ['--timeout==5']
# args_else: ['install', '--user', 'INITools']
general_options, args_else = parser.parse_args(args)
# --version
if general_options.version:
sys.stdout.write(parser.version) sys.stdout.write(parser.version)
sys.stdout.write(os.linesep) sys.stdout.write(os.linesep)
sys.exit() sys.exit()
# pip || pip help || pip --help -> print_help() # pip || pip help -> print_help()
if not args or (args[0] == 'help' and len(args) == 1): if not args_else or (args_else[0] == 'help' and len(args_else) == 1):
parser.print_help() parser.print_help()
sys.exit() sys.exit()
if not args: # the subcommand name
msg = ('You must give a command ' cmd_name = args_else[0].lower()
'(use "pip --help" to see a list of commands)')
raise CommandError(msg)
command = args[0].lower() #all the args without the subcommand
cmd_args = args[:]
cmd_args.remove(args_else[0].lower())
if command not in commands: if cmd_name not in commands:
guess = get_similar_commands(command) guess = get_similar_commands(cmd_name)
msg = ['unknown command "%s"' % command] msg = ['unknown command "%s"' % cmd_name]
if guess: if guess:
msg.append('maybe you meant "%s"' % guess) msg.append('maybe you meant "%s"' % guess)
raise CommandError(' - '.join(msg)) raise CommandError(' - '.join(msg))
return command, options, args, parser return cmd_name, cmd_args
def main(initial_args=None): def main(initial_args=None):
@@ -138,22 +174,27 @@ def main(initial_args=None):
autocomplete() autocomplete()
try: try:
cmd_name, options, args, parser = parseopts(initial_args) cmd_name, cmd_args = parseopts(initial_args)
except PipError: except PipError:
e = sys.exc_info()[1] e = sys.exc_info()[1]
sys.stderr.write("ERROR: %s" % e) sys.stderr.write("ERROR: %s" % e)
sys.stderr.write(os.linesep) sys.stderr.write(os.linesep)
sys.exit(1) sys.exit(1)
command = commands[cmd_name](parser) # see baseparser.Command command = commands[cmd_name]()
return command.main(args[1:], options) return command.main(cmd_args)
def bootstrap(): def bootstrap():
""" """
Bootstrapping function to be called from install-pip.py script. Bootstrapping function to be called from install-pip.py script.
""" """
return main(['install', '--upgrade', 'pip']) pkgs = ['pip']
try:
import setuptools
except ImportError:
pkgs.append('setuptools')
return main(['install', '--upgrade'] + pkgs + sys.argv[1:])
############################################################ ############################################################
## Writing freeze files ## Writing freeze files
+8
View File
@@ -0,0 +1,8 @@
"""
pip._vendor is for vendoring dependencies of pip to prevent needing pip to
depend on something external.
Files inside of pip._vendor should be considered immutable and should only be
updated to versions from upstream.
"""
from __future__ import absolute_import
+16
View File
@@ -0,0 +1,16 @@
try:
import ast
from pip._vendor._markerlib.markers import default_environment, compile, interpret
except ImportError:
if 'ast' in globals():
raise
def default_environment():
return {}
def compile(marker):
def marker_fn(environment=None, override=None):
# 'empty markers are True' heuristic won't install extra deps.
return not marker.strip()
marker_fn.__doc__ = marker
return marker_fn
def interpret(marker, environment=None, override=None):
return compile(marker)()
@@ -49,6 +49,10 @@ _VARS = {'sys.platform': sys.platform,
'extra': None # wheel extension 'extra': None # wheel extension
} }
for var in list(_VARS.keys()):
if '.' in var:
_VARS[var.replace('.', '_')] = _VARS[var]
def default_environment(): def default_environment():
"""Return copy of default PEP 385 globals dictionary.""" """Return copy of default PEP 385 globals dictionary."""
return dict(_VARS) return dict(_VARS)
+7
View File
@@ -0,0 +1,7 @@
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from .initialise import init, deinit, reinit
from .ansi import Fore, Back, Style
from .ansitowin32 import AnsiToWin32
VERSION = '0.2.7'

Some files were not shown because too many files have changed in this diff Show More