blob: 2577277f100e83015de28ca355cd88fc5708cdae [file] [log] [blame]
halcanaryffe54002016-03-29 09:09:29 -07001#!/usr/bin/env python
2# Copyright 2016 Google Inc.
3#
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7import os
8import sys
9
10milestone_file = 'include/core/SkMilestone.h'
11
12usage = '''
13usage:
14 git fetch
15 git checkout -b change_milestone origin/master
16 python %s MILESTONE_NUMBER
17 git add %s
18 git commit -m "Update Skia milestone."
19 git cl land
20
21'''
22try:
23 milestone = int(sys.argv[1])
24 assert milestone > 0
25except (IndexError, ValueError, AssertionError):
26 sys.stderr.write(usage % (sys.argv[0], milestone_file))
27 exit(1)
28
29text = '''/*
30 * Copyright 2016 Google Inc.
31 *
32 * Use of this source code is governed by a BSD-style license that can be
33 * found in the LICENSE file.
34 */
35#ifndef SK_MILESTONE
36#define SK_MILESTONE %d
37#endif
38'''
39
40os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))
41
42with open(milestone_file, 'w') as o:
43 o.write(text % milestone)
44
45with open(milestone_file, 'r') as f:
46 sys.stdout.write(f.read())