From baa49969fd9d562f4819e57e7312d87082d2c1df Mon Sep 17 00:00:00 2001 From: Simon Cross Date: Thu, 15 Apr 2010 15:27:00 +0200 Subject: Add search for source folders if not downloading files (--no-download tests should now pass). --- pip/commands/install.py | 2 ++ pip/req.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/pip/commands/install.py b/pip/commands/install.py index 104f6cda0..7e688edcf 100644 --- a/pip/commands/install.py +++ b/pip/commands/install.py @@ -159,6 +159,8 @@ class InstallCommand(Command): requirement_set.add_requirement(req) if not options.no_download: requirement_set.install_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) + else: + requirement_set.locate_files() if not options.no_install and not self.bundle: requirement_set.install(install_options) installed = ' '.join([req.name for req in diff --git a/pip/req.py b/pip/req.py index 6536d903d..fd591d846 100644 --- a/pip/req.py +++ b/pip/req.py @@ -769,6 +769,34 @@ class RequirementSet(object): req.uninstall(auto_confirm=auto_confirm) req.commit_uninstall() + def locate_files(self): + unnamed = list(self.unnamed_requirements) + reqs = self.requirements.values() + while reqs or unnamed: + if unnamed: + req_to_install = unnamed.pop(0) + else: + req_to_install = reqs.pop(0) + install_needed = True + if not self.ignore_installed and not req_to_install.editable: + req_to_install.check_if_exists() + if req_to_install.satisfied_by: + if self.upgrade: + req_to_install.conflicts_with = req_to_install.satisfied_by + req_to_install.satisfied_by = None + else: + install_needed = False + if req_to_install.satisfied_by: + logger.notify('Requirement already satisfied ' + '(use --upgrade to upgrade): %s' + % req_to_install) + + if req_to_install.editable: + if req_to_install.source_dir is None: + req_to_install.source_dir = req_to_install.build_location(self.src_dir) + elif install_needed: + req_to_install.source_dir = req_to_install.build_location(self.build_dir, not self.is_download) + def install_files(self, finder, force_root_egg_info=False, bundle=False): unnamed = list(self.unnamed_requirements) reqs = self.requirements.values() -- cgit v1.2.1