Bug 1127801 - Capture path to milestone.txt from the OS automatically using MozbuildObject from mozbuild.base. r=ted

CLOSED TREE
This commit is contained in:
naru-san 2015-04-07 12:43:40 -04:00
parent b9ff11e8b7
commit 17258381ee
4 changed files with 13 additions and 9 deletions

View File

@ -1920,9 +1920,9 @@ esac
dnl ==============================================================
dnl Get mozilla version from central milestone file
dnl ==============================================================
MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py`
MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --uaversion`
MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --symbolversion`
dnl Get version of various core apps from the version files.
FIREFOX_VERSION=`cat $_topsrcdir/browser/config/version.txt`

View File

@ -696,9 +696,9 @@ fi # COMPILE_ENVIRONMENT
dnl ==============================================================
dnl Get mozilla version from central milestone file
dnl ==============================================================
MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir`
MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --uaversion`
MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --topsrcdir $srcdir --symbolversion`
MOZILLA_VERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py`
MOZILLA_UAVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --uaversion`
MOZILLA_SYMBOLVERSION=`$PYTHON $srcdir/python/mozbuild/mozbuild/milestone.py --symbolversion`
AC_DEFINE_UNQUOTED(MOZILLA_VERSION,"$MOZILLA_VERSION")
AC_DEFINE_UNQUOTED(MOZILLA_VERSION_U,$MOZILLA_VERSION)

View File

@ -3,6 +3,7 @@
# 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
@ -26,6 +27,9 @@ 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:
@ -48,10 +52,10 @@ 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)

View File

@ -13,7 +13,7 @@ milestone_txt = $(topsrcdir)/config/milestone.txt
include $(topsrcdir)/config/rules.mk
# Should version be optional or required ?
TOOLKIT_EM_VERSION=$(shell $(PYTHON) $(topsrcdir)/python/mozbuild/mozbuild/milestone.py --topsrcdir=$(topsrcdir))
TOOLKIT_EM_VERSION=$(shell $(PYTHON) $(topsrcdir)/python/mozbuild/mozbuild/milestone.py)
$(call warnIfEmpty,TOOLKIT_EM_VERSION)
# Valid if null: {warn,error}IfEmpty