fix #2575: reset/re-initialize environment variables for each build.
This commit is contained in:
@@ -23,7 +23,7 @@ import pisi.actionsapi
|
||||
import pisi.context as ctx
|
||||
|
||||
# ActionsAPI Modules
|
||||
from variables import glb
|
||||
import pisi.actionsapi.variables
|
||||
|
||||
class BinutilsError(pisi.actionsapi.Error):
|
||||
def __init__(self, value=''):
|
||||
@@ -32,8 +32,8 @@ class BinutilsError(pisi.actionsapi.Error):
|
||||
ctx.ui.error(value)
|
||||
|
||||
# Globals
|
||||
env = glb.env
|
||||
dirs = glb.dirs
|
||||
env = pisi.actionsapi.variables.glb.env
|
||||
dirs = pisi.actionsapi.variables.glb.dirs
|
||||
|
||||
def curDIR():
|
||||
'''returns current work directory's path'''
|
||||
|
||||
@@ -74,13 +74,25 @@ class Dirs:
|
||||
localstate = 'var/lib'
|
||||
defaultprefix = 'usr'
|
||||
|
||||
values = ctx.config.values
|
||||
kde = values.dirs.kde_dir
|
||||
qt = values.dirs.qt_dir
|
||||
# These should be owned by object not the class. Or else Python
|
||||
# will bug us with NoneType errors because of uninitialized
|
||||
# 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():
|
||||
global glb
|
||||
ctx.env = Env()
|
||||
ctx.dirs = Dirs()
|
||||
return ctx
|
||||
|
||||
glb = initVariables()
|
||||
glb = ctx
|
||||
|
||||
@@ -40,6 +40,8 @@ from pisi.metadata import MetaData
|
||||
from pisi.package import Package
|
||||
import pisi.component as component
|
||||
|
||||
import pisi.actionsapi.variables
|
||||
|
||||
|
||||
class Error(pisi.Error):
|
||||
pass
|
||||
@@ -202,6 +204,11 @@ class Builder:
|
||||
|
||||
def set_environment_vars(self):
|
||||
"""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 = {
|
||||
"PKG_DIR": self.pkg_dir(),
|
||||
"WORK_DIR": self.pkg_work_dir(),
|
||||
|
||||
Reference in New Issue
Block a user