an even better forward port.

This commit is contained in:
Faik Uygur
2007-05-28 11:21:03 +00:00
parent c09f10ef92
commit 5cebb2a16e
3 changed files with 9 additions and 9 deletions
+5 -9
View File
@@ -73,12 +73,12 @@ def init(database = True, write = True,
else:
ctx.ui = ui
destdir = ""
if ctx.get_option('destdir'):
destdir = ctx.get_option('destdir')
# FIXME: something is wrong here... see __init__.py also. Why do we import pisi.api in __init__.py
import pisi.config
ctx.config = pisi.config.Config(options)
if os.access('%s/var/log' % destdir, os.W_OK):
handler = logging.handlers.RotatingFileHandler('%s/var/log/pisi.log' % destdir)
if os.access('%s/var/log' % ctx.config.log_dir(), os.W_OK):
handler = logging.handlers.RotatingFileHandler('%s/var/log/pisi.log' % ctx.config.log_dir())
#handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)-12s: %(levelname)-8s %(message)s')
handler.setFormatter(formatter)
@@ -96,10 +96,6 @@ def init(database = True, write = True,
if stderr:
ctx.stderr = stderr
# FIXME: something is wrong here... see __init__.py also. Why do we import pisi.api in __init__.py
import pisi.config
ctx.config = pisi.config.Config(options)
if signal_handling:
ctx.sig = pisi.signalhandler.SignalHandler()
+3
View File
@@ -86,6 +86,9 @@ class Config(object):
pisi.util.check_dir(dir)
return dir
def log_dir(self):
return self.subdir(self.values.dirs.log_dir)
def lib_dir(self):
return self.subdir(self.values.dirs.lib_dir)
+1
View File
@@ -86,6 +86,7 @@ class BuildDefaults:
class DirectoriesDefaults:
"Default values for [directories] section"
lib_dir = "/var/lib/pisi"
log_dir = "/var/log/pisi"
db_dir = "/var/db/pisi"
archives_dir = "/var/cache/pisi/archives"
packages_dir = "/var/cache/pisi/packages"