Michael E Brown wrote:
> On Mon, Jul 09, 2007 at 10:35:53AM -0700, Greg Swallow wrote:
> > No luck...When using yum 2.4 (yum-2.4.3-4.el4.centos) I still get the
> error:
> >
> > "ImportError: cannot import name TYPE_INTERACTIVE"
> 
> You can trivially wrap each import in a try: ... except ImportError:...
> 
> Import the new names, and on import error, fall back to the old names.

Thanks for the pointer - the patch below makes works without error on
yum-2.4 and I don't have a box with yum-3.0 on it to test, but I assume it
would work with that as well.  

Greg

--- protect-packages.py.orig    2007-07-09 15:37:14.000000000 -0700
+++ protect-packages.py 2007-07-09 15:33:51.000000000 -0700
@@ -33,15 +33,20 @@
 use the --override-protection command-line option. 
 """
 
-
-from yum.plugins import TYPE_CORE, TYPE_INTERACTIVE, PluginYumExit
+try:
+    from yum.plugins import TYPE_CORE, TYPE_INTERACTIVE, PluginYumExit
+except ImportError:
+    from yum.plugins import TYPE_CORE, TYPE_INTERFACE, PluginYumExit
 import sys
 import os
 import string
 import glob
 
-requires_api_version = '2.4'
-plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)
+requires_api_version = '2.1'
+try:
+    plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)
+except NameError:
+    plugin_type = (TYPE_CORE, TYPE_INTERFACE)
 
 def config_hook(conduit):
     parser = conduit.getOptParser()

_______________________________________________
Yum-devel mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel

Reply via email to