--- a/mercurial/extensions.py Sun Jun 21 16:32:00 2009 +0200
+++ b/mercurial/extensions.py Sun Jun 21 16:35:44 2009 +0200
@@ -134,42 +134,46 @@
def disabled():
'''find disabled extensions from hgext
returns a dict of {name: desc}, and the max name length'''
+
+ import hgext
+ extpath = os.path.dirname(os.path.abspath(hgext.__file__))
+
exts = {}
maxlength = 0
- for dir in filter(os.path.isdir,
- (os.path.join(pd, 'hgext') for pd in pathdirs())):
- for e in os.listdir(dir):
- if e.endswith('.py'):
- name = e.rsplit('.', 1)[0]
- path = os.path.join(dir, e)
- else:
- name = e
- path = os.path.join(dir, e, '__init__.py')
+ for e in os.listdir(extpath):
- if name in exts or name == '__init__' or not os.path.exists(path):
- continue
+ if e.endswith('.py'):
+ name = e.rsplit('.', 1)[0]
+ path = os.path.join(extpath, e)
+ else:
+ name = e
+ path = os.path.join(extpath, e, '__init__.py')
+
+ if name in exts or name == '__init__' or not os.path.exists(path):
+ continue
- try:
- find(name)
- except KeyError:
- pass
- else:
- continue # enabled extension
+ try:
+ find(name)
+ except KeyError:
+ pass
+ else:
+ continue # enabled extension
- try:
- file = open(path)
- except IOError:
- continue
- else:
- doc = help.moduledoc(file)
- file.close()
+ try:
+ file = open(path)
+ except IOError:
+ continue
+ else:
+ doc = help.moduledoc(file)
+ file.close()
- if doc: # extracting localized synopsis
- exts[name] = gettext(doc).splitlines()[0]
- else:
- exts[name] = _('(no help text available)')
- if len(name) > maxlength:
- maxlength = len(name)
+ if doc: # extracting localized synopsis
+ exts[name] = gettext(doc).splitlines()[0]
+ else:
+ exts[name] = _('(no help text available)')
+
+ if len(name) > maxlength:
+ maxlength = len(name)
return exts, maxlength