Bug 1127801 - Captured path to milestone.txt from the OS automatically using MozbuildObject from mozbuild.base r=ted.mielczrek,RyanVM
☠☠ backed out by aeea3711e05c ☠ ☠
authornaru-san <naru.aditya@gmail.com>
Wed, 25 Mar 2015 11:42:44 -0700
changeset 266066 e36d161eef9b37c39cf4d40cdbd7229f78a55ddd
parent 266065 7b69e3da12119fab74d3ec030e7823c123609952
child 266067 88d41ff68289f90543e27aad31bbcda59d7378f4
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1127801
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1127801 - Captured path to milestone.txt from the OS automatically using MozbuildObject from mozbuild.base r=ted.mielczrek,RyanVM
python/mozbuild/mozbuild/milestone.py
--- a/python/mozbuild/mozbuild/milestone.py
+++ b/python/mozbuild/mozbuild/milestone.py
@@ -1,13 +1,14 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import print_function, unicode_literals
+from mozbuild.base import MozbuildObject
 
 import argparse
 import os
 import re
 import sys
 
 
 def get_milestone_ab_with_num(milestone):
@@ -21,16 +22,19 @@ def get_milestone_ab_with_num(milestone)
 
     return ""
 
 
 def get_official_milestone(path):
     """
     Returns the contents of the first line in `path` that starts with a digit.
     """
+    if path is None:
+        build = MozbuildObject.from_environment()
+        path = os.path.join(build.topsrcdir,'config','milestone.txt')
 
     with open(path) as fp:
         for line in fp:
             line = line.strip()
             if line[:1].isdigit():
                 return line
 
     raise Exception("Didn't find a line that starts with a digit.")
@@ -43,21 +47,20 @@ def get_milestone_major(milestone):
 
     return milestone.split('.')[0]
 
 
 def main(args):
     parser = argparse.ArgumentParser()
     parser.add_argument('--uaversion', default=False, action='store_true')
     parser.add_argument('--symbolversion', default=False, action='store_true')
-    parser.add_argument('--topsrcdir', metavar='TOPSRCDIR', required=True)
     options = parser.parse_args(args)
 
-    milestone_file = os.path.join(options.topsrcdir, 'config', 'milestone.txt')
-
+    build = MozbuildObject.from_environment()
+    milestone_file = os.path.join(build.topsrcdir, 'config', 'milestone.txt')
     milestone = get_official_milestone(milestone_file)
 
     if options.uaversion:
         # Only expose the major milestone in the UA string, hide the patch
         # level (bugs 572659 and 870868).
         uaversion = "%s.0" % (get_milestone_major(milestone),)
         print(uaversion)