[kernel] r13134 - in people/waldi/utils/kconfigeditor2/lib/kconfigeditor: . kconfig kconfig/menu
Bastian Blank
waldi at alioth.debian.org
Mon Mar 16 20:47:35 UTC 2009
Author: waldi
Date: Mon Mar 16 20:47:33 2009
New Revision: 13134
Log:
Rename some classes.
Modified:
people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py
people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/__init__.py
people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/all.py
people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
people/waldi/utils/kconfigeditor2/lib/kconfigeditor/package.py
Modified: people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py (original)
+++ people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/config.py Mon Mar 16 20:47:33 2009
@@ -2,7 +2,7 @@
import os
-from .menu.file import FileChoice, FileConfig
+from .menu import MenuEntryChoice, MenuEntryConfig
class File(dict):
@@ -15,7 +15,7 @@
ret = []
nr = 0
for i in f:
- if isinstance(i, FileConfig):
+ if isinstance(i, MenuEntryConfig):
r = self._dump_file_config(processed, ignored, have_prompt, i)
if r:
ret.extend(r)
@@ -48,9 +48,9 @@
def _dump_file(self, processed, ignored, have_prompt, f):
ret = []
for i in f:
- if isinstance(i, FileConfig):
+ if isinstance(i, MenuEntryConfig):
ret.extend(self._dump_file_config(processed, ignored, have_prompt, i))
- elif isinstance(i, FileChoice):
+ elif isinstance(i, MenuEntryChoice):
ret.extend(self._dump_file_choice(processed, ignored, have_prompt, i))
if ret:
ret[0:0] = ["##", "## file: %s" % f.filename, "##"]
@@ -65,11 +65,11 @@
def _dump_prompt_file(self, have_prompt, f):
for i in f:
- if isinstance(i, FileConfig):
+ if isinstance(i, MenuEntryConfig):
self._dump_prompt_file_config(have_prompt, i)
- elif isinstance(i, FileChoice):
+ elif isinstance(i, MenuEntryChoice):
for i1 in i:
- if isinstance(i1, FileConfig):
+ if isinstance(i1, MenuEntryConfig):
self._dump_prompt_file_config(have_prompt, i1)
def dump(self, root, menufiles, ignore_silent = False):
Modified: people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/__init__.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/__init__.py (original)
+++ people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/__init__.py Mon Mar 16 20:47:33 2009
@@ -0,0 +1,26 @@
+class MenuEntryChoice(list):
+ def __init__(self, prompt=None):
+ self.prompt = prompt
+
+ def __repr__(self):
+ return "<%s(%r)>" % (self.__class__.__name__, self.prompt)
+
+
+class MenuEntryConfig(object):
+ TYPE_BOOL = 1
+ TYPE_TRISTATE = 2
+
+ def __init__(self, name, type=None, prompt=None):
+ self.name, self.type, self.prompt = name, type, prompt
+
+ def __repr__(self):
+ return "<%s(%r, %r, %r)>" % (self.__class__.__name__, self.name, self.type, self.prompt)
+
+
+class MenuEntrySource(object):
+ def __init__(self, filename):
+ self.filename = filename
+
+ def __repr__(self):
+ return "<%s(%r)>" % (self.__class__.__name__, self.filename)
+
Modified: people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/all.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/all.py (original)
+++ people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/all.py Mon Mar 16 20:47:33 2009
@@ -1,6 +1,9 @@
+from __future__ import absolute_import
+
import os
-from file import FileSource, Parser
+from . import MenuEntrySource
+from .file import Parser
class All(object):
def __init__(self, root, arches):
@@ -26,7 +29,7 @@
f = self.files.setdefault(filename, Parser()(file(os.path.join(root, filename)), filename))
for i in f:
- if isinstance(i, FileSource):
+ if isinstance(i, MenuEntrySource):
work.append(i.filename)
self.files_all = {}
Modified: people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py (original)
+++ people/waldi/utils/kconfigeditor2/lib/kconfigeditor/kconfig/menu/file.py Mon Mar 16 20:47:33 2009
@@ -1,5 +1,10 @@
+from __future__ import absolute_import
+
import re
+from . import MenuEntryChoice, MenuEntryConfig, MenuEntrySource
+
+
class ParseException(Exception):
filename = None
lineno = None
@@ -14,30 +19,6 @@
def __init__(self, filename):
self.filename = filename
-class FileChoice(list):
- def __init__(self, prompt = None):
- self.prompt = prompt
-
- def __repr__(self):
- return "<%s(%r)>" % (self.__class__.__name__, self.prompt)
-
-class FileConfig(object):
- TYPE_BOOL = 1
- TYPE_TRISTATE = 2
-
- def __init__(self, name, type = None, prompt = None):
- self.name, self.type, self.prompt = name, type, prompt
-
- def __repr__(self):
- return "<%s(%r, %r, %r)>" % (self.__class__.__name__, self.name, self.type, self.prompt)
-
-class FileSource(object):
- def __init__(self, filename):
- self.filename = filename
-
- def __repr__(self):
- return "<%s(%r)>" % (self.__class__.__name__, self.filename)
-
class Parser(object):
def __call__(self, fd, filename):
lineno = 1
@@ -199,7 +180,7 @@
class _BlockChoice(_BlockObject, _BlockContainerCommon):
def __init__(self, parent):
super(_BlockChoice, self).__init__(parent)
- self.entry = FileChoice()
+ self.entry = MenuEntryChoice()
parent.entry.append(self.entry)
_BlockConfigData(self, self.entry)
@@ -245,7 +226,7 @@
_Expression(self, text)
def process_bool(self, text, ind):
- self.entry.type = FileConfig.TYPE_BOOL
+ self.entry.type = MenuEntryConfig.TYPE_BOOL
# TODO
self._process_prompt(text, ind)
@@ -255,11 +236,11 @@
_Expression(self, text)
def process_def_bool(self, text, ind):
- self.entry.type = FileConfig.TYPE_BOOL
+ self.entry.type = MenuEntryConfig.TYPE_BOOL
_Expression(self, text)
def process_def_tristate(self, text, ind):
- self.entry.type = FileConfig.TYPE_TRISTATE
+ self.entry.type = MenuEntryConfig.TYPE_TRISTATE
_Expression(self, text)
def process_help(self, text, ind):
@@ -293,13 +274,13 @@
self._process_prompt(text, ind)
def process_tristate(self, text, ind):
- self.entry.type = FileConfig.TYPE_TRISTATE
+ self.entry.type = MenuEntryConfig.TYPE_TRISTATE
# TODO
self._process_prompt(text, ind)
class _BlockConfig(_BlockConfigData):
def __init__(self, parent, name):
- super(_BlockConfig, self).__init__(parent, FileConfig(name))
+ super(_BlockConfig, self).__init__(parent, MenuEntryConfig(name))
parent.entry.append(self.entry)
class _BlockHelp(_BlockObject):
@@ -359,14 +340,14 @@
super(_BlockMenuconfig, self).__init__(parent, "")
self.entry = parent.entry
# TODO
- entry = FileConfig(name)
+ entry = MenuEntryConfig(name)
parent.entry.append(entry)
_BlockConfigData(self, entry)
class _BlockSource(_BlockObject):
def __init__(self, parent, text):
super(_BlockSource, self).__init__(parent)
- self.entry = FileSource(text)
+ self.entry = MenuEntrySource(text)
parent.entry.append(self.entry)
class _Expression(_Element):
Modified: people/waldi/utils/kconfigeditor2/lib/kconfigeditor/package.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/lib/kconfigeditor/package.py (original)
+++ people/waldi/utils/kconfigeditor2/lib/kconfigeditor/package.py Mon Mar 16 20:47:33 2009
@@ -4,7 +4,7 @@
from debian_linux.config import ConfigCoreHierarchy
-from .kconfig.menu.file import FileChoice, FileConfig
+from .kconfig.menu import MenuEntryChoice, MenuEntryConfig
from .kconfig.config import File
class Files(dict):
More information about the Kernel-svn-changes
mailing list