diff --git a/pip/__init__.py b/pip/__init__.py index c38a31d7c32..99fa932637e 100644 --- a/pip/__init__.py +++ b/pip/__init__.py @@ -51,7 +51,6 @@ InsecureRequestWarning, ) - # assignment for flake8 to be happy # This fixes a peculiarity when importing via __import__ - as we are diff --git a/pip/basecommand.py b/pip/basecommand.py index c1cc308af3f..3692e7caac4 100644 --- a/pip/basecommand.py +++ b/pip/basecommand.py @@ -249,6 +249,7 @@ def main(self, args): ) with session: pip_version_check(session, options) + # Avoid leaking loggers for handler in set(logging.root.handlers) - original_root_handlers: # this method benefit from the Logger class internal lock @@ -270,8 +271,8 @@ def populate_requirement_set(requirement_set, args, options, finder, for filename in options.constraints: parsed_constraints = parse_requirements( - filename, - constraint=True, finder=finder, options=options, + filename, + constraint=True, finder=finder, options=options, session=session, wheel_cache=wheel_cache ) for req in parsed_constraints: diff --git a/pip/baseparser.py b/pip/baseparser.py index ea76a21afeb..93864b60fbb 100644 --- a/pip/baseparser.py +++ b/pip/baseparser.py @@ -203,6 +203,7 @@ def _update_defaults(self, defaults): late_eval.add(option.dest) opt_str = option.get_opt_string() val = option.convert_value(opt_str, val) + # From take_action args = option.callback_args or () kwargs = option.callback_kwargs or {} @@ -214,6 +215,7 @@ def _update_defaults(self, defaults): for key in late_eval: defaults[key] = getattr(self.values, key) + self.values = None return defaults @@ -230,6 +232,7 @@ def get_default_values(self): if isinstance(default, string_types): opt_str = option.get_opt_string() defaults[option.dest] = option.check_value(opt_str, default) + return optparse.Values(defaults) def error(self, msg): diff --git a/pip/commands/show.py b/pip/commands/show.py index c3c957c4f27..ff5e4a104d8 100644 --- a/pip/commands/show.py +++ b/pip/commands/show.py @@ -165,4 +165,5 @@ def print_results(distributions, list_files=False, verbose=False): logger.info(" %s", line.strip()) if "files" not in dist: logger.info("Cannot locate installed-files.txt") + return results_printed diff --git a/pip/commands/uninstall.py b/pip/commands/uninstall.py index a2654cedca1..3b3e31e0f2d 100644 --- a/pip/commands/uninstall.py +++ b/pip/commands/uninstall.py @@ -61,11 +61,13 @@ def run(self, options, args): for req in parsed_reqs: if req.name: reqs_to_uninstall[canonicalize_name(req.name)] = req + if not reqs_to_uninstall: raise InstallationError( 'You must give at least one requirement to %(name)s (see ' '"pip help %(name)s")' % dict(name=self.name) ) + for req in reqs_to_uninstall.values(): verbose = options.verbose != 0 req.uninstall(auto_confirm=options.yes, verbose=verbose) diff --git a/pip/operations/prepare.py b/pip/operations/prepare.py index 2dea4b14dcb..2481db3f21e 100644 --- a/pip/operations/prepare.py +++ b/pip/operations/prepare.py @@ -189,12 +189,12 @@ def _prepare_linked_requirement(self, req, resolver): # occurs when the script attempts to unpack the # build directory req.ensure_has_source_dir(self.build_dir) + # If a checkout exists, it's unwise to keep going. version # inconsistencies are logged later, but do not fail the # installation. # FIXME: this won't upgrade when there's an existing # package unpacked in `req.source_dir` - # package unpacked in `req.source_dir` if os.path.exists(os.path.join(req.source_dir, 'setup.py')): raise PreviousBuildDirError( "pip can't proceed with requirements '%s' due to a"