paylogic / pip-accel

pip-accel: Accelerator for pip, the Python package manager
https://pypi.python.org/pypi/pip-accel
MIT License
308 stars 35 forks source link

Binary cache doesn't take Python version into account #8

Closed xolox closed 11 years ago

xolox commented 11 years ago

A colleague of mine pointed out that when switching Python versions, pip-accel blindly installs cached binary distributions. Instead, the Python version should be included in the filenames used inside the binary cache. Should be an easy fix, but there are several other variables to consider...

xolox commented 11 years ago

This should now be fixed! The filenames in the binary distribution cache now contain the Python version:

$ ls -l ~/.pip-accel/binaries
-rw-rw-r-- 1 peter peter 5.9K Jun  6 23:39 coloredlogs:0.3:py2.7.tar.gz
-rw-rw-r-- 1 peter peter  19K Jun  6 23:39 pip-accel:0.8.8:py2.7.tar.gz
-rw-rw-r-- 1 peter peter 312K Jun  6 23:39 pip:1.3.1:py2.7.tar.gz
-rw-rw-r-- 1 peter peter 3.3K Jun  6 23:40 verboselogs:1.0:py2.7.tar.gz
ghost commented 11 years ago

Thank you for fixing this. Do we need to remove the ~/.pip-accel folder? Because now I'm getting this error:

Traceback (most recent call last): File "(...)/.env/bin/pip-accel", line 9, in load_entry_point('pip-accel==0.8.9', 'console_scripts', 'pip-accel')() File "(...)/.env/lib/python2.6/site-packages/pip_accel/init.py", line 128, in main if build_binary_dists(requirements) and install_requirements(requirements): File "(...)/.env/lib/python2.6/site-packages/pip_accel/init.py", line 262, in build_binary_dists pyversion = get_python_version() File "(...)/.env/lib/python2.6/site-packages/pip_accel/init.py", line 501, in get_python_version return "py%i.%i" % (sys.version_info.major, sys.version_info.minor) AttributeError: 'tuple' object has no attribute 'major'

xolox commented 11 years ago

Sorry about that Laurence, I broke Python 2.6 compatibility without realizing it. Should be fixed in 0.8.10 which is now available on GitHub and PyPi.

Edit: I just realized I didn't address the actual question... pip-accel keeps a "cache format" version number in the source code and the cache directory. When the version doesn't match, the binary cache is invalidated and re-initialized automatically. This should automatically take care of backwards compatibility so users don't have to think about it. In this case an actual bug in the source code prevented this mechanism from working, but in general pip-accel shouldn't need any "baby sitting".