Bug 1811329 [wpt PR 38068] - Specified hue interpolation is no longer in the spec...
[gecko.git] / browser / app / macversion.py
blob878fb096403a4dcc06ad94a3e0704a525a2f4b61
1 #!/usr/bin/python
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 import io
7 import re
8 import sys
9 from optparse import OptionParser
11 o = OptionParser()
12 o.add_option("--buildid", dest="buildid")
13 o.add_option("--version", dest="version")
15 (options, args) = o.parse_args()
17 if not options.buildid:
18 print("--buildid is required", file=sys.stderr)
19 sys.exit(1)
21 if not options.version:
22 print("--version is required", file=sys.stderr)
23 sys.exit(1)
25 # We want to build a version number that matches the format allowed for
26 # CFBundleVersion (nnnnn[.nn[.nn]]). We'll incorporate both the version
27 # number as well as the date, so that it changes at least daily (for nightly
28 # builds), but also so that newly-built older versions (e.g. beta build) aren't
29 # considered "newer" than previously-built newer versions (e.g. a trunk nightly)
31 define, MOZ_BUILDID, buildid = (
32 io.open(options.buildid, "r", encoding="utf-8").read().split()
35 # extract only the major version (i.e. "14" from "14.0b1")
36 majorVersion = re.match(r"^(\d+)[^\d].*", options.version).group(1)
37 # last two digits of the year
38 twodigityear = buildid[2:4]
39 month = buildid[4:6]
40 if month[0] == "0":
41 month = month[1]
42 day = buildid[6:8]
43 if day[0] == "0":
44 day = day[1]
46 print("%s.%s.%s" % (majorVersion + twodigityear, month, day))