Ticket #445: symlinkPatch.txt

File symlinkPatch.txt, 1.1 kB (added by eolson, 13 months ago)

Patch to check for symlinked files in install prefix.

Line 
1--- config.py   2009-06-29 08:06:09.000000000 -0500
2+++ config1.py  2009-06-30 23:33:34.000000000 -0500
3@@ -107,6 +107,27 @@
4         installprefix = p
5         break
6 
7+if installprefix=="/":
8+    # Installation not found yet, check for symlinked install.
9+    #   e.g. Check if a /usr/... install is a symbolic link to /media/card/...
10+
11+    separatedFilePath = __file__.split(os.sep)
12+    for i in range(2,len(separatedFilePath)):
13+        sepShortFilePath = [""] + separatedFilePath[i:]
14+        shortFilePath = os.sep.join(sepShortFilePath)
15+        #logging.debug( "Installprefix check comparing %s, %s" % (shortFilePath, __file__) )
16+
17+        # Symbolic link check
18+        if os.path.islink(shortFilePath) and os.path.samefile(shortFilePath, __file__):
19+            for p in searchpath:     # verify it's an install in the searchpath
20+                if shortFilePath.startswith(p):
21+                    installprefix=p
22+                    break
23+
24+        # Stop checking if we've found and set the installprefix.
25+        if installprefix != "/":
26+            break
27+
28 logging.info( "Installprefix is %s" % installprefix )
29 
30 #