fix #2575: reset/re-initialize environment variables for each build.

This commit is contained in:
Barış Metin
2006-04-17 22:10:22 +00:00
parent d65ef53cbc
commit bb42a67f17
3 changed files with 28 additions and 9 deletions
+3 -3
View File
@@ -23,7 +23,7 @@ import pisi.actionsapi
import pisi.context as ctx import pisi.context as ctx
# ActionsAPI Modules # ActionsAPI Modules
from variables import glb import pisi.actionsapi.variables
class BinutilsError(pisi.actionsapi.Error): class BinutilsError(pisi.actionsapi.Error):
def __init__(self, value=''): def __init__(self, value=''):
@@ -32,8 +32,8 @@ class BinutilsError(pisi.actionsapi.Error):
ctx.ui.error(value) ctx.ui.error(value)
# Globals # Globals
env = glb.env env = pisi.actionsapi.variables.glb.env
dirs = glb.dirs dirs = pisi.actionsapi.variables.glb.dirs
def curDIR(): def curDIR():
'''returns current work directory's path''' '''returns current work directory's path'''
+18 -6
View File
@@ -74,13 +74,25 @@ class Dirs:
localstate = 'var/lib' localstate = 'var/lib'
defaultprefix = 'usr' defaultprefix = 'usr'
values = ctx.config.values # These should be owned by object not the class. Or else Python
kde = values.dirs.kde_dir # will bug us with NoneType errors because of uninitialized
qt = values.dirs.qt_dir # context (ctx) because of the import in build.py.
def __init__(self):
self.values = ctx.config.values
self.kde = self.values.dirs.kde_dir
self.qt = self.values.dirs.qt_dir
# As we import this module from build.py, we can't init glb as a
# singleton here. Or else Python will bug us with NoneType errors
# because of uninitialized context (ctx) because of exportFlags().
#
# We import this modue from build.py becase we need to reset/init glb
# for each build. # See bug #2575
glb = None
def initVariables(): def initVariables():
global glb
ctx.env = Env() ctx.env = Env()
ctx.dirs = Dirs() ctx.dirs = Dirs()
return ctx glb = ctx
glb = initVariables()
+7
View File
@@ -40,6 +40,8 @@ from pisi.metadata import MetaData
from pisi.package import Package from pisi.package import Package
import pisi.component as component import pisi.component as component
import pisi.actionsapi.variables
class Error(pisi.Error): class Error(pisi.Error):
pass pass
@@ -202,6 +204,11 @@ class Builder:
def set_environment_vars(self): def set_environment_vars(self):
"""Sets the environment variables for actions API to use""" """Sets the environment variables for actions API to use"""
# Each time a builder is created we must reset
# environment. See bug #2575
pisi.actionsapi.variables.initVariables()
env = { env = {
"PKG_DIR": self.pkg_dir(), "PKG_DIR": self.pkg_dir(),
"WORK_DIR": self.pkg_work_dir(), "WORK_DIR": self.pkg_work_dir(),