From f18cb761731a791bf1b9ee8c6308bfce5c9d3e62 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 7 Dec 2010 11:41:05 -0800 Subject: Encode the environment variables passed to git Windows allows the environment to have unicode values. This will cause Python to fail to execute the command. Change-Id: I37d922c3d7ced0d5b4883f0220346ac42defc5e9 Signed-off-by: Shawn O. Pearce --- subcmds/forall.py | 4 ++-- subcmds/sync.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'subcmds') 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. first = True for project in self.GetProjects(args): - env = dict(os.environ.iteritems()) + env = os.environ.copy() def setenv(name, val): if val is None: val = '' - env[name] = val + env[name] = val.encode() setenv('REPO_PROJECT', project.name) 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 if branch.startswith(R_HEADS): branch = branch[len(R_HEADS):] - env = dict(os.environ) + env = os.environ.copy() if (env.has_key('TARGET_PRODUCT') and env.has_key('TARGET_BUILD_VARIANT')): target = '%s-%s' % (env['TARGET_PRODUCT'], @@ -413,9 +413,9 @@ warning: Cannot automatically authenticate repo.""" % (project.name, rev) return False - env = dict(os.environ) - env['GIT_DIR'] = project.gitdir - env['GNUPGHOME'] = gpg_dir + env = os.environ.copy() + env['GIT_DIR'] = project.gitdir.encode() + env['GNUPGHOME'] = gpg_dir.encode() cmd = [GIT, 'tag', '-v', cur] proc = subprocess.Popen(cmd, -- cgit v1.2.3-54-g00ecf