--- a/compare_locales/paths.py
+++ b/compare_locales/paths.py
@@ -35,18 +35,16 @@ class L10nConfigParser(object):
self.children = []
# we really only care about the l10n directories described in l10n.ini
self.dirs = []
# optional defaults to be passed to the inner ConfigParser (unused?)
self.defaults = kwargs
def getDepth(self, cp):
'''Get the depth for the comparison from the parsed l10n.ini.
-
- Overloadable to get the source depth for fennec and friends.
'''
try:
depth = cp.get('general', 'depth')
except:
depth = '.'
return depth
def getFilters(self):
@@ -96,24 +94,16 @@ class L10nConfigParser(object):
self.addChild(title, path, cp)
except NoSectionError:
pass
# try to load the "dirs" defined in the "compare" section
try:
self.dirs.extend(cp.get('compare', 'dirs').split())
except (NoOptionError, NoSectionError):
pass
- # try getting a top level compare dir, as used for fennec
- try:
- self.tld = cp.get('compare', 'tld')
- # remove tld from comparison dirs
- if self.tld in self.dirs:
- self.dirs.remove(self.tld)
- except (NoOptionError, NoSectionError):
- self.tld = None
# try to set "all_path" and "all_url"
try:
self.all_path = cp.get('general', 'all')
self.all_url = urljoin(self.baseurl, self.all_path)
except (NoOptionError, NoSectionError):
self.all_path = None
self.all_url = None
return cp
@@ -124,31 +114,20 @@ class L10nConfigParser(object):
title -- indicates the module's name
path -- indicates the path to the module's l10n.ini file
orig_cp -- the configuration parser of this l10n.ini
"""
cp = L10nConfigParser(urljoin(self.baseurl, path), **self.defaults)
cp.loadConfigs()
self.children.append(cp)
- def getTLDPathsTuple(self, basepath):
- """Given the basepath, return the path fragments to be used for
- self.tld. For build runs, this is (basepath, self.tld), for
- source runs, just (basepath,).
-
- @see overwritten method in SourceTreeConfigParser.
- """
- return (basepath, self.tld)
-
def dirsIter(self):
"""Iterate over all dirs and our base path for this l10n.ini"""
url = urlparse(self.baseurl)
basepath = url2pathname(url.path)
- if self.tld is not None:
- yield self.tld, self.getTLDPathsTuple(basepath)
for dir in self.dirs:
yield dir, (basepath, dir)
def directories(self):
"""Iterate over all dirs and base paths for this l10n.ini as well
as the included ones.
"""
for t in self.dirsIter():
@@ -173,31 +152,16 @@ class SourceTreeConfigParser(L10nConfigP
basepath is used to resolve local paths via branchnames.
redirects is used in unified repository, mapping upstream
repos to local clones.
'''
L10nConfigParser.__init__(self, inipath)
self.basepath = basepath
self.redirects = redirects
- self.tld = None
-
- def getDepth(self, cp):
- '''Get the depth for the comparison from the parsed l10n.ini.
-
- Overloaded to get the source depth for fennec and friends.
- '''
- try:
- depth = cp.get('general', 'source-depth')
- except:
- try:
- depth = cp.get('general', 'depth')
- except:
- depth = '.'
- return depth
def addChild(self, title, path, orig_cp):
# check if there's a section with details for this include
# we might have to check a different repo, or even VCS
# for example, projects like "mail" indicate in
# an "include_" section where to find the l10n.ini for "toolkit"
details = 'include_' + title
if orig_cp.has_section(details):
@@ -207,22 +171,16 @@ class SourceTreeConfigParser(L10nConfigP
path = self.basepath + '/' + branch + '/' + inipath
else:
path = urljoin(self.baseurl, path)
cp = SourceTreeConfigParser(path, self.basepath, self.redirects,
**self.defaults)
cp.loadConfigs()
self.children.append(cp)
- def getTLDPathsTuple(self, basepath):
- """Overwrite L10nConfigParser's getTLDPathsTuple to just return
- the basepath.
- """
- return (basepath, )
-
class File(object):
def __init__(self, fullpath, file, module=None, locale=None):
self.fullpath = fullpath
self.file = file
self.module = module
self.locale = locale
@@ -371,19 +329,16 @@ class EnumerateApp(object):
LocalesWrap(self.l10nbase, mod, self.locales,
[m[len(mod)+1:] for m in mods if m.startswith(mod+'/')]))
class EnumerateSourceTreeApp(EnumerateApp):
'''Subclass EnumerateApp to work on side-by-side checked out
repos, and to no pay attention to how the source would actually
be checked out for building.
-
- It's supporting applications like Fennec, too, which have
- 'locales/en-US/...' in their root dir, but claim to be 'mobile'.
'''
def __init__(self, inipath, basepath, l10nbase, redirects,
locales=None):
self.basepath = basepath
self.redirects = redirects
EnumerateApp.__init__(self, inipath, l10nbase, locales)