aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Harrison <zoddicus@users.noreply.github.com>2019-05-31 07:51:30 -0700
committerGitHub <noreply@github.com>2019-05-31 07:51:30 -0700
commit7c7f9c6abe008b899506ca3bf34f196dd218ef25 (patch)
treec4d4ce4d7340a4c5330a041a280ee17122d62e3f
parentf8e6fbd4d6ace6280e80e50635a6874690a6a2be (diff)
downloadamber-7c7f9c6abe008b899506ca3bf34f196dd218ef25.tar.gz
Convert git-sync-deps to Python 3 (#533)
Fixes #528
-rw-r--r--kokoro/scripts/windows/build.bat6
-rwxr-xr-xtools/git-sync-deps7
2 files changed, 5 insertions, 8 deletions
diff --git a/kokoro/scripts/windows/build.bat b/kokoro/scripts/windows/build.bat
index 1c5d2ff..3f245f2 100644
--- a/kokoro/scripts/windows/build.bat
+++ b/kokoro/scripts/windows/build.bat
@@ -18,15 +18,11 @@ set BUILD_ROOT=%cd%
set SRC=%cd%\github\amber
set BUILD_TYPE=%1
-set PATH=C:\python27;%PATH%
+set PATH=C:\python36;%PATH%
cd %SRC%
python tools\git-sync-deps
-:: Force usage of python 3.6
-:: Change this after the git-sync-deps as that requires python2 ...
-set PATH=C:\python36;%PATH%
-
:: #########################################
:: set up msvc build env
:: #########################################
diff --git a/tools/git-sync-deps b/tools/git-sync-deps
index 74a0952..4da1217 100755
--- a/tools/git-sync-deps
+++ b/tools/git-sync-deps
@@ -52,6 +52,7 @@ Git Config:
"""
+from builtins import bytes
import os
import subprocess
import sys
@@ -116,7 +117,7 @@ def is_git_toplevel(git, directory):
try:
toplevel = subprocess.check_output(
[git, 'rev-parse', '--show-toplevel'], cwd=directory).strip()
- return os.path.realpath(directory) == os.path.realpath(toplevel)
+ return os.path.realpath(bytes(directory, 'utf8')) == os.path.realpath(toplevel)
except subprocess.CalledProcessError:
return False
@@ -189,7 +190,7 @@ def git_checkout_to_directory(git, repo, checkoutable, directory, verbose):
def parse_file_to_dict(path):
dictionary = {}
- execfile(path, dictionary)
+ exec(compile(open(path).read(), path, 'exec'), dictionary)
return dictionary
@@ -213,7 +214,7 @@ def git_sync_deps(deps_file_path, command_line_os_requests, verbose):
dependencies = deps_file['deps'].copy()
os_specific_dependencies = deps_file.get('deps_os', dict())
if 'all' in command_line_os_requests:
- for value in os_specific_dependencies.itervalues():
+ for value in os_specific_dependencies.values():
dependencies.update(value)
else:
for os_name in command_line_os_requests: