From 7c7f9c6abe008b899506ca3bf34f196dd218ef25 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Fri, 31 May 2019 07:51:30 -0700 Subject: Convert git-sync-deps to Python 3 (#533) Fixes #528 --- kokoro/scripts/windows/build.bat | 6 +----- tools/git-sync-deps | 7 ++++--- 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: -- cgit v1.2.3