summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-06-05 19:13:20 +0200
committerJulian Andres Klode <jak@debian.org>2009-06-05 19:13:20 +0200
commit994a13b252f97f6ae77872b5d5118ac1366b2a24 (patch)
tree97fe2697ee2b2c5357375b85c6617417a9e262a6
parentb67d9c0abebee2a3e7f09ddccb357f633ee3ec00 (diff)
downloadpython-apt-994a13b252f97f6ae77872b5d5118ac1366b2a24.tar.gz
python/progress.cc, apt/progress/*.py: Use PEP 8 naming conventions for progress
This changes the progress classes to use PEP 8 names. Due to the concept of the deprecation system, this causes methods of subclasses not to be called at all. If a class implements a command with underscores, it is called. If the class also implements the version in mixedCase, this is ignored. This means that all subclasses will not work correctly, because only the method from the parent class is called.
-rw-r--r--apt/deprecation.py2
-rw-r--r--apt/progress/__init__.py133
-rw-r--r--apt/progress/gtk2.py52
-rw-r--r--python/progress.cc81
4 files changed, 184 insertions, 84 deletions
diff --git a/apt/deprecation.py b/apt/deprecation.py
index 6827a8b9..0f39ad63 100644
--- a/apt/deprecation.py
+++ b/apt/deprecation.py
@@ -67,7 +67,7 @@ def function_deprecated_by(func, convert_names=True):
This function also converts all keyword argument names from mixedCase to
lowercase_with_underscores, but only if 'convert_names' is True (default).
"""
- warning = 'Deprecated, please use \'%s\' instead' % func.__name__
+ warning = 'Deprecated, please use \'%s()\' instead' % func.__name__
def deprecated_function(*args, **kwds):
"""Wrapper around a deprecated function."""
diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py
index d2a9d497..6e4c6eec 100644
--- a/apt/progress/__init__.py
+++ b/apt/progress/__init__.py
@@ -33,6 +33,7 @@ import select
import sys
import apt_pkg
+from apt.deprecation import AttributeDeprecatedBy, function_deprecated_by
__all__ = ('CdromProgress', 'DpkgInstallProgress', 'DumbInstallProgress',
@@ -48,7 +49,7 @@ class OpProgress(object):
def __init__(self):
self.op = None
- self.subOp = None
+ self.sub_op = None
def update(self, percent):
"""Called periodically to update the user interface."""
@@ -56,6 +57,9 @@ class OpProgress(object):
def done(self):
"""Called once an operation has been completed."""
+ if apt_pkg._COMPAT_0_7:
+ subOp = AttributeDeprecatedBy('sub_op')
+
class OpTextProgress(OpProgress):
"""A simple text based cache open reporting class."""
@@ -65,7 +69,7 @@ class OpTextProgress(OpProgress):
def update(self, percent):
"""Called periodically to update the user interface."""
- sys.stdout.write("\r%s: %.2i " % (self.subOp, percent))
+ sys.stdout.write("\r%s: %.2i " % (self.sub_op, percent))
sys.stdout.flush()
def done(self):
@@ -80,26 +84,26 @@ class FetchProgress(object):
"""
# download status constants
- dlDone = 0
- dlQueued = 1
- dlFailed = 2
- dlHit = 3
- dlIgnored = 4
- dlStatusStr = {dlDone: "Done",
- dlQueued: "Queued",
- dlFailed: "Failed",
- dlHit: "Hit",
- dlIgnored: "Ignored"}
+ dl_done = 0
+ dl_queued = 1
+ dl_failed = 2
+ dl_hit = 3
+ dl_ignored = 4
+ dl_status_str = {dl_done: "Done",
+ dl_queued: "Queued",
+ dl_failed: "Failed",
+ dl_hit: "Hit",
+ dl_ignored: "Ignored"}
def __init__(self):
self.eta = 0.0
self.percent = 0.0
# Make checking easier
- self.currentBytes = 0
- self.currentItems = 0
- self.totalBytes = 0
- self.totalItems = 0
- self.currentCPS = 0
+ self.current_bytes = 0
+ self.current_items = 0
+ self.total_bytes = 0
+ self.total_items = 0
+ self.current_cps = 0
def start(self):
"""Called when the fetching starts."""
@@ -107,7 +111,7 @@ class FetchProgress(object):
def stop(self):
"""Called when all files have been fetched."""
- def updateStatus(self, uri, descr, shortDescr, status):
+ def update_status(self, uri, descr, short_descr, status):
"""Called when the status of an item changes.
This happens eg. when the downloads fails or is completed.
@@ -118,16 +122,31 @@ class FetchProgress(object):
Return True to continue or False to cancel.
"""
- self.percent = (((self.currentBytes + self.currentItems) * 100.0) /
- float(self.totalBytes + self.totalItems))
- if self.currentCPS > 0:
- self.eta = ((self.totalBytes - self.currentBytes) /
- float(self.currentCPS))
+ self.percent = (((self.current_bytes + self.current_items) * 100.0) /
+ float(self.total_bytes + self.total_items))
+ if self.current_cps > 0:
+ self.eta = ((self.total_bytes - self.current_bytes) /
+ float(self.current_cps))
return True
- def mediaChange(self, medium, drive):
+ def media_change(self, medium, drive):
"""react to media change events."""
+ if apt_pkg._COMPAT_0_7:
+ dlDone = AttributeDeprecatedBy('dl_done')
+ dlQueued = AttributeDeprecatedBy('dl_queued')
+ dlFailed = AttributeDeprecatedBy('dl_failed')
+ dlHit = AttributeDeprecatedBy('dl_hit')
+ dlIgnored = AttributeDeprecatedBy('dl_ignored')
+ dlStatusStr = AttributeDeprecatedBy('dl_status_str')
+ currentBytes = AttributeDeprecatedBy('current_bytes')
+ currentItems = AttributeDeprecatedBy('current_items')
+ totalBytes = AttributeDeprecatedBy('total_bytes')
+ totalItems = AttributeDeprecatedBy('total_items')
+ currentCPS = AttributeDeprecatedBy('current_cps')
+ updateStatus = function_deprecated_by(update_status)
+ mediaChange = function_deprecated_by(media_change)
+
class TextFetchProgress(FetchProgress):
""" Ready to use progress object for terminal windows """
@@ -136,13 +155,13 @@ class TextFetchProgress(FetchProgress):
FetchProgress.__init__(self)
self.items = {}
- def updateStatus(self, uri, descr, shortDescr, status):
+ def update_status(self, uri, descr, short_descr, status):
"""Called when the status of an item changes.
This happens eg. when the downloads fails or is completed.
"""
- if status != self.dlQueued:
- print "\r%s %s" % (self.dlStatusStr[status], descr)
+ if status != self.dl_queued:
+ print "\r%s %s" % (self.dl_status_str[status], descr)
self.items[uri] = status
def pulse(self):
@@ -151,10 +170,10 @@ class TextFetchProgress(FetchProgress):
Return True to continue or False to cancel.
"""
FetchProgress.pulse(self)
- if self.currentCPS > 0:
+ if self.current_cps > 0:
s = "[%2.f%%] %sB/s %s" % (self.percent,
- apt_pkg.size_to_str(int(self.currentCPS)),
- apt_pkg.time_to_str(int(self.eta)))
+ apt_pkg.size_to_str(int(self.current_cps)),
+ apt_pkg.time_to_str(int(self.eta)))
else:
s = "%2.f%% [Working]" % (self.percent)
print "\r%s" % (s),
@@ -165,13 +184,17 @@ class TextFetchProgress(FetchProgress):
"""Called when all files have been fetched."""
print "\rDone downloading "
- def mediaChange(self, medium, drive):
+ def media_change(self, medium, drive):
"""react to media change events."""
print ("Media change: please insert the disc labeled "
"'%s' in the drive '%s' and press enter") % (medium, drive)
return raw_input() not in ('c', 'C')
+ if apt_pkg._COMPAT_0_7:
+ updateStatus = function_deprecated_by(update_status)
+ mediaChange = function_deprecated_by(media_change)
+
class DumbInstallProgress(object):
"""Report the install progress.
@@ -179,19 +202,24 @@ class DumbInstallProgress(object):
Subclass this class to implement install progress reporting.
"""
- def startUpdate(self):
+ def start_update(self):
"""Start update."""
def run(self, pm):
"""Start installation."""
return pm.do_install()
- def finishUpdate(self):
+ def finish_update(self):
"""Called when update has finished."""
- def updateInterface(self):
+ def update_interface(self):
"""Called periodically to update the user interface"""
+ if apt_pkg._COMPAT_0_7:
+ startUpdate = function_deprecated_by(start_update)
+ finishUpdate = function_deprecated_by(finish_update)
+ updateInterface = function_deprecated_by(update_interface)
+
class InstallProgress(DumbInstallProgress):
"""An InstallProgress that is pretty useful.
@@ -202,7 +230,7 @@ class InstallProgress(DumbInstallProgress):
def __init__(self):
DumbInstallProgress.__init__(self)
- self.selectTimeout = 0.1
+ self.select_timeout = 0.1
(read, write) = os.pipe()
self.writefd = write
self.statusfd = os.fdopen(read, "r")
@@ -217,10 +245,10 @@ class InstallProgress(DumbInstallProgress):
def conffile(self, current, new):
"""Called when a conffile question from dpkg is detected."""
- def statusChange(self, pkg, percent, status):
+ def status_change(self, pkg, percent, status):
"""Called when the status changed."""
- def updateInterface(self):
+ def update_interface(self):
"""Called periodically to update the interface."""
if self.statusfd is None:
return
@@ -253,7 +281,7 @@ class InstallProgress(DumbInstallProgress):
self.conffile(match.group(1), match.group(2))
elif status == "pmstatus":
if float(percent) != self.percent or status_str != self.status:
- self.statusChange(pkg, float(percent),
+ self.status_change(pkg, float(percent),
status_str.strip())
self.percent = float(percent)
self.status = status_str.strip()
@@ -263,11 +291,11 @@ class InstallProgress(DumbInstallProgress):
"""Fork."""
return os.fork()
- def waitChild(self):
+ def wait_child(self):
"""Wait for child progress to exit."""
while True:
- select.select([self.statusfd], [], [], self.selectTimeout)
- self.updateInterface()
+ select.select([self.statusfd], [], [], self.select_timeout)
+ self.update_interface()
(pid, res) = os.waitpid(self.child_pid, os.WNOHANG)
if pid == self.child_pid:
break
@@ -281,9 +309,15 @@ class InstallProgress(DumbInstallProgress):
res = pm.do_install(self.writefd)
os._exit(res)
self.child_pid = pid
- res = self.waitChild()
+ res = self.wait_child()
return os.WEXITSTATUS(res)
+ if apt_pkg._COMPAT_0_7:
+ selectTimeout = AttributeDeprecatedBy('select_timeout')
+ statusChange = function_deprecated_by(status_change)
+ waitChild = function_deprecated_by(wait_child)
+ updateInterface = function_deprecated_by(update_interface)
+
class CdromProgress(object):
"""Report the cdrom add progress.
@@ -297,12 +331,16 @@ class CdromProgress(object):
def update(self, text, step):
"""Called periodically to update the user interface."""
- def askCdromName(self):
+ def ask_cdrom_name(self):
"""Called to ask for the name of the cdrom."""
- def changeCdrom(self):
+ def change_cdrom(self):
"""Called to ask for the cdrom to be changed."""
+ if apt_pkg._COMPAT_0_7:
+ askCdromName = function_deprecated_by(ask_cdrom_name)
+ changeCdrom = function_deprecated_by(change_cdrom)
+
class DpkgInstallProgress(InstallProgress):
"""Progress handler for a local Debian package installation."""
@@ -318,10 +356,10 @@ class DpkgInstallProgress(InstallProgress):
(self.writefd, self.debfile))
os._exit(os.WEXITSTATUS(res))
self.child_pid = pid
- res = self.waitChild()
+ res = self.wait_child()
return res
- def updateInterface(self):
+ def update_interface(self):
"""Process status messages from dpkg."""
if self.statusfd is None:
return
@@ -354,3 +392,6 @@ class DpkgInstallProgress(InstallProgress):
else:
self.status = status
self.read = ""
+
+ if apt_pkg._COMPAT_0_7:
+ updateInterface = function_deprecated_by(update_interface)
diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py
index 06ece2d5..c0c05426 100644
--- a/apt/progress/gtk2.py
+++ b/apt/progress/gtk2.py
@@ -39,6 +39,7 @@ import vte
import apt
import apt_pkg
+from apt.deprecation import function_deprecated_by
def mksig(params=(), run=gobject.SIGNAL_RUN_FIRST, rettype=gobject.TYPE_NONE):
@@ -113,13 +114,13 @@ class GInstallProgress(gobject.GObject, apt.progress.InstallProgress):
self.time_last_update = time.time()
self.term = term
reaper = vte.reaper_get()
- reaper.connect("child-exited", self.childExited)
+ reaper.connect("child-exited", self.child_exited)
self.env = ["VTE_PTY_KEEP_FD=%s" % self.writefd,
"DEBIAN_FRONTEND=gnome",
"APT_LISTCHANGES_FRONTEND=gtk"]
self._context = glib.main_context_default()
- def childExited(self, term, pid, status):
+ def child_exited(self, term, pid, status):
"""Called when a child process exits"""
self.apt_status = os.WEXITSTATUS(status)
self.finished = True
@@ -138,21 +139,21 @@ class GInstallProgress(gobject.GObject, apt.progress.InstallProgress):
"""
self.emit("status-conffile")
- def startUpdate(self):
+ def start_update(self):
"""Called when the update starts.
Emits: status-started()
"""
self.emit("status-started")
- def finishUpdate(self):
+ def finish_update(self):
"""Called when the update finished.
Emits: status-finished()
"""
self.emit("status-finished")
- def statusChange(self, pkg, percent, status):
+ def status_change(self, pkg, percent, status):
"""Called when the status changed.
Emits: status-changed(status, percent)
@@ -160,12 +161,12 @@ class GInstallProgress(gobject.GObject, apt.progress.InstallProgress):
self.time_last_update = time.time()
self.emit("status-changed", status, percent)
- def updateInterface(self):
+ def update_interface(self):
"""Called periodically to update the interface.
Emits: status-timeout() [When a timeout happens]
"""
- apt.progress.InstallProgress.updateInterface(self)
+ apt.progress.InstallProgress.update_interface(self)
while self._context.pending():
self._context.iteration()
if self.time_last_update + self.INSTALL_TIMEOUT < time.time():
@@ -175,12 +176,20 @@ class GInstallProgress(gobject.GObject, apt.progress.InstallProgress):
"""Fork the process."""
return self.term.forkpty(envv=self.env)
- def waitChild(self):
+ def wait_child(self):
"""Wait for the child process to exit."""
while not self.finished:
- self.updateInterface()
+ self.update_interface()
return self.apt_status
+ if apt_pkg._COMPAT_0_7:
+ updateInterface = function_deprecated_by(update_interface)
+ startUpdate = function_deprecated_by(start_update)
+ finishUpdate = function_deprecated_by(finish_update)
+ statusChange = function_deprecated_by(status_change)
+ waitChild = function_deprecated_by(wait_child)
+ childExited = function_deprecated_by(child_exited)
+
class GDpkgInstallProgress(apt.progress.DpkgInstallProgress, GInstallProgress):
"""An InstallProgress for local installations.
@@ -199,14 +208,17 @@ class GDpkgInstallProgress(apt.progress.DpkgInstallProgress, GInstallProgress):
"""Install the given package."""
apt.progress.DpkgInstallProgress.run(self, debfile)
- def updateInterface(self):
+ def update_interface(self):
"""Called periodically to update the interface.
Emits: status-timeout() [When a timeout happens]"""
- apt.progress.DpkgInstallProgress.updateInterface(self)
+ apt.progress.DpkgInstallProgress.update_interface(self)
if self.time_last_update + self.INSTALL_TIMEOUT < time.time():
self.emit("status-timeout")
+ if apt_pkg._COMPAT_0_7:
+ updateInterface = function_deprecated_by(update_interface)
+
class GFetchProgress(gobject.GObject, apt.progress.FetchProgress):
"""A Fetch Progress with GObject signals.
@@ -239,19 +251,19 @@ class GFetchProgress(gobject.GObject, apt.progress.FetchProgress):
def pulse(self):
apt.progress.FetchProgress.pulse(self)
- currentItem = self.currentItems + 1
- if currentItem > self.totalItems:
- currentItem = self.totalItems
- if self.currentCPS > 0:
+ current_item = self.current_items + 1
+ if current_item > self.total_items:
+ current_item = self.total_items
+ if self.current_cps > 0:
text = (_("Downloading file %(current)li of %(total)li with "
"%(speed)s/s") % \
- {"current": currentItem,
- "total": self.totalItems,
- "speed": apt_pkg.size_to_str(self.currentCPS)})
+ {"current": current_item,
+ "total": self.total_items,
+ "speed": apt_pkg.size_to_str(self.current_cps)})
else:
text = (_("Downloading file %(current)li of %(total)li") % \
- {"current": currentItem,
- "total": self.totalItems})
+ {"current": current_item,
+ "total": self.total_items})
self.emit("status-changed", text, self.percent)
while self._context.pending():
self._context.iteration()
diff --git a/python/progress.cc b/python/progress.cc
index bec40ce9..8214a789 100644
--- a/python/progress.cc
+++ b/python/progress.cc
@@ -12,7 +12,6 @@
#include <apt-pkg/acquire-item.h>
#include "progress.h"
-
// generic
bool PyCallbackObj::RunSimpleCallback(const char* method_name,
PyObject *arglist,
@@ -58,10 +57,16 @@ void PyOpProgress::Update()
PyObject_SetAttrString(callbackInst, "op", o);
Py_XDECREF(o);
o = Py_BuildValue("s", SubOp.c_str());
- PyObject_SetAttrString(callbackInst, "subOp", o);
+ if(PyObject_HasAttrString(callbackInst, "sub_op"))
+ PyObject_SetAttrString(callbackInst, "sub_op", o);
+ else
+ PyObject_SetAttrString(callbackInst, "subOp", o);
Py_XDECREF(o);
o = Py_BuildValue("b", MajorChange);
- PyObject_SetAttrString(callbackInst, "majorChange", o);
+ if(PyObject_HasAttrString(callbackInst, "major_change"))
+ PyObject_SetAttrString(callbackInst, "major_change", o);
+ else
+ PyObject_SetAttrString(callbackInst, "majorChange", o);
Py_XDECREF(o);
// Build up the argument list...
@@ -89,7 +94,10 @@ bool PyFetchProgress::MediaChange(string Media, string Drive)
//std::cout << "MediaChange" << std::endl;
PyObject *arglist = Py_BuildValue("(ss)", Media.c_str(), Drive.c_str());
PyObject *result;
- RunSimpleCallback("mediaChange", arglist, &result);
+ if(PyObject_HasAttrString(callbackInst, "media_change"))
+ RunSimpleCallback("media_change", arglist, &result);
+ else
+ RunSimpleCallback("mediaChange", arglist, &result);
bool res = true;
if(!PyArg_Parse(result, "b", &res))
@@ -105,7 +113,10 @@ void PyFetchProgress::UpdateStatus(pkgAcquire::ItemDesc &Itm, int status)
{
//std::cout << "UpdateStatus: " << Itm.URI << " " << status << std::endl;
PyObject *arglist = Py_BuildValue("(sssi)", Itm.URI.c_str(), Itm.Description.c_str(), Itm.ShortDesc.c_str(), status);
- RunSimpleCallback("updateStatus", arglist);
+ if(PyObject_HasAttrString(callbackInst, "update_status"))
+ RunSimpleCallback("update_status", arglist);
+ else
+ RunSimpleCallback("updateStatus", arglist);
}
void PyFetchProgress::IMSHit(pkgAcquire::ItemDesc &Itm)
@@ -163,19 +174,34 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
// set stats
PyObject *o;
o = Py_BuildValue("f", CurrentCPS);
- PyObject_SetAttrString(callbackInst, "currentCPS", o);
+ if(PyObject_HasAttrString(callbackInst, "current_cps"))
+ PyObject_SetAttrString(callbackInst, "current_cps", o);
+ else
+ PyObject_SetAttrString(callbackInst, "currentCPS", o);
Py_XDECREF(o);
o = Py_BuildValue("f", CurrentBytes);
- PyObject_SetAttrString(callbackInst, "currentBytes", o);
+ if(PyObject_HasAttrString(callbackInst, "current_bytes"))
+ PyObject_SetAttrString(callbackInst, "current_bytes", o);
+ else
+ PyObject_SetAttrString(callbackInst, "currentBytes", o);
Py_XDECREF(o);
o = Py_BuildValue("i", CurrentItems);
- PyObject_SetAttrString(callbackInst, "currentItems", o);
+ if(PyObject_HasAttrString(callbackInst, "current_items"))
+ PyObject_SetAttrString(callbackInst, "current_items", o);
+ else
+ PyObject_SetAttrString(callbackInst, "currentItems", o);
Py_XDECREF(o);
o = Py_BuildValue("i", TotalItems);
- PyObject_SetAttrString(callbackInst, "totalItems", o);
+ if(PyObject_HasAttrString(callbackInst, "total_items"))
+ PyObject_SetAttrString(callbackInst, "total_items", o);
+ else
+ PyObject_SetAttrString(callbackInst, "totalItems", o);
Py_XDECREF(o);
o = Py_BuildValue("f", TotalBytes);
- PyObject_SetAttrString(callbackInst, "totalBytes", o);
+ if(PyObject_HasAttrString(callbackInst, "total_bytes"))
+ PyObject_SetAttrString(callbackInst, "total_bytes", o);
+ else
+ PyObject_SetAttrString(callbackInst, "totalBytes", o);
Py_XDECREF(o);
PyObject *arglist = Py_BuildValue("()");
@@ -201,17 +227,26 @@ bool PyFetchProgress::Pulse(pkgAcquire * Owner)
void PyInstallProgress::StartUpdate()
{
- RunSimpleCallback("startUpdate");
+ if(PyObject_HasAttrString(callbackInst, "start_update"))
+ RunSimpleCallback("start_update");
+ else
+ RunSimpleCallback("startUpdate");
}
void PyInstallProgress::UpdateInterface()
{
- RunSimpleCallback("updateInterface");
+ if(PyObject_HasAttrString(callbackInst, "update_interface"))
+ RunSimpleCallback("update_interface");
+ else
+ RunSimpleCallback("updateInterface");
}
void PyInstallProgress::FinishUpdate()
{
- RunSimpleCallback("finishUpdate");
+ if(PyObject_HasAttrString(callbackInst, "finish_update"))
+ RunSimpleCallback("finish_update");
+ else
+ RunSimpleCallback("finishUpdate");
}
pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
@@ -272,8 +307,13 @@ pkgPackageManager::OrderResult PyInstallProgress::Run(pkgPackageManager *pm)
StartUpdate();
- if(PyObject_HasAttrString(callbackInst, "waitChild")) {
- PyObject *method = PyObject_GetAttrString(callbackInst, "waitChild");
+ if(PyObject_HasAttrString(callbackInst, "waitChild") ||
+ PyObject_HasAttrString(callbackInst, "wait_child")) {
+ PyObject *method;
+ if (PyObject_HasAttrString(callbackInst, "wait_child"))
+ method = PyObject_GetAttrString(callbackInst, "wait_child");
+ else
+ method = PyObject_GetAttrString(callbackInst, "waitChild");
//std::cerr << "custom waitChild found" << std::endl;
PyObject *arglist = Py_BuildValue("(i)",child_id);
PyObject *result = PyEval_CallObject(method, arglist);
@@ -323,7 +363,10 @@ bool PyCdromProgress::ChangeCdrom()
{
PyObject *arglist = Py_BuildValue("()");
PyObject *result;
- RunSimpleCallback("changeCdrom", arglist, &result);
+ if(PyObject_HasAttrString(callbackInst, "change_cdrom"))
+ RunSimpleCallback("change_cdrom", arglist, &result);
+ else
+ RunSimpleCallback("changeCdrom", arglist, &result);
bool res = true;
if(!PyArg_Parse(result, "b", &res))
@@ -337,7 +380,11 @@ bool PyCdromProgress::AskCdromName(string &Name)
{
PyObject *arglist = Py_BuildValue("()");
PyObject *result;
- RunSimpleCallback("askCdromName", arglist, &result);
+
+ if(PyObject_HasAttrString(callbackInst, "ask_cdrom_name"))
+ RunSimpleCallback("ask_cdrom_name", arglist, &result);
+ else
+ RunSimpleCallback("askCdromName", arglist, &result);
const char *new_name;
bool res;