diff options
-rw-r--r-- | error.py | 4 | ||||
-rw-r--r-- | git_command.py | 7 | ||||
-rw-r--r-- | git_config.py | 2 | ||||
-rw-r--r-- | subcmds/forall.py | 4 | ||||
-rw-r--r-- | subcmds/init.py | 4 |
5 files changed, 14 insertions, 7 deletions
@@ -80,7 +80,7 @@ class NoSuchProjectError(Exception): | |||
80 | self.name = name | 80 | self.name = name |
81 | 81 | ||
82 | def __str__(self): | 82 | def __str__(self): |
83 | if self.Name is None: | 83 | if self.name is None: |
84 | return 'in current directory' | 84 | return 'in current directory' |
85 | return self.name | 85 | return self.name |
86 | 86 | ||
@@ -93,7 +93,7 @@ class InvalidProjectGroupsError(Exception): | |||
93 | self.name = name | 93 | self.name = name |
94 | 94 | ||
95 | def __str__(self): | 95 | def __str__(self): |
96 | if self.Name is None: | 96 | if self.name is None: |
97 | return 'in current directory' | 97 | return 'in current directory' |
98 | return self.name | 98 | return self.name |
99 | 99 | ||
diff --git a/git_command.py b/git_command.py index 259fb02c..0893bff7 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -92,7 +92,10 @@ class _GitCall(object): | |||
92 | def version(self): | 92 | def version(self): |
93 | p = GitCommand(None, ['--version'], capture_stdout=True) | 93 | p = GitCommand(None, ['--version'], capture_stdout=True) |
94 | if p.Wait() == 0: | 94 | if p.Wait() == 0: |
95 | return p.stdout.decode('utf-8') | 95 | if hasattr(p.stdout, 'decode'): |
96 | return p.stdout.decode('utf-8') | ||
97 | else: | ||
98 | return p.stdout | ||
96 | return None | 99 | return None |
97 | 100 | ||
98 | def version_tuple(self): | 101 | def version_tuple(self): |
@@ -263,6 +266,8 @@ class GitCommand(object): | |||
263 | if not buf: | 266 | if not buf: |
264 | s_in.remove(s) | 267 | s_in.remove(s) |
265 | continue | 268 | continue |
269 | if not hasattr(buf, 'encode'): | ||
270 | buf = buf.decode() | ||
266 | if s.std_name == 'stdout': | 271 | if s.std_name == 'stdout': |
267 | self.stdout += buf | 272 | self.stdout += buf |
268 | else: | 273 | else: |
diff --git a/git_config.py b/git_config.py index c4c31e18..8ded7c25 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -280,7 +280,7 @@ class GitConfig(object): | |||
280 | finally: | 280 | finally: |
281 | fd.close() | 281 | fd.close() |
282 | except (IOError, TypeError): | 282 | except (IOError, TypeError): |
283 | if os.path.exists(self.json): | 283 | if os.path.exists(self._json): |
284 | os.remove(self._json) | 284 | os.remove(self._json) |
285 | 285 | ||
286 | def _ReadGit(self): | 286 | def _ReadGit(self): |
diff --git a/subcmds/forall.py b/subcmds/forall.py index 6a6d30c9..ebc8beca 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
@@ -278,7 +278,9 @@ def DoWork(project, mirror, opt, cmd, shell, cnt, config): | |||
278 | def setenv(name, val): | 278 | def setenv(name, val): |
279 | if val is None: | 279 | if val is None: |
280 | val = '' | 280 | val = '' |
281 | env[name] = val.encode() | 281 | if hasattr(val, 'encode'): |
282 | val = val.encode() | ||
283 | env[name] = val | ||
282 | 284 | ||
283 | setenv('REPO_PROJECT', project['name']) | 285 | setenv('REPO_PROJECT', project['name']) |
284 | setenv('REPO_PATH', project['relpath']) | 286 | setenv('REPO_PATH', project['relpath']) |
diff --git a/subcmds/init.py b/subcmds/init.py index b73de71c..dbb6ddda 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -27,7 +27,7 @@ else: | |||
27 | import imp | 27 | import imp |
28 | import urlparse | 28 | import urlparse |
29 | urllib = imp.new_module('urllib') | 29 | urllib = imp.new_module('urllib') |
30 | urllib.parse = urlparse.urlparse | 30 | urllib.parse = urlparse |
31 | 31 | ||
32 | from color import Coloring | 32 | from color import Coloring |
33 | from command import InteractiveCommand, MirrorSafeCommand | 33 | from command import InteractiveCommand, MirrorSafeCommand |
@@ -153,7 +153,7 @@ to update the working directory files. | |||
153 | # server where this git is located, so let's save that here. | 153 | # server where this git is located, so let's save that here. |
154 | mirrored_manifest_git = None | 154 | mirrored_manifest_git = None |
155 | if opt.reference: | 155 | if opt.reference: |
156 | manifest_git_path = urllib.parse(opt.manifest_url).path[1:] | 156 | manifest_git_path = urllib.parse.urlparse(opt.manifest_url).path[1:] |
157 | mirrored_manifest_git = os.path.join(opt.reference, manifest_git_path) | 157 | mirrored_manifest_git = os.path.join(opt.reference, manifest_git_path) |
158 | if not mirrored_manifest_git.endswith(".git"): | 158 | if not mirrored_manifest_git.endswith(".git"): |
159 | mirrored_manifest_git += ".git" | 159 | mirrored_manifest_git += ".git" |