* fetch component in build_packages (fixes #856)

* CLI status() method sets xterm title
* add a close method to ui interface, and call it in api.finalize()
* build start message uses status()
This commit is contained in:
Eray Özkural
2005-11-22 12:52:39 +00:00
parent 8f6d4260d1
commit 51b1bb1579
5 changed files with 21 additions and 7 deletions
+1
View File
@@ -93,6 +93,7 @@ def finalize():
packagedb.finalize_db() packagedb.finalize_db()
pisi.sourcedb.finalize() pisi.sourcedb.finalize()
ctx.ui.debug('PISI API finalized') ctx.ui.debug('PISI API finalized')
ctx.ui.close()
ctx.initialized = False ctx.initialized = False
def list_upgradable(): def list_upgradable():
+3 -3
View File
@@ -165,8 +165,7 @@ class Builder:
def build(self): def build(self):
"""Build the package in one shot.""" """Build the package in one shot."""
ctx.ui.info(_("Building PISI source package: %s") % self.spec.source.name) ctx.ui.status(_("Building PISI source package: %s") % self.spec.source.name)
util.xterm_title(_("Building PISI source package: %s\n") % self.spec.source.name)
self.compile_action_script() self.compile_action_script()
@@ -584,6 +583,8 @@ class Builder:
from copy import deepcopy from copy import deepcopy
self.fetch_component() # bug 856
# Strip install directory before building .pisi packages. # Strip install directory before building .pisi packages.
self.strip_install_dir() self.strip_install_dir()
@@ -654,7 +655,6 @@ class Builder:
pkg.close() pkg.close()
os.chdir(c) os.chdir(c)
self.set_state("buildpackages") self.set_state("buildpackages")
util.xterm_title_reset()
ctx.ui.info(_("Done.")) ctx.ui.info(_("Done."))
if ctx.config.values.general.autoclean is True: if ctx.config.values.general.autoclean is True:
+5
View File
@@ -21,6 +21,7 @@ import pisi
import pisi.context as ctx import pisi.context as ctx
from pisi.ui import UI from pisi.ui import UI
import pisi.ui as ui import pisi.ui as ui
import pisi.util as util
from pisi.cli.colors import colorize from pisi.cli.colors import colorize
@@ -48,6 +49,9 @@ class CLI(UI):
def __init__(self, show_debug = False, show_verbose = False): def __init__(self, show_debug = False, show_verbose = False):
super(CLI, self).__init__(show_debug, show_verbose) super(CLI, self).__init__(show_debug, show_verbose)
def close(self):
util.xterm_title_reset()
def output(self, msg, err = False): def output(self, msg, err = False):
if type(msg)==type(unicode()): if type(msg)==type(unicode()):
msg = msg.encode('utf-8') msg = msg.encode('utf-8')
@@ -123,6 +127,7 @@ class CLI(UI):
def status(self, msg = None): def status(self, msg = None):
if msg: if msg:
self.output(colorize(msg + '\n', 'purple')) self.output(colorize(msg + '\n', 'purple'))
util.xterm_title(msg)
def notify(self, event, **keywords): def notify(self, event, **keywords):
if event == ui.installed: if event == ui.installed:
+4
View File
@@ -44,6 +44,10 @@ class UI(object):
def __init__(self, debuggy = False, verbose = False): def __init__(self, debuggy = False, verbose = False):
self.show_debug = debuggy self.show_debug = debuggy
self.show_verbose = verbose self.show_verbose = verbose
def close(self):
"cleanup stuff here"
pass
def set_verbose(self, flag): def set_verbose(self, flag):
self.show_verbose = flag self.show_verbose = flag
+8 -4
View File
@@ -137,11 +137,15 @@ def run_batch(cmd):
ctx.ui.error(_('Failed command: %s') % cmd + strlist(lines)) ctx.ui.error(_('Failed command: %s') % cmd + strlist(lines))
return (successful,lines) return (successful,lines)
######################
# Terminal functions #
######################
def has_xterm():
return os.environ.has_key("TERM") and sys.stderr.isatty()
def xterm_title(message): def xterm_title(message):
"""sets message as a console window's title""" """sets message as a console window's title"""
return
#TODO: the last thing needed in util probably
#this is going to be moved to pisi.cli later
if os.environ.has_key("TERM") and sys.stderr.isatty(): if os.environ.has_key("TERM") and sys.stderr.isatty():
terminalType = os.environ["TERM"] terminalType = os.environ["TERM"]
for term in ["xterm", "Eterm", "aterm", "rxvt", "screen", "kterm", "rxvt-unicode"]: for term in ["xterm", "Eterm", "aterm", "rxvt", "screen", "kterm", "rxvt-unicode"]:
@@ -152,11 +156,11 @@ def xterm_title(message):
def xterm_title_reset(): def xterm_title_reset():
"""resets console window's title""" """resets console window's title"""
#TODO: this, too.
if os.environ.has_key("TERM"): if os.environ.has_key("TERM"):
terminalType = os.environ["TERM"] terminalType = os.environ["TERM"]
xterm_title(os.environ["TERM"]) xterm_title(os.environ["TERM"])
############################# #############################
# Path Processing Functions # # Path Processing Functions #
############################# #############################