summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--git_command.py11
-rwxr-xr-xrepo8
-rw-r--r--subcmds/forall.py4
-rw-r--r--subcmds/sync.py8
4 files changed, 17 insertions, 14 deletions
diff --git a/git_command.py b/git_command.py
index 4ad908f6..4aeacd57 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
115def _setenv(env, name, value):
116 env[name] = value.encode()
117
115class GitCommand(object): 118class 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
diff --git a/repo b/repo
index 6f2067ea..02858ec2 100755
--- a/repo
+++ b/repo
@@ -259,8 +259,8 @@ def _SetupGnuPG(quiet):
259 gpg_dir, e.strerror) 259 gpg_dir, e.strerror)
260 sys.exit(1) 260 sys.exit(1)
261 261
262 env = dict(os.environ) 262 env = os.environ.copy()
263 env['GNUPGHOME'] = gpg_dir 263 env['GNUPGHOME'] = gpg_dir.encode()
264 264
265 cmd = ['gpg', '--import'] 265 cmd = ['gpg', '--import']
266 try: 266 try:
@@ -378,8 +378,8 @@ def _Verify(cwd, branch, quiet):
378 % (branch, cur) 378 % (branch, cur)
379 print >>sys.stderr 379 print >>sys.stderr
380 380
381 env = dict(os.environ) 381 env = os.environ.copy()
382 env['GNUPGHOME'] = gpg_dir 382 env['GNUPGHOME'] = gpg_dir.encode()
383 383
384 cmd = [GIT, 'tag', '-v', cur] 384 cmd = [GIT, 'tag', '-v', cur]
385 proc = subprocess.Popen(cmd, 385 proc = subprocess.Popen(cmd,
diff --git a/subcmds/forall.py b/subcmds/forall.py
index b66313d7..8209c806 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 d6ea442a..80bba1aa 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -269,7 +269,7 @@ uncommitted changes are present' % project.relpath
269 if branch.startswith(R_HEADS): 269 if branch.startswith(R_HEADS):
270 branch = branch[len(R_HEADS):] 270 branch = branch[len(R_HEADS):]
271 271
272 env = dict(os.environ) 272 env = os.environ.copy()
273 if (env.has_key('TARGET_PRODUCT') and 273 if (env.has_key('TARGET_PRODUCT') and
274 env.has_key('TARGET_BUILD_VARIANT')): 274 env.has_key('TARGET_BUILD_VARIANT')):
275 target = '%s-%s' % (env['TARGET_PRODUCT'], 275 target = '%s-%s' % (env['TARGET_PRODUCT'],
@@ -413,9 +413,9 @@ warning: Cannot automatically authenticate repo."""
413 % (project.name, rev) 413 % (project.name, rev)
414 return False 414 return False
415 415
416 env = dict(os.environ) 416 env = os.environ.copy()
417 env['GIT_DIR'] = project.gitdir 417 env['GIT_DIR'] = project.gitdir.encode()
418 env['GNUPGHOME'] = gpg_dir 418 env['GNUPGHOME'] = gpg_dir.encode()
419 419
420 cmd = [GIT, 'tag', '-v', cur] 420 cmd = [GIT, 'tag', '-v', cur]
421 proc = subprocess.Popen(cmd, 421 proc = subprocess.Popen(cmd,