[yum-cvs] yum/yum repos.py,1.98,1.99 yumRepo.py,1.19,1.20
Menno Smits
mjs at linux.duke.edu
Sun Sep 3 21:34:58 UTC 2006
Update of /home/groups/yum/cvs/yum/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv3273/yum
Modified Files:
repos.py yumRepo.py
Log Message:
Allow the interrupt callback to be set via the API. Push the command line Yum's
own interrupt callback function out of the API code.
Index: repos.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/repos.py,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- repos.py 2 Sep 2006 07:47:27 -0000 1.98
+++ repos.py 3 Sep 2006 21:34:56 -0000 1.99
@@ -162,6 +162,10 @@
for repo in self.repos.values():
repo.setMirrorFailureObj(obj)
+ def setInterruptCallback(self, callback):
+ for repo in self.repos.values():
+ repo.setInterruptCallback(callback)
+
def getPackageSack(self):
return self.pkgSack
Index: yumRepo.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum/yumRepo.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- yumRepo.py 3 Sep 2006 21:11:05 -0000 1.19
+++ yumRepo.py 3 Sep 2006 21:34:56 -0000 1.20
@@ -165,8 +165,6 @@
self.storage = storagefactory.GetStorage()
self.sack = self.storage.GetPackageSack()
- self.last_interrupt_time = None
-
def __getProxyDict(self):
self.doProxyDict()
if self._proxy_dict:
@@ -329,26 +327,6 @@
self.grab = mgclass(self.grabfunc, self.urls,
failure_callback=self.mirror_failure_obj)
- def interrupt_callback(self, cb):
- '''Handle CTRL-C's during downloads
-
- If a CTRL-C occurs a URLGrabError will be raised to push the download
- onto the next mirror.
-
- If two CTRL-C's occur in quick succession then yum will exit.
-
- @param cb: urlgrabber callback obj
- '''
- now = time.time()
- if self.last_interrupt_time:
- if now - self.last_interrupt_time < 0.2:
- # Two quick CTRL-C's, quit
- raise KeyboardInterrupt
-
- # Go to next mirror
- self.last_interrupt_time = now
- raise URLGrabError(15, 'user interrupt')
-
def dirSetup(self):
"""make the necessary dirs, if possible, raise on failure"""
@@ -708,7 +686,8 @@
def setMirrorFailureObj(self, failure_obj):
self.mirror_failure_obj = failure_obj
-
+ def setInterruptCallback(self, callback):
+ self.interrupt_callback = callback
def getMirrorList(mirrorlist, pdict = None):
"""retrieve an up2date-style mirrorlist file from a url,
More information about the Yum-cvs-commits
mailing list