[master 01/11] modules: remove the hacks in setupPythonPath().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



instead, make the main anaconda script import everything through the
pyanaconda package.
---
 anaconda |   56 ++++++++++++++++++--------------------------------------
 1 files changed, 18 insertions(+), 38 deletions(-)

diff --git a/anaconda b/anaconda
index 7a74108..31ee1f6 100755
--- a/anaconda
+++ b/anaconda
@@ -87,7 +87,7 @@ def doStartupX11Actions():
         log.error("Unable to start the window manager.")
 
     if wm_pid is not None:
-        import xutils
+        import pyanaconda.xutils as xutils
 
         try:
             xutils.setRootResource('Xcursor.size', '24')
@@ -98,7 +98,7 @@ def doStartupX11Actions():
             xutils.setRootResource('Xft.hinting', '1')
             xutils.setRootResource('Xft.hintstyle', 'hintslight')
             xutils.setRootResource('Xft.rgba', 'none')
-        except:
+        except Exception as e:
             sys.stderr.write("X SERVER STARTED, THEN FAILED");
             raise RuntimeError, "X server failed to start"
 
@@ -243,28 +243,6 @@ def parseOptions(argv = None):
     return op.parse_args(argv)
 
 def setupPythonPath():
-    haveUpdates = False
-    for ndx in range(len(sys.path)-1, -1, -1):
-        if sys.path[ndx].endswith('updates'):
-            haveUpdates = True
-            break
-
-    # With anaconda being a real module this isn't strictly necessary, but
-    # setting up the path now prevents having to change every import line in
-    # anaconda.
-    from distutils.sysconfig import get_python_lib
-    d = get_python_lib(plat_specific=1)
-
-    if haveUpdates:
-        sys.path.insert(ndx+1, "/tmp/updates/pyanaconda" )
-        sys.path.insert(ndx+2, "%s/pyanaconda" % d)
-        sys.path.insert(ndx+3, "%s/pyanaconda/textw" % d)
-        sys.path.insert(ndx+4, "%s/pyanaconda/iw" % d)
-    else:
-        sys.path.insert(0, "%s/pyanaconda" % d)
-        sys.path.insert(1, "%s/pyanaconda/textw" % d)
-        sys.path.insert(2, "%s/pyanaconda/iw" % d)
-
     sys.path.append('/usr/share/system-config-date')
 
 def setupEnvironment():
@@ -405,7 +383,7 @@ def handleSshPw(anaconda):
     if not anaconda.ksdata:
         return
 
-    import users
+    import pyanaconda.users as users
     u = users.Users(anaconda)
 
     userdata = anaconda.ksdata.sshpw.dataList()
@@ -477,7 +455,7 @@ if __name__ == "__main__":
 
     # Set up logging as early as possible.
     import logging
-    import anaconda_log
+    import pyanaconda.anaconda_log as anaconda_log
     anaconda_log.init()
 
     log = logging.getLogger("anaconda")
@@ -488,7 +466,7 @@ if __name__ == "__main__":
         sys.exit(0)
 
     # pull this in to get product name and versioning
-    import product
+    import pyanaconda.product as product
 
     # this handles setting up updates for pypackages to minimize the set needed
     setupPythonUpdates()
@@ -496,14 +474,16 @@ if __name__ == "__main__":
     import isys
     isys.initLog()
 
-    import signal, string, iutil, time
+    import signal, string, time
     import warnings
-    import vnc
-    import users
-    import kickstart
-    import storage.storage_log
 
-    from flags import flags
+    import pyanaconda.iutil as iutil
+    import pyanaconda.vnc as vnc
+    import pyanaconda.users as users
+    import pyanaconda.kickstart as kickstart
+    import pyanaconda.storage.storage_log
+
+    from pyanaconda.flags import flags
 
     # the following makes me very sad. -- katzj
     # we have a slightly different set of udev rules in the second 
@@ -511,7 +491,7 @@ if __name__ == "__main__":
     # automatically, I don't know.  but we need to trigger so that we
     # have all the information about netdevs that we care about for 
     # NetworkManager in the udev database
-    from baseudev import udev_trigger, udev_settle
+    from pyanaconda.baseudev import udev_trigger, udev_settle
     udev_trigger("net")
     udev_settle()
     # and for added fun, once doesn't seem to be enough?  so we 
@@ -680,7 +660,7 @@ if __name__ == "__main__":
     if opts.rescue:
         anaconda.rescue = True
 
-        import rescue
+        import pyanaconda.rescue as rescue
 
         if anaconda.ksdata:
             anaconda.instClass.configure(anaconda)
@@ -805,7 +785,7 @@ if __name__ == "__main__":
             os.environ["DISPLAY"] = ":1"
             doStartupX11Actions()
             xserver_pid = proc.pid
-        except (OSError, RuntimeError):
+        except (OSError, RuntimeError) as e:
             stdoutLog.warning(" X startup failed, falling back to text mode")
             anaconda.displayMode = 't'
             graphical_failed = 1
@@ -834,7 +814,7 @@ if __name__ == "__main__":
     anaconda.instClass.configure(anaconda)
 
     # comment out the next line to make exceptions non-fatal
-    from exception import initExceptionHandling
+    from pyanaconda.exception import initExceptionHandling
     anaconda.mehConfig = initExceptionHandling(anaconda)
 
     # add our own additional signal handlers
@@ -884,7 +864,7 @@ if __name__ == "__main__":
         anaconda.keyboard.activate()
 
     if anaconda.ksdata:
-        import storage
+        import pyanaconda.storage as storage
         storage.storageInitialize(anaconda)
 
         # Now having initialized storage, we can apply all the other kickstart
-- 
1.7.0.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux