From 4e264664e2495a9c1f1710efeca2fbf93cd7c8f4 Mon Sep 17 00:00:00 2001 From: lepture Date: Mon, 28 May 2012 23:29:53 +0800 Subject: [PATCH] fix on git repo. if a repo contains submodules, checkout submodules --- AUTHORS.txt | 1 + pip/vcs/git.py | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/AUTHORS.txt b/AUTHORS.txt index 9e4bf3f7a..ef089ab1b 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -51,3 +51,4 @@ Vinay Sajip Vitaly Babiy W Trevor King Wil Tan +Hsiaoming Yang diff --git a/pip/vcs/git.py b/pip/vcs/git.py index 1ff67e4f3..8491d4726 100644 --- a/pip/vcs/git.py +++ b/pip/vcs/git.py @@ -28,8 +28,8 @@ class Git(VersionControl): initial_slashes = path[:-len(path.lstrip('/'))] newpath = initial_slashes + url2pathname(path).replace('\\', '/').lstrip('/') url = urlunsplit((scheme, netloc, newpath, query, fragment)) - after_plus = scheme.find('+')+1 - url = scheme[:after_plus]+ urlunsplit((scheme[after_plus:], netloc, newpath, query, fragment)) + after_plus = scheme.find('+') + 1 + url = scheme[:after_plus] + urlunsplit((scheme[after_plus:], netloc, newpath, query, fragment)) super(Git, self).__init__(url, *args, **kwargs) @@ -105,6 +105,9 @@ class Git(VersionControl): if self.check_destination(dest, url, rev_options, rev_display): logger.notify('Cloning %s%s to %s' % (url, rev_display, display_path(dest))) call_subprocess([self.cmd, 'clone', '-q', url, dest]) + #: repo may contain submodules + call_subprocess([self.cmd, 'submodule', 'init'], cwd=dest) + call_subprocess([self.cmd, 'submodule', 'update'], cwd=dest) if rev: rev_options = self.check_rev_options(rev, dest, rev_options) # Only do a checkout if rev_options differs from HEAD @@ -161,8 +164,10 @@ class Git(VersionControl): elif (current_rev in branch_revs and branch_revs[current_rev] != 'origin/master'): # It's the head of a branch - full_egg_name = '%s-%s' % (egg_project_name, - branch_revs[current_rev].replace('origin/', '')) + full_egg_name = '%s-%s' % ( + egg_project_name, + branch_revs[current_rev].replace('origin/', '') + ) else: full_egg_name = '%s-dev' % egg_project_name -- GitLab