locals, globals -> localSymbols, globalSymbols [ keywords ], removed unused imports ve cosmetic changes from Yoda
This commit is contained in:
+23
-23
@@ -9,10 +9,8 @@ import sys
|
|||||||
import util
|
import util
|
||||||
from ui import ui
|
from ui import ui
|
||||||
from constants import const
|
from constants import const
|
||||||
from config import config
|
|
||||||
from sourcearchive import SourceArchive
|
from sourcearchive import SourceArchive
|
||||||
from files import Files, FileInfo
|
from files import Files, FileInfo
|
||||||
from specfile import SpecFile
|
|
||||||
from metadata import MetaData
|
from metadata import MetaData
|
||||||
from package import Package
|
from package import Package
|
||||||
|
|
||||||
@@ -87,7 +85,8 @@ class PisiBuild:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
specdir = os.path.dirname(self.ctx.pspecfile)
|
specdir = os.path.dirname(self.ctx.pspecfile)
|
||||||
self.actionScript = open("/".join([specdir,const.actions_file])).read()
|
self.actionScript = open("/".join([specdir, \
|
||||||
|
const.actions_file])).read()
|
||||||
except IOError, e:
|
except IOError, e:
|
||||||
ui.error ("Action Script: %s\n" % e)
|
ui.error ("Action Script: %s\n" % e)
|
||||||
return
|
return
|
||||||
@@ -96,21 +95,22 @@ class PisiBuild:
|
|||||||
#finished its work in the work_dir
|
#finished its work in the work_dir
|
||||||
curDir = os.getcwd()
|
curDir = os.getcwd()
|
||||||
|
|
||||||
locals = globals = {}
|
localSymbols = globalSymbols = {}
|
||||||
# Set needed evironment variables for actions API
|
# Set needed evironment variables for actions API
|
||||||
self.setEnvorinment()
|
self.setEnvorinment()
|
||||||
try:
|
try:
|
||||||
exec compile(self.actionScript , "error", "exec") in locals,globals
|
exec compile(self.actionScript , "error", "exec") in localSymbols, \
|
||||||
|
globalSymbols
|
||||||
except SyntaxError, e:
|
except SyntaxError, e:
|
||||||
ui.error ("Error : %s\n" % e)
|
ui.error ("Error : %s\n" % e)
|
||||||
return
|
return
|
||||||
# Go to source directory
|
# Go to source directory
|
||||||
self.gotoSrcDir(globals)
|
self.gotoSrcDir(globalSymbols)
|
||||||
|
|
||||||
# Run configure, build and install phase
|
# Run configure, build and install phase
|
||||||
self.configureSource(locals)
|
self.configureSource(localSymbols)
|
||||||
self.buildSource(locals)
|
self.buildSource(localSymbols)
|
||||||
self.installSource(locals)
|
self.installSource(localSymbols)
|
||||||
|
|
||||||
os.chdir(curDir)
|
os.chdir(curDir)
|
||||||
# after all, we are ready to build/prepare the packages
|
# after all, we are ready to build/prepare the packages
|
||||||
@@ -145,43 +145,43 @@ class PisiBuild:
|
|||||||
}
|
}
|
||||||
os.environ.update(evn)
|
os.environ.update(evn)
|
||||||
|
|
||||||
def gotoSrcDir(self, globals):
|
def gotoSrcDir(self, globalSymbols):
|
||||||
"""Changes the current working directory to package_work_dir() for
|
"""Changes the current working directory to package_work_dir() for
|
||||||
actions.py to do its work."""
|
actions.py to do its work."""
|
||||||
if 'WorkDir' in globals:
|
if 'WorkDir' in globalSymbols:
|
||||||
path = os.path.join(self.ctx.pkg_work_dir(), globals['WorkDir'])
|
path = os.path.join(self.ctx.pkg_work_dir(), globalSymbols['WorkDir'])
|
||||||
else:
|
else:
|
||||||
path = os.path.join(self.ctx.pkg_work_dir(), self.spec.source.name + "-" + self.spec.source.version)
|
path = os.path.join(self.ctx.pkg_work_dir(), self.spec.source.name \
|
||||||
|
+ "-" + self.spec.source.version)
|
||||||
try:
|
try:
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
except OSError, e:
|
except OSError, e:
|
||||||
ui.error ("No such file or directory: %s\n" % e)
|
ui.error ("No such file or directory: %s\n" % e)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
def configureSource(self, locals):
|
def configureSource(self, localSymbols):
|
||||||
"""Calls the corresponding function in actions.py. This time its
|
"""Calls the corresponding function in actions.py. This time its
|
||||||
const.setup_func which sets up the source tree for building.
|
const.setup_func which sets up the source tree for building.
|
||||||
|
|
||||||
setup_func is optional in actions.py. If its present it will
|
setup_func is optional in actions.py. If its present it will
|
||||||
be called, if not nothing will be done."""
|
be called, if not nothing will be done."""
|
||||||
func = const.setup_func
|
func = const.setup_func
|
||||||
if func in locals:
|
if func in localSymbols:
|
||||||
ui.info("Configuring %s...\n" % self.spec.source.name)
|
ui.info("Configuring %s...\n" % self.spec.source.name)
|
||||||
locals[func]()
|
localSymbols[func]()
|
||||||
|
|
||||||
def buildSource(self, locals):
|
def buildSource(self, localSymbols):
|
||||||
"""Calls the corresponding function in actions.py. This time its
|
"""Calls the corresponding function in actions.py. This time its
|
||||||
const.build_func which builds the source.
|
const.build_func which builds the source.
|
||||||
|
|
||||||
build_func is optional in actions.py. If its present it will
|
build_func is optional in actions.py. If its present it will
|
||||||
be called, if not nothing will be done."""
|
be called, if not nothing will be done."""
|
||||||
func = const.build_func
|
func = const.build_func
|
||||||
if func in locals:
|
if func in localSymbols:
|
||||||
ui.info("Building %s...\n" % self.spec.source.name)
|
ui.info("Building %s...\n" % self.spec.source.name)
|
||||||
locals[func]()
|
localSymbols[func]()
|
||||||
|
|
||||||
def installSource(self, locals):
|
def installSource(self, localSymbols):
|
||||||
"""Calls the corresponding function in actions.py. This time its
|
"""Calls the corresponding function in actions.py. This time its
|
||||||
const.install_func which will install the build source.
|
const.install_func which will install the build source.
|
||||||
|
|
||||||
@@ -189,8 +189,8 @@ class PisiBuild:
|
|||||||
be called, if not package building process will _fail_."""
|
be called, if not package building process will _fail_."""
|
||||||
func = const.install_func
|
func = const.install_func
|
||||||
ui.info("Installing %s...\n" % self.spec.source.name)
|
ui.info("Installing %s...\n" % self.spec.source.name)
|
||||||
if func in locals:
|
if func in localSymbols:
|
||||||
locals[func]()
|
localSymbols[func]()
|
||||||
else:
|
else:
|
||||||
raise PisiBuildError, "install function is not defined in actions.py!"
|
raise PisiBuildError, "install function is not defined in actions.py!"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user