You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-utils-2.2-builder/pym/cl_kernel.py

74 lines
2.2 KiB

#-*- coding: utf-8 -*-
# Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = "2.2.0.0"
__app__ = "calculate-builder"
import os
import re
import sys
import traceback
from os import path
from cl_utils import process
from cl_print import color_print
from cl_datavars import DataVars
from cl_kernel_utils import KernelConfig,InitRamFs
from cl_lang import lang
class printNoColor:
def colorPrint(self,attr,fg,bg,string):
sys.stdout.write(string)
class DataVarsBuilder(DataVars):
"""Variable class for installation"""
def importBuilder(self, **args):
'''Get variables for builder'''
# section name in calculate.env
envSection = "builder"
# import builder variables
self.importData(envSection, ('cl_vars_builder','cl_fill_builder'))
class cl_kernel(color_print):
"""Primary class for kernel manipulation"""
def __init__(self):
self.clVars = None
self.startMessage = ""
def _testKernelDirectory(self,dirpath):
"""Test directory for kernel sources"""
makefilepath = path.join(dirpath,'Makefile')
kbuildpath = path.join(dirpath,'Kbuild')
if not path.exists(makefilepath) \
or not path.exists(kbuildpath) \
or not "Kbuild for top-level directory of the kernel" in \
open(kbuildpath,'r').read():
return False
return True
def setNoColor(self):
self.color = False
def initVars(self):
"""Primary initialization of variables"""
self.clVars = DataVarsBuilder()
self.clVars.importBuilder()
self.clVars.flIniFile()