Move kernel constants to constants.py

This commit is contained in:
Martin Gracik 2010-11-23 14:25:39 +01:00
parent c8b1f5f5ea
commit 3ce70b9e49
4 changed files with 13 additions and 16 deletions

View File

@ -78,10 +78,7 @@ LIB32 = "lib"
LIB64 = "lib64"
# kernel types
K_NORMAL = 0
K_PAE = 1
K_XEN = 1
class Lorax(BaseLoraxClass):

View File

@ -23,7 +23,6 @@ import logging
logger = logging.getLogger("pylorax")
import os
from sysutils import joinpaths
@ -66,3 +65,9 @@ class LoraxRequiredCommands(dict):
missing.append(cmd)
return missing
# kernel types
K_NORMAL = 0
K_PAE = 1
K_XEN = 1

View File

@ -37,12 +37,6 @@ import constants
from sysutils import *
# kernel types
K_NORMAL = 0
K_PAE = 1
K_XEN = 1
class LoraxInstallTree(BaseLoraxClass):
def __init__(self, yum, basearch, libdir):
@ -540,11 +534,11 @@ class LoraxInstallTree(BaseLoraxClass):
for fname in os.listdir(kerneldir):
m = kpattern.match(fname)
if m:
type = K_NORMAL
type = constants.K_NORMAL
if m.group("pae"):
type = K_PAE
type = constants.K_PAE
elif m.group("xen"):
type = K_XEN
type = constants.K_XEN
kernels.append(DataHolder(fname=fname,
fpath=joinpaths(kerneldir, fname),

View File

@ -30,6 +30,7 @@ import subprocess
from base import BaseLoraxClass, DataHolder
from sysutils import *
import constants
class LoraxOutputTree(BaseLoraxClass):
@ -69,9 +70,9 @@ class LoraxOutputTree(BaseLoraxClass):
for n, kernel in enumerate(self.installtree.kernels):
suffix = ""
if kernel.type == K_PAE:
if kernel.type == constants.K_PAE:
suffix = "-PAE"
elif kernel.type == K_XEN:
elif kernel.type == constants.K_XEN:
suffix = "-XEN"
kname = "vmlinuz{0}".format(suffix)