From 3ce70b9e4945562ff42c8b489a72f2e2d2236d98 Mon Sep 17 00:00:00 2001 From: Martin Gracik Date: Tue, 23 Nov 2010 14:25:39 +0100 Subject: [PATCH] Move kernel constants to constants.py --- src/pylorax/__init__.py | 5 +---- src/pylorax/constants.py | 7 ++++++- src/pylorax/installtree.py | 12 +++--------- src/pylorax/outputtree.py | 5 +++-- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/pylorax/__init__.py b/src/pylorax/__init__.py index daec0db3..abe2acbe 100644 --- a/src/pylorax/__init__.py +++ b/src/pylorax/__init__.py @@ -78,10 +78,7 @@ LIB32 = "lib" LIB64 = "lib64" -# kernel types -K_NORMAL = 0 -K_PAE = 1 -K_XEN = 1 + class Lorax(BaseLoraxClass): diff --git a/src/pylorax/constants.py b/src/pylorax/constants.py index 30c5402b..8de07789 100644 --- a/src/pylorax/constants.py +++ b/src/pylorax/constants.py @@ -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 diff --git a/src/pylorax/installtree.py b/src/pylorax/installtree.py index d5cf45de..13eae5d5 100644 --- a/src/pylorax/installtree.py +++ b/src/pylorax/installtree.py @@ -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), diff --git a/src/pylorax/outputtree.py b/src/pylorax/outputtree.py index 7683c0b6..03bae4f9 100644 --- a/src/pylorax/outputtree.py +++ b/src/pylorax/outputtree.py @@ -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)