1# Copyright 2022 The Chromium Authors 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4"""Finch implementation of skia_gold_properties.py.""" 5 6import os 7import subprocess 8import sys 9 10THIS_DIR = os.path.abspath(os.path.dirname(__file__)) 11CHROMIUM_SRC_DIR = os.path.realpath(os.path.join(THIS_DIR, '..', '..', '..')) 12sys.path.insert(0, os.path.join(CHROMIUM_SRC_DIR, 'build')) 13from skia_gold_common import skia_gold_properties 14 15 16class FinchSkiaGoldProperties(skia_gold_properties.SkiaGoldProperties): 17 @staticmethod 18 def _GetGitOriginMainHeadSha1(): 19 try: 20 return subprocess.check_output( 21 ['git', 'rev-parse', 'origin/main'], 22 shell=_IsWin(), 23 cwd=CHROMIUM_SRC_DIR).strip() 24 except subprocess.CalledProcessError: 25 return None 26 27 28def _IsWin(): 29 return sys.platform == 'win32' 30