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:
@@ -35,18 +35,14 @@ class Dirs:
|
|||||||
|
|
||||||
class Flags:
|
class Flags:
|
||||||
"""General flags used in actions API"""
|
"""General flags used in actions API"""
|
||||||
# TODO: Eventually we should consider getting these from a/the
|
conf = pisi.config.config
|
||||||
# configuration file
|
|
||||||
|
|
||||||
# bu çok çirkin, bunu burada yazmamak gerekiyor, yine de actions
|
host = conf.host
|
||||||
# api içerisinde tekrarlanmasından iyidir. Yeri geldiğinde
|
cflags = conf.cflags
|
||||||
# standart config dosyasından build-arch'ı alıp ona göre
|
cxxflags = conf.cflags
|
||||||
# oluştururuz...
|
|
||||||
host = "i686-pc-linux-gnu"
|
|
||||||
|
|
||||||
class ActionsConfig(pisi.config.Config):
|
class ActionsConfig(pisi.config.Config):
|
||||||
const = pisi.constants.const
|
const = pisi.constants.const
|
||||||
conf = pisi.config.config
|
|
||||||
env = Env()
|
env = Env()
|
||||||
dirs = Dirs()
|
dirs = Dirs()
|
||||||
flags = Flags()
|
flags = Flags()
|
||||||
|
|||||||
+21
-3
@@ -9,7 +9,7 @@
|
|||||||
#configuration parameters.
|
#configuration parameters.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from ConfigParser import ConfigParser
|
||||||
from constants import const
|
from constants import const
|
||||||
|
|
||||||
class Config(object):
|
class Config(object):
|
||||||
@@ -18,10 +18,28 @@ class Config(object):
|
|||||||
class configimpl:
|
class configimpl:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# self.c.destdir = '' # install default to root by default
|
configParser = ConfigParser()
|
||||||
self.destdir = os.getcwd() +'/tmp' # only for ALPHA
|
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=...
|
# 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
|
# directory accessor functions
|
||||||
# here is how it goes
|
# here is how it goes
|
||||||
# x_dir: system wide directory for storing info type x
|
# x_dir: system wide directory for storing info type x
|
||||||
|
|||||||
Reference in New Issue
Block a user