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

[PATCH 02/13] Put /usr/lib*/python?.?/site-packages/anaconda at the front of PYTHONPATH.



This is only needed because I'm not going to change every import in anaconda
to say "from anaconda import blah".  There's well over two thousand of those
lines, and adjusting the path is much easier.
---
 anaconda |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/anaconda b/anaconda
index e1055ec..eab90ef 100755
--- a/anaconda
+++ b/anaconda
@@ -224,14 +224,20 @@ def setupPythonPath():
             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, '/usr/lib/anaconda')
-        sys.path.insert(ndx+2, '/usr/lib/anaconda/textw')
-        sys.path.insert(ndx+3, '/usr/lib/anaconda/iw')
+        sys.path.insert(ndx+1, "%s/anaconda" % d)
+        sys.path.insert(ndx+2, "%s/anaconda/textw" % d)
+        sys.path.insert(ndx+3, "%s/anaconda/iw" % d)
     else:
-        sys.path.insert(0, '/usr/lib/anaconda')
-        sys.path.insert(1, '/usr/lib/anaconda/textw')
-        sys.path.insert(2, '/usr/lib/anaconda/iw')
+        sys.path.insert(0, "%s/anaconda" % d)
+        sys.path.insert(1, "%s/anaconda/textw" % d)
+        sys.path.insert(2, "%s/anaconda/iw" % d)
 
     sys.path.append('/usr/share/system-config-date')
 
-- 
1.6.5.1


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