[kernel] r14723 - people/waldi/utils/kconfigeditor2/lib/kconfigeditor
Bastian Blank
waldi at alioth.debian.org
Fri Dec 4 14:01:46 UTC 2009
Author: waldi
Date: Fri Dec 4 14:01:43 2009
New Revision: 14723
Log:
lib/kconfigeditor/package.py
- Import config module by hand.
- Make data a real object.
Modified:
people/waldi/utils/kconfigeditor2/lib/kconfigeditor/package.py
Modified: people/waldi/utils/kconfigeditor2/lib/kconfigeditor/package.py
==============================================================================
--- people/waldi/utils/kconfigeditor2/lib/kconfigeditor/package.py Thu Dec 3 23:52:48 2009 (r14722)
+++ people/waldi/utils/kconfigeditor2/lib/kconfigeditor/package.py Fri Dec 4 14:01:43 2009 (r14723)
@@ -2,29 +2,39 @@
import os
-from debian_linux.config import ConfigCoreHierarchy
-
from .kconfig.menu import MenuEntryChoice, MenuEntryConfig
from .kconfig.config import File
+class PackageFile(object):
+ def __init__(self, key, kernelarch, file):
+ self.keys, self.kernelarch, self.file = [key], kernelarch, file
+
+ def add(self, key, kernelarch):
+ self.keys.append(key)
+ if self.kernelarch != kernelarch:
+ self.kernelarch = None
+
+
class Package(object):
def __init__(self, root):
+ import imp
+
+ data = imp.find_module('config', [os.path.join(root, 'debian', 'lib', 'python', 'debian_linux')])
+ module = imp.load_module('config', *data)
+ print module
self.config_root = os.path.join(root, "debian/config")
- self.config = ConfigCoreHierarchy([self.config_root])
+ self.config = module.ConfigCoreHierarchy([self.config_root])
self.files = files = {}
for filename, key, kernelarch in self._collect():
if filename in files:
data = files[filename]
- data['keys'].append(key)
- if data['kernelarch'] != kernelarch:
- data['kernelarch'] = None
+ data.add(key, kernelarch)
else:
- file = File()
- file.read(open(os.path.join(self.config_root, filename)))
- files[filename] = {'file': file, 'keys': [key], 'kernelarch': kernelarch}
+ file = File(fd=open(os.path.join(self.config_root, filename)))
+ files[filename] = PackageFile(key, kernelarch, file)
def _collect(self):
for filename in self._check_config('config'):
More information about the Kernel-svn-changes
mailing list