pypa/pip — Issue #413: Pip doesn't delete build dir when interrupted with Ctrl-c
Author: brickZA
Created: 2011-12-20 08:38:38+00:00
State: open

Apart from polluting $PWD with the build dir, it will result in the next invocation of pip to install the same package to ignore any version requirements; instead it will just install the version of the package that is in the build dir. E.g.

```
$ sudo pip -v install mplh5canvas==0.5
Downloading/unpacking mplh5canvas==0.5
Could not fetch URL http://pypi.python.org/simple/mplh5canvas/0.5: HTTP Error 404: Not Found
Will skip URL http://pypi.python.org/simple/mplh5canvas/0.5 when looking for download links for mplh5canvas==0.5
Ignoring link http://pypi.python.org/packages/source/m/mplh5canvas/mplh5canvas-0.6.tar.gz#md5=83d9c9d8da784391216b4dbe4813f7e8 (from http://pypi.python.org/simple/mplh5canvas/), version 0.6 doesn't match ==0.5
Downloading mplh5canvas-0.5.tar.gz (59Kb): 59Kb downloaded
Running setup.py egg_info for package mplh5canvas
running egg_info
creating pip-egg-info/mplh5canvas.egg-info
writing pip-egg-info/mplh5canvas.egg-info/PKG-INFO
writing top-level names to pip-egg-info/mplh5canvas.egg-info/top_level.txt
writing dependency_links to pip-egg-info/mplh5canvas.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
warning: manifest_maker: standard file '-c' not found

reading manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
writing manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
Installing collected packages: mplh5canvas
Running setup.py install for mplh5canvas
^COperation cancelled by user
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 228, in run
requirement_set.install(install_options, global_options)
File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 1100, in install
requirement.install(install_options, global_options)
File "/usr/local/lib/python2.7/dist-packages/pip/req.py", line 572, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 230, in call_subprocess
line = console_to_str(stdout.readline())
KeyboardInterrupt

$ ls $PWD/build
mplh5canvas pip-delete-this-directory.txt
```
If we now try an install a different version of the package

```
$ sudo pip -v install mplh5canvas==0.6
Downloading/unpacking mplh5canvas==0.6
Running setup.py egg_info for package mplh5canvas
running egg_info
writing pip-egg-info/mplh5canvas.egg-info/PKG-INFO
writing top-level names to pip-egg-info/mplh5canvas.egg-info/top_level.txt
writing dependency_links to pip-egg-info/mplh5canvas.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
writing manifest file 'pip-egg-info/mplh5canvas.egg-info/SOURCES.txt'
Installing collected packages: mplh5canvas
Running setup.py install for mplh5canvas
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/mplh5canvas
copying mplh5canvas/memorizingfile.py -> build/lib.linux-x86_64-2.7/mplh5canvas
copying mplh5canvas/backend_h5canvas.py -> build/lib.linux-x86_64-2.7/mplh5canvas
copying mplh5canvas/simple_server.py -> build/lib.linux-x86_64-2.7/mplh5canvas
copying mplh5canvas/msgutil.py -> build/lib.linux-x86_64-2.7/mplh5canvas
copying mplh5canvas/base_page.py -> build/lib.linux-x86_64-2.7/mplh5canvas
copying mplh5canvas/management_server.py -> build/lib.linux-x86_64-2.7/mplh5canvas
copying mplh5canvas/__init__.py -> build/lib.linux-x86_64-2.7/mplh5canvas
creating build/lib.linux-x86_64-2.7/mplh5canvas/handshake
copying mplh5canvas/handshake/handshake.py -> build/lib.linux-x86_64-2.7/mplh5canvas/handshake
copying mplh5canvas/handshake/draft75.py -> build/lib.linux-x86_64-2.7/mplh5canvas/handshake
copying mplh5canvas/handshake/_base.py -> build/lib.linux-x86_64-2.7/mplh5canvas/handshake
copying mplh5canvas/handshake/__init__.py -> build/lib.linux-x86_64-2.7/mplh5canvas/handshake
running install_lib
creating /usr/local/lib/python2.7/dist-packages/mplh5canvas
copying build/lib.linux-x86_64-2.7/mplh5canvas/memorizingfile.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
creating /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
copying build/lib.linux-x86_64-2.7/mplh5canvas/handshake/handshake.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
copying build/lib.linux-x86_64-2.7/mplh5canvas/handshake/draft75.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
copying build/lib.linux-x86_64-2.7/mplh5canvas/handshake/_base.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
copying build/lib.linux-x86_64-2.7/mplh5canvas/handshake/__init__.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake
copying build/lib.linux-x86_64-2.7/mplh5canvas/backend_h5canvas.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
copying build/lib.linux-x86_64-2.7/mplh5canvas/simple_server.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
copying build/lib.linux-x86_64-2.7/mplh5canvas/msgutil.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
copying build/lib.linux-x86_64-2.7/mplh5canvas/base_page.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
copying build/lib.linux-x86_64-2.7/mplh5canvas/management_server.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
copying build/lib.linux-x86_64-2.7/mplh5canvas/__init__.py -> /usr/local/lib/python2.7/dist-packages/mplh5canvas
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/memorizingfile.py to memorizingfile.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake/handshake.py to handshake.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake/draft75.py to draft75.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake/_base.py to _base.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/handshake/__init__.py to __init__.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/backend_h5canvas.py to backend_h5canvas.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/simple_server.py to simple_server.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/msgutil.py to msgutil.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/base_page.py to base_page.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/management_server.py to management_server.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/mplh5canvas/__init__.py to __init__.pyc
running install_egg_info
running egg_info
writing mplh5canvas.egg-info/PKG-INFO
writing top-level names to mplh5canvas.egg-info/top_level.txt
writing dependency_links to mplh5canvas.egg-info/dependency_links.txt
warning: manifest_maker: standard file '-c' not found

reading manifest file 'mplh5canvas.egg-info/SOURCES.txt'
writing manifest file 'mplh5canvas.egg-info/SOURCES.txt'
Copying mplh5canvas.egg-info to /usr/local/lib/python2.7/dist-packages/mplh5canvas-0.5-py2.7.egg-info
running install_scripts
writing list of installed files to '/tmp/pip-QUEhbq-record/install-record.txt'
Successfully installed mplh5canvas
Cleaning up...
Removing temporary dir /home/nmarais/build...
```
if we check the version we see

```
$ yolk -a | grep mplh
mplh5canvas - 0.5 - active development (/usr/local/lib/python2.7/dist-packages)
```
i.e. verion 0.5 was installed, not the requested 0.6. However, the last invocation of pip did actually clean up the build dir, so if we try again

```
$ sudo pip install mplh5canvas==0.6
Downloading/unpacking mplh5canvas==0.6
Downloading mplh5canvas-0.6.tar.gz (57Kb): 57Kb downloaded
Running setup.py egg_info for package mplh5canvas

Requirement already satisfied (use --upgrade to upgrade): mod-pywebsocket in /usr/local/lib/python2.7/dist-packages (from mplh5canvas==0.6)
Installing collected packages: mplh5canvas
Found existing installation: mplh5canvas 0.5
Uninstalling mplh5canvas:
Successfully uninstalled mplh5canvas
Running setup.py install for mplh5canvas

Successfully installed mplh5canvas
Cleaning up...
```

we get the version we are looking for

```
$ yolk -a | grep mplh
mplh5canvas - 0.6 - active development (/usr/local/lib/python2.7/dist-packages)
```