[kernel-team] 09/86: lib/kconfigeditor/kconfig/menu/file.py: Update.
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Mon Dec 21 00:34:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch benh/kconfigeditor2
in repository kernel-team.
commit 847dc3fbd1435f8785a3e8ea00cc4a8bfbc22707
Author: Bastian Blank <waldi at debian.org>
Date: Tue Mar 11 16:57:06 2008 +0000
lib/kconfigeditor/kconfig/menu/file.py: Update.
svn path=/people/waldi/utils/kconfigeditor2/; revision=10804
---
.../lib/kconfigeditor/kconfig/menu/file.py | 68 ++++++++++++----------
1 file changed, 38 insertions(+), 30 deletions(-)
diff --git a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
index 3f3e1f1..2f7650e 100644
--- a/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
+++ b/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
@@ -52,7 +52,7 @@ class Parser(object):
else:
stack.top().process_line(line)
lineno += 1
- return stack.top().stop(lineno, 0)
+ return stack.top().process_stop(lineno, 0)
class _Text(object):
__slots__ = "text", "lineno", "column"
@@ -116,7 +116,7 @@ class _BlockContainer(object):
split_rules = r"""
^
(?P<ind>\s*)
- (---)?(?P<word>[a-z_]+)(---)?
+ (---\s*)?(?P<word>[a-z_]+)(\s*---)?
(
\s*"(?P<rest2>.+)"
|
@@ -158,7 +158,7 @@ class _BlockContainerCommon(_BlockContainer):
class _BlockContainerDepends(_BlockContainer):
def process_depends(self, text, ind):
- _BlockDepends(self, ind)
+ _BlockType(self, text, ind)
class _BlockContainerMenu(_BlockContainer):
def process_menu(self, text, ind):
@@ -166,28 +166,11 @@ class _BlockContainerMenu(_BlockContainer):
class _BlockObject(_Element):
def __getattr__(self, name):
- def ret(*args):
- return self.recurse(name, *args)
- return ret
-
-class _BlockObjectIndentation(_BlockObject):
- split_rules = r"^(?P<ind>\s+)(?P<rest>.*)$"
- split_re = re.compile(split_rules)
-
- def __init__(self, parent, ind):
- super(_BlockObjectIndentation, self).__init__(parent)
- self._indentation = ind
-
- def process_line(self, text):
- match = self.split_re.match(text)
- if not match:
- return self.recurse('process_line', text)
- l = len(match.group('ind'))
- if self._indentation < l:
- return self.recurse('process_line', text)
-
- def process_line_empty(self):
- pass
+ if name.startswith('process_'):
+ def ret(*args):
+ return self.recurse(name, *args)
+ return ret
+ raise AttributeError(name)
class _BlockRoot(
_BlockContainerChoice,
@@ -204,13 +187,14 @@ class _BlockRoot(
def process_mainmenu(self, text, ind):
pass
- def stop(self, lineno, column):
+ def process_stop(self, lineno, column):
self.stack.pop(self)
return self.entry
class _BlockChoice(_BlockObject, _BlockContainerCommon):
def __init__(self, parent):
super(_BlockChoice, self).__init__(parent)
+ # TODO
self.entry = parent.entry
_BlockConfigData(self)
@@ -274,11 +258,32 @@ class _BlockConfig(_BlockConfigData):
self.entry = FileConfig(name)
parent.entry.append(self.entry)
-class _BlockDepends(_BlockObjectIndentation):
- pass
+class _BlockHelp(_BlockObject):
+ split_rules = r"^(?P<ind>\s+)(?P<rest>.*)$"
+ split_re = re.compile(split_rules)
+
+ def __init__(self, parent, ind):
+ super(_BlockHelp, self).__init__(parent)
+ self.indentation_init = len(ind)
+ self.indentation = None
+
+ def process_line(self, text):
+ match = self.split_re.match(text)
+ if match:
+ ind = match.group('ind').expandtabs()
+ l = len(ind)
+ if l >= self.indentation_init:
+ if self.indentation is None:
+ self.indentation = l
+ return
+ elif l >= self.indentation:
+ return
+
+ return self.recurse('process_line', text)
+
+ def process_line_empty(self):
+ pass
-class _BlockHelp(_BlockObjectIndentation):
- pass
class _BlockIf(_BlockObject,
_BlockContainerChoice,
@@ -312,6 +317,9 @@ class _BlockMenuconfig(_BlockMenu):
def __init__(self, parent, name):
super(_BlockMenuconfig, self).__init__(parent, "")
self.entry = parent.entry
+ # TODO
+ entry = FileConfig(name)
+ parent.entry.append(entry)
_BlockConfigData(self)
class _BlockSource(_BlockObject):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/kernel-team.git
More information about the Kernel-svn-changes
mailing list