]> git.lyx.org Git - lyx.git/commitdiff
configure.py: Check path accessibility before call to os.path.isfile.
authorJulien Rioux <jrioux@lyx.org>
Mon, 4 Feb 2013 14:45:14 +0000 (15:45 +0100)
committerJulien Rioux <jrioux@lyx.org>
Tue, 14 May 2013 09:26:43 +0000 (11:26 +0200)
If you have an unmounted dir, ac_dir, in your PATH, the call to

os.path.isfile( os.path.join(ac_dir, ac_word + ext) )

hangs. This is probably a python bug, but the result of configure.py
hanging and LyX freezing is really bad, hence this workaround.

According to the python docs, MacOS doesn't provide os.access();
the hasattr protection is used for this reason.

lib/configure.py

index 78983e38958e59f95ca9efc9fc41b56da1674a32..d6537e2462d3a1b783c3022f9de6a2130b21aa87 100644 (file)
@@ -198,6 +198,8 @@ def checkProg(description, progs, rc_entry = [], path = [], not_found = ''):
         if "PATHEXT" in os.environ:
             extlist = extlist + os.environ["PATHEXT"].split(os.pathsep)
         for ac_dir in path:
+            if hasattr(os, "access") and not os.access(ac_dir, os.F_OK):
+                continue
             for ext in extlist:
                 if os.path.isfile( os.path.join(ac_dir, ac_word + ext) ):
                     logger.info(msg + ' yes')
@@ -252,6 +254,8 @@ def checkProgAlternatives(description, progs, rc_entry = [], alt_rc_entry = [],
             extlist = extlist + os.environ["PATHEXT"].split(os.pathsep)
         found_alt = False
         for ac_dir in path:
+            if hasattr(os, "access") and not os.access(ac_dir, os.F_OK):
+                continue
             for ext in extlist:
                 if os.path.isfile( os.path.join(ac_dir, ac_word + ext) ):
                     logger.info(msg + ' yes')