[PATCH] Fix a problem where urllib2 is not getting pulled into the initrd.

Chris Lumens clumens at redhat.com
Thu Sep 11 21:01:41 UTC 2014


python-six is too clever and quietly converts urllib imports into urllib2
imports, but in such a way that python-deps doesn't pick up on that fact.
Thus, urllib2 is not in the initrd and kickstart installs hit a traceback
when attempting to fetch the ks file.  The result is either a regular
interactive install or staring at a dracut prompt, depending on what else
you are doing.

There may be more of this in the future.
---
 dracut/python-deps | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/dracut/python-deps b/dracut/python-deps
index e626ff4..3ebb602 100755
--- a/dracut/python-deps
+++ b/dracut/python-deps
@@ -9,6 +9,8 @@ from distutils.sysconfig import *
 sitedir = get_python_lib()
 libdir = get_config_var('LIBDEST')
 
+alsoNeeded = { libdir+"/urllib.py": libdir+"/urllib2.py" }
+
 # A couple helper functions...
 def moduledir(pyfile):
     '''Given a python file, return the module dir it belongs to, or None.'''
@@ -33,7 +35,7 @@ deps = []
 for script in sys.argv[1:]:
     finder = ModuleFinder()
     finder.run_script(script) # parse the script
-    for name, mod in finder.modules.iteritems():
+    for mod in finder.modules.itervalues():
         if not mod.__file__: # this module is builtin, so we can skip it
             continue
 
@@ -45,6 +47,9 @@ for script in sys.argv[1:]:
             deps += list(pyfiles(moddir)) # ...get the whole module
             mods.append(moddir)
 
+        if mod.__file__ in alsoNeeded:
+            deps.append(alsoNeeded[mod.__file__])
+
 # Include some bits that the python install itself needs
 print(get_makefile_filename())
 print(get_config_h_filename())
-- 
1.9.3



More information about the anaconda-patches mailing list