pypa/pip — Issue #461: --target_dir assumes unix_home INSTALL_SCHEME
Author: wickman
Created: 2012-02-26 23:31:32+00:00
State: open

Tried a pylint install using PyPy and --target_dir:

$ PYTHONPATH=/tmp/distribute-0.6.24/dist/distribute-0.6.24-py2.6.egg:/tmp/pip-1.1/dist/pip-1.1-py2.6.egg ~/Hacking/pypy-1.6/bin/pypy -m pip.runner install -b build.XXXXXX --download-cache=/tmp/download.cache -v -t /tmp/pylint-pypy -I pylint

But it fails at the very, very end in the target_dir processing:

Successfully installed pylint logilab-common logilab-astng
Cleaning up...
Exception:
Traceback (most recent call last):
File "/tmp/pip-1.1/dist/pip-1.1-py2.6.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/tmp/pip-1.1/dist/pip-1.1-py2.6.egg/pip/commands/install.py", line 270, in run
for item in os.listdir(lib_dir):
OSError: [Errno 2] No such file or directory: '/var/folders/Uh/UhXpeRIeFfGF7HoogOKC+++++TI/-Tmp-/tmpmx40z7/lib/python/'

The packages were actually installed in `/var/folders/Uh/UhXpeRIeFfGF7HoogOKC+++++TI/-Tmp-/tmpmx40z7/site-packages`

If you look in distutils, the pypy install scheme is different:

>>>> from distutils.command.install import INSTALL_SCHEMES
>>>> import pprint
>>>> pprint.pprint(INSTALL_SCHEMES['pypy'])
{'data': '$base',
'headers': '$base/include',
'platlib': '$base/site-packages',
'purelib': '$base/site-packages',
'scripts': '$base/bin'}

Whereas the lib_dir is hardcoded against 'lib/python/' (the 'unix_home' install scheme) when using --target_dir:

> lib_dir = os.path.join(temp_target_dir, "lib/python/")
> for item in os.listdir(lib_dir):
> shutil.move(
> os.path.join(lib_dir, item),
> os.path.join(options.target_dir, item)
> )