Config dosyası için TODO'lardan birini yapmayı denedim. Kafamdaki örnek config dosyası kod içnde yorum olarak duruyor. Basitliği nedeniyle INI uygun olur diye düşündüm. For your review yane...

This commit is contained in:
S.Çağlar Onur
2005-07-01 23:33:29 +00:00
parent a8f3f83b0f
commit f6637bb69e
2 changed files with 26 additions and 12 deletions
+5 -9
View File
@@ -35,18 +35,14 @@ class Dirs:
class Flags:
"""General flags used in actions API"""
# TODO: Eventually we should consider getting these from a/the
# configuration file
# bu çok çirkin, bunu burada yazmamak gerekiyor, yine de actions
# api içerisinde tekrarlanmasından iyidir. Yeri geldiğinde
# standart config dosyasından build-arch'ı alıp ona göre
# oluştururuz...
host = "i686-pc-linux-gnu"
conf = pisi.config.config
host = conf.host
cflags = conf.cflags
cxxflags = conf.cflags
class ActionsConfig(pisi.config.Config):
const = pisi.constants.const
conf = pisi.config.config
env = Env()
dirs = Dirs()
flags = Flags()
+21 -3
View File
@@ -9,7 +9,7 @@
#configuration parameters.
import os
from ConfigParser import ConfigParser
from constants import const
class Config(object):
@@ -18,10 +18,28 @@ class Config(object):
class configimpl:
def __init__(self):
# self.c.destdir = '' # install default to root by default
self.destdir = os.getcwd() +'/tmp' # only for ALPHA
configParser = ConfigParser()
configParser.read('/etc/pisi/pisi.conf')
#/etc/pisi/pisi.conf
#
#[general]
#destinationDirectory = /tmp
#
#[build]
#host = i686-pc-linux-gnu
#CFLAGS= -mcpu=i686 -O2 -pipe -fomit-frame-pointer
#CXXFLAGS= -mcpu=i686 -O2 -pipe -fomit-frame-pointer
self.destdir = os.getcwd() + configParser.get('general', \
'destinationDirectory')
# only for ALPHA
# the idea is that destdir can be set with --destdir=...
self.host = configParser.get('build', 'host')
self.cflags = configParser.get('build', 'CFLAGS')
self.cxxflags = configParser.get('build', 'CXXFLAGS')
# directory accessor functions
# here is how it goes
# x_dir: system wide directory for storing info type x