kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 1 | # Copyright 2021 The PDFium Authors |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | """PDFium implementation of //build/skia_gold_common/skia_gold_properties.py.""" |
| 5 | |
| 6 | import subprocess |
| 7 | import sys |
| 8 | |
| 9 | import pdfium_root |
| 10 | from skia_gold_common import skia_gold_properties |
| 11 | |
| 12 | |
| 13 | class PDFiumSkiaGoldProperties(skia_gold_properties.SkiaGoldProperties): |
| 14 | |
| 15 | @staticmethod |
| 16 | def _GetGitOriginMainHeadSha1(): |
| 17 | root_finder = pdfium_root.RootDirectoryFinder() |
| 18 | try: |
| 19 | return subprocess.check_output(['git', 'rev-parse', 'origin/main'], |
| 20 | shell=_IsWin(), |
| 21 | cwd=root_finder.pdfium_root).strip() |
| 22 | except subprocess.CalledProcessError: |
| 23 | return None |
| 24 | |
| 25 | |
| 26 | def _IsWin(): |
| 27 | return sys.platform == 'win32' |