[PATCH] extensions: catch OSError when hgext is not accessible (issue1708)
Cédric Duval
cedricduval at free.fr
Mon Jun 29 17:29:06 UTC 2009
# HG changeset patch
# User Cédric Duval <cedricduval at free.fr>
# Date 1246296534 -7200
# Node ID 91fbdeebf4e8d6e8bd22bba48d14f5b50aeb8196
# Parent 8a5657ecdaaf2392d67cc6dc981426b86c4472bd
extensions: catch OSError when hgext is not accessible (issue1708)
Temporary workaround for issue1708: on win32 with py2exe, hgext is distributed
inside a zipped file (which anyway does not contain the py files from which we
ought to extract the documentation strings), which raises a WindowsError
(subclasses OSError).
This means that on such platforms the list of disabled extensions won't be
available. Real fix postponed for after Mercurial 1.3.
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -125,9 +125,14 @@
import hgext
extpath = os.path.dirname(os.path.abspath(hgext.__file__))
+ try: # might not be a filesystem path
+ files = os.listdir(extpath)
+ except OSError:
+ return None, 0
+
exts = {}
maxlength = 0
- for e in os.listdir(extpath):
+ for e in files:
if e.endswith('.py'):
name = e.rsplit('.', 1)[0]
More information about the Mercurial-devel
mailing list