Skip to content

Commit

Permalink
check that wheel cache dir is writable
Browse files Browse the repository at this point in the history
before building wheels. Warning is copied from http cache check.

HTTP cache has a similar check and warning,
but wheels would still try and fail to build.
  • Loading branch information
minrk committed Jul 2, 2015
1 parent 537369c commit aa0099a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pip/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from pip.utils import ensure_dir
from pip.utils.build import BuildDirectory
from pip.utils.deprecation import RemovedInPip8Warning
from pip.utils.filesystem import check_path_owner
from pip.wheel import WheelCache, WheelBuilder


Expand Down Expand Up @@ -246,6 +247,17 @@ def run(self, options, args):
finder = self._build_package_finder(options, index_urls, session)
build_delete = (not (options.no_clean or options.build_dir))
wheel_cache = WheelCache(options.cache_dir, options.format_control)
if options.cache_dir and not check_path_owner(options.cache_dir):
logger.warning(
"The directory '%s' or its parent directory is not owned "
"by the current user and caching wheels has been "
"disabled. check the permissions and owner of that "
"directory. If executing pip with sudo, you may want "
"sudo's -H flag.",
options.cache_dir,
)
options.cache_dir = None

This comment has been minimized.

Copy link
@xavfernandez

xavfernandez Aug 25, 2015

Member

Why put this check (and None assignment) after passing the options.cache_dir to WheelCache ?
(and not before ?)


with BuildDirectory(options.build_dir,
delete=build_delete) as build_dir:
requirement_set = RequirementSet(
Expand Down
8 changes: 7 additions & 1 deletion pip/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,13 @@ def build(self, autobuilding=False):
for req in buildset:
if autobuilding:
output_dir = _cache_for_link(self._cache_root, req.link)
ensure_dir(output_dir)
try:
ensure_dir(output_dir)
except OSError as e:
logger.warn("Building wheel for %s failed: %s",
req.name, e)
build_failure.append(req)
continue
else:
output_dir = self._wheel_dir
wheel_file = self._build_one(req, output_dir)
Expand Down

0 comments on commit aa0099a

Please sign in to comment.