Greg Swallow wrote:
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
Yum-devel@linux.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel
It will work, but i like the attached patch better, please try it out.
Tim
### Eclipse Workspace Patch 1.0
#P yum-utils
Index: plugins/protect-packages/protect-packages.py
===================================================================
RCS file:
/home/groups/yum/cvs/yum-utils/plugins/protect-packages/protect-packages.py,v
retrieving revision 1.2
diff -u -r1.2 protect-packages.py
--- plugins/protect-packages/protect-packages.py 22 Jun 2007 16:01:23
-0000 1.2
+++ plugins/protect-packages/protect-packages.py 10 Jul 2007 06:41:07
-0000
@@ -34,14 +34,21 @@
"""
-from yum.plugins import TYPE_CORE, TYPE_INTERACTIVE, PluginYumExit
+from yum.plugins import TYPE_CORE, PluginYumExit, API_VERSION
import sys
import os
import string
import glob
-requires_api_version = '2.4'
-plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)
+requires_api_version = '2.1'
+
+if API_VERSION <= 2.3:
+ from yum.plugins import TYPE_INTERFACE
+ plugin_type = (TYPE_CORE, TYPE_INTERFACE)
+else:
+ from yum.plugins import TYPE_INTERACTIVE
+ plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)
+
def config_hook(conduit):
parser = conduit.getOptParser()
_______________________________________________
Yum-devel mailing list
Yum-devel@linux.duke.edu
https://lists.dulug.duke.edu/mailman/listinfo/yum-devel