diff options
-rw-r--r-- | git_command.py | 11 | ||||
-rwxr-xr-x | repo | 9 | ||||
-rw-r--r-- | subcmds/forall.py | 4 | ||||
-rw-r--r-- | subcmds/sync.py | 8 |
4 files changed, 18 insertions, 14 deletions
diff --git a/git_command.py b/git_command.py index 181e3724..513b9ebf 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -112,6 +112,9 @@ def git_require(min_version, fail=False): | |||
112 | sys.exit(1) | 112 | sys.exit(1) |
113 | return False | 113 | return False |
114 | 114 | ||
115 | def _setenv(env, name, value): | ||
116 | env[name] = value.encode() | ||
117 | |||
115 | class GitCommand(object): | 118 | class GitCommand(object): |
116 | def __init__(self, | 119 | def __init__(self, |
117 | project, | 120 | project, |
@@ -137,10 +140,10 @@ class GitCommand(object): | |||
137 | del env[e] | 140 | del env[e] |
138 | 141 | ||
139 | if disable_editor: | 142 | if disable_editor: |
140 | env['GIT_EDITOR'] = ':' | 143 | _setenv(env, 'GIT_EDITOR', ':') |
141 | if ssh_proxy: | 144 | if ssh_proxy: |
142 | env['REPO_SSH_SOCK'] = ssh_sock() | 145 | _setenv(env, 'REPO_SSH_SOCK', ssh_sock()) |
143 | env['GIT_SSH'] = _ssh_proxy() | 146 | _setenv(env, 'GIT_SSH', _ssh_proxy()) |
144 | 147 | ||
145 | if project: | 148 | if project: |
146 | if not cwd: | 149 | if not cwd: |
@@ -151,7 +154,7 @@ class GitCommand(object): | |||
151 | command = [GIT] | 154 | command = [GIT] |
152 | if bare: | 155 | if bare: |
153 | if gitdir: | 156 | if gitdir: |
154 | env[GIT_DIR] = gitdir | 157 | _setenv(env, GIT_DIR, gitdir) |
155 | cwd = None | 158 | cwd = None |
156 | command.extend(cmdv) | 159 | command.extend(cmdv) |
157 | 160 | ||
@@ -264,8 +264,8 @@ def _SetupGnuPG(quiet): | |||
264 | gpg_dir, e.strerror) | 264 | gpg_dir, e.strerror) |
265 | sys.exit(1) | 265 | sys.exit(1) |
266 | 266 | ||
267 | env = dict(os.environ) | 267 | env = os.environ.copy() |
268 | env['GNUPGHOME'] = gpg_dir | 268 | env['GNUPGHOME'] = gpg_dir.encode() |
269 | 269 | ||
270 | cmd = ['gpg', '--import'] | 270 | cmd = ['gpg', '--import'] |
271 | try: | 271 | try: |
@@ -383,8 +383,8 @@ def _Verify(cwd, branch, quiet): | |||
383 | % (branch, cur) | 383 | % (branch, cur) |
384 | print >>sys.stderr | 384 | print >>sys.stderr |
385 | 385 | ||
386 | env = dict(os.environ) | 386 | env = os.environ.copy() |
387 | env['GNUPGHOME'] = gpg_dir | 387 | env['GNUPGHOME'] = gpg_dir.encode() |
388 | 388 | ||
389 | cmd = [GIT, 'tag', '-v', cur] | 389 | cmd = [GIT, 'tag', '-v', cur] |
390 | proc = subprocess.Popen(cmd, | 390 | proc = subprocess.Popen(cmd, |
@@ -488,6 +488,7 @@ def _Help(args): | |||
488 | if args: | 488 | if args: |
489 | if args[0] == 'init': | 489 | if args[0] == 'init': |
490 | init_optparse.print_help() | 490 | init_optparse.print_help() |
491 | sys.exit(0) | ||
491 | else: | 492 | else: |
492 | print >>sys.stderr,\ | 493 | print >>sys.stderr,\ |
493 | "error: '%s' is not a bootstrap command.\n"\ | 494 | "error: '%s' is not a bootstrap command.\n"\ |
diff --git a/subcmds/forall.py b/subcmds/forall.py index 6bd867e7..d3e70ae1 100644 --- a/subcmds/forall.py +++ b/subcmds/forall.py | |||
@@ -151,11 +151,11 @@ terminal and are not redirected. | |||
151 | first = True | 151 | first = True |
152 | 152 | ||
153 | for project in self.GetProjects(args): | 153 | for project in self.GetProjects(args): |
154 | env = dict(os.environ.iteritems()) | 154 | env = os.environ.copy() |
155 | def setenv(name, val): | 155 | def setenv(name, val): |
156 | if val is None: | 156 | if val is None: |
157 | val = '' | 157 | val = '' |
158 | env[name] = val | 158 | env[name] = val.encode() |
159 | 159 | ||
160 | setenv('REPO_PROJECT', project.name) | 160 | setenv('REPO_PROJECT', project.name) |
161 | setenv('REPO_PATH', project.relpath) | 161 | setenv('REPO_PATH', project.relpath) |
diff --git a/subcmds/sync.py b/subcmds/sync.py index 7b77388b..16f1d189 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -271,7 +271,7 @@ uncommitted changes are present' % project.relpath | |||
271 | if branch.startswith(R_HEADS): | 271 | if branch.startswith(R_HEADS): |
272 | branch = branch[len(R_HEADS):] | 272 | branch = branch[len(R_HEADS):] |
273 | 273 | ||
274 | env = dict(os.environ) | 274 | env = os.environ.copy() |
275 | if (env.has_key('TARGET_PRODUCT') and | 275 | if (env.has_key('TARGET_PRODUCT') and |
276 | env.has_key('TARGET_BUILD_VARIANT')): | 276 | env.has_key('TARGET_BUILD_VARIANT')): |
277 | target = '%s-%s' % (env['TARGET_PRODUCT'], | 277 | target = '%s-%s' % (env['TARGET_PRODUCT'], |
@@ -428,9 +428,9 @@ warning: Cannot automatically authenticate repo.""" | |||
428 | % (project.name, rev) | 428 | % (project.name, rev) |
429 | return False | 429 | return False |
430 | 430 | ||
431 | env = dict(os.environ) | 431 | env = os.environ.copy() |
432 | env['GIT_DIR'] = project.gitdir | 432 | env['GIT_DIR'] = project.gitdir.encode() |
433 | env['GNUPGHOME'] = gpg_dir | 433 | env['GNUPGHOME'] = gpg_dir.encode() |
434 | 434 | ||
435 | cmd = [GIT, 'tag', '-v', cur] | 435 | cmd = [GIT, 'tag', '-v', cur] |
436 | proc = subprocess.Popen(cmd, | 436 | proc = subprocess.Popen(cmd, |