finch_skia_gold_properties.py 894 B

1234567891011121314151617181920212223242526272829
  1. # Copyright 2022 The Chromium Authors. All rights reserved.
  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. import os
  6. import subprocess
  7. import sys
  8. THIS_DIR = os.path.abspath(os.path.dirname(__file__))
  9. CHROMIUM_SRC_DIR = os.path.realpath(os.path.join(THIS_DIR, '..', '..', '..'))
  10. sys.path.insert(0, os.path.join(CHROMIUM_SRC_DIR, 'build'))
  11. from skia_gold_common import skia_gold_properties
  12. class FinchSkiaGoldProperties(skia_gold_properties.SkiaGoldProperties):
  13. @staticmethod
  14. def _GetGitOriginMainHeadSha1():
  15. try:
  16. return subprocess.check_output(
  17. ['git', 'rev-parse', 'origin/main'],
  18. shell=_IsWin(),
  19. cwd=CHROMIUM_SRC_DIR).strip()
  20. except subprocess.CalledProcessError:
  21. return None
  22. def _IsWin():
  23. return sys.platform == 'win32'