Expand ~ in the wheel cache directory

This commit is contained in:
Donald Stufft 2015-06-01 17:24:11 -04:00
parent 70c200be7e
commit 0ebc37d17a
3 changed files with 12 additions and 1 deletions

View File

@ -10,6 +10,9 @@
options interleaved with requirements, version specifiers etc in
``requirements`` files. (:pull:`2841`)
* Expand ``~`` in the cache directory when caching wheels, fixes :issue:`2816`.
**7.0.1 (2015-05-22)**
* Don't build and cache wheels for non-editable installations from VCSs.

View File

@ -10,6 +10,7 @@ import functools
import hashlib
import logging
import os
import os.path
import re
import shutil
import stat
@ -54,7 +55,7 @@ class WheelCache(object):
:param format_control: A pip.index.FormatControl object to limit
binaries being read from the cache.
"""
self._cache_dir = cache_dir
self._cache_dir = os.path.expanduser(cache_dir)
self._format_control = format_control
def cached_wheel(self, link, package_name):

View File

@ -390,3 +390,10 @@ class TestWheelBuilder(object):
wb.build()
assert "due to being editable" in caplog.text()
assert mock_build_one.mock_calls == []
class TestWheelCache:
def test_expands_path(self):
wc = wheel.WheelCache("~/.foo/", None)
assert wc._cache_dir == os.path.expanduser("~/.foo/")