Bug 1192003 - Change "Sync between all devices" to "Sync across all devices" in sync preferences. r=markh

# 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/.'''Expandlibs is a system that allows to replace some libraries with adescriptor file containing some linking information about them.The descriptor file format is as follows:---8<-----OBJS = a.o b.o ...LIBS = libfoo.a libbar.a ...--->8-----(In the example above, OBJ_SUFFIX is o and LIB_SUFFIX is a).Expandlibs also canonicalizes how to pass libraries to the linker, suchthat only the ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} form needs to be used:given a list of files, expandlibs will replace items with the form${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} following these rules:- If a ${DLL_PREFIX}${ROOT}.${DLL_SUFFIX} or ${DLL_PREFIX}${ROOT}.${IMPORT_LIB_SUFFIX} file exists, use that instead- If the ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} file exists, use it- If a ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX}.${LIB_DESC_SUFFIX} file exists, replace ${LIB_PREFIX}${ROOT}.${LIB_SUFFIX} with the OBJS and LIBS the descriptor contains. And for each of these LIBS, also apply the same rules.'''from__future__importwith_statementimportsys,os,errnoimportexpandlibs_configasconfdefensureParentDir(file):'''Ensures the directory parent to the given file exists'''dir=os.path.dirname(file)ifdirandnotos.path.exists(dir):try:os.makedirs(dir)exceptOSError,error:iferror.errno!=errno.EEXIST:raisedefrelativize(path):'''Returns a path relative to the current working directory, if it is shorter than the given path'''defsplitpath(path):dir,file=os.path.split(path)ifos.path.splitdrive(dir)[1]==os.sep:return[file]returnsplitpath(dir)+[file]ifnotos.path.exists(path):returnpathcurdir=splitpath(os.path.abspath(os.curdir))abspath=splitpath(os.path.abspath(path))whilecurdirandabspathandcurdir[0]==abspath[0]:delcurdir[0]delabspath[0]ifnotcurdirandnotabspath:return'.'relpath=os.path.join(*[os.pardirforiincurdir]+abspath)iflen(path)>len(relpath):returnrelpathreturnpathdefisObject(path):'''Returns whether the given path points to an object file, that is, ends with OBJ_SUFFIX or .i_o'''returnos.path.splitext(path)[1]in[conf.OBJ_SUFFIX,'.i_o']defisDynamicLib(path):'''Returns whether the given path points to a dynamic library, that is, ends with DLL_SUFFIX.'''# On mac, the xul library is named XUL, instead of libxul.dylib. Assume any# file by that name is a dynamic library.returnos.path.splitext(path)[1]==conf.DLL_SUFFIXoros.path.basename(path)=='XUL'classLibDescriptor(dict):KEYS=['OBJS','LIBS']def__init__(self,content=None):'''Creates an instance of a lib descriptor, initialized with contents from a list of strings when given. This is intended for use with file.readlines()'''ifisinstance(content,list)andall([isinstance(item,str)foritemincontent]):passelifcontentisnotNone:raiseTypeError("LibDescriptor() arg 1 must be None or a list of strings")super(LibDescriptor,self).__init__()forkeyinself.KEYS:self[key]=[]ifnotcontent:returnforkey,valuein[(s.strip()forsinitem.split('=',2))foritemincontentifitem.find('=')>=0]:ifkeyinself.KEYS:self[key]=value.split()def__str__(self):'''Serializes the lib descriptor'''return'\n'.join('%s = %s'%(k,' '.join(self[k]))forkinself.KEYSiflen(self[k]))classExpandArgs(list):def__init__(self,args):'''Creates a clone of the |args| list and performs file expansion on each item it contains'''super(ExpandArgs,self).__init__()self._descs=set()forarginargs:self+=self._expand(arg)def_expand(self,arg):'''Internal function doing the actual work'''(root,ext)=os.path.splitext(arg)ifext!=conf.LIB_SUFFIXornotos.path.basename(root).startswith(conf.LIB_PREFIX):return[relativize(arg)]ifconf.LIB_PREFIX:dll=root.replace(conf.LIB_PREFIX,conf.DLL_PREFIX,1)+conf.DLL_SUFFIXelse:dll=root+conf.DLL_SUFFIXifos.path.exists(dll):ifconf.IMPORT_LIB_SUFFIX:return[relativize(root+conf.IMPORT_LIB_SUFFIX)]else:return[relativize(dll)]returnself._expand_desc(arg)def_expand_desc(self,arg):'''Internal function taking care of lib descriptor expansion only'''desc=os.path.abspath(arg+conf.LIBS_DESC_SUFFIX)ifos.path.exists(desc):ifdescinself._descs:return[]self._descs.add(desc)withopen(desc,'r')asf:desc=LibDescriptor(f.readlines())objs=[relativize(o)foroindesc['OBJS']]forlibindesc['LIBS']:objs+=self._expand(lib)returnobjsreturn[relativize(arg)]if__name__=='__main__':print" ".join(ExpandArgs(sys.argv[1:]))