Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: skia/commit_hash.py

Issue 2187533002: skia_commit_hash.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « skia/BUILD.gn ('k') | skia/ext/skia_commit_hash.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/python
2
3 # Copyright (c) 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 '''
8 Usage: python commit_hash.py SKIA_DIR OUTPUT_FILE
9 '''
10
11 import os
12 import subprocess
13 import sys
14
15 assert len(sys.argv) == 3
16
17 template = '''#include "skia/ext/skia_commit_hash.h"
18 const char* skia::CommitHash() { return "%s"; }
19 '''
20
21 try:
22 commit = subprocess.check_output(
23 ['git', 'rev-parse', '--short=12', 'HEAD'],
24 cwd=sys.argv[1]).strip()
25 except (subprocess.CalledProcessError, OSError), e:
26 commit = 'UNKNOWN'
mtklein 2016/07/26 16:11:48 Is failure expected to happen somewhere? Wouldn't
27
28 with open(sys.argv[2], 'w') as o:
29 o.write(template % commit)
OLDNEW
« no previous file with comments | « skia/BUILD.gn ('k') | skia/ext/skia_commit_hash.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698