Bug 1726269: part 1) Repeatedly call `::OleSetClipboard` for the Windows-specific...
[gecko.git] / browser / app / macversion.py
blob3d9aaaa94ac54566917a6a88df96475f54cef1fc
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 from __future__ import absolute_import, print_function, unicode_literals
7 import io
8 from optparse import OptionParser
9 import sys
10 import re
12 o = OptionParser()
13 o.add_option("--buildid", dest="buildid")
14 o.add_option("--version", dest="version")
16 (options, args) = o.parse_args()
18 if not options.buildid:
19 print("--buildid is required", file=sys.stderr)
20 sys.exit(1)
22 if not options.version:
23 print("--version is required", file=sys.stderr)
24 sys.exit(1)
26 # We want to build a version number that matches the format allowed for
27 # CFBundleVersion (nnnnn[.nn[.nn]]). We'll incorporate both the version
28 # number as well as the date, so that it changes at least daily (for nightly
29 # builds), but also so that newly-built older versions (e.g. beta build) aren't
30 # considered "newer" than previously-built newer versions (e.g. a trunk nightly)
32 define, MOZ_BUILDID, buildid = (
33 io.open(options.buildid, "r", encoding="utf-8").read().split()
36 # extract only the major version (i.e. "14" from "14.0b1")
37 majorVersion = re.match(r"^(\d+)[^\d].*", options.version).group(1)
38 # last two digits of the year
39 twodigityear = buildid[2:4]
40 month = buildid[4:6]
41 if month[0] == "0":
42 month = month[1]
43 day = buildid[6:8]
44 if day[0] == "0":
45 day = day[1]
47 print("%s.%s.%s" % (majorVersion + twodigityear, month, day))