[PATCH 7 of 8] extensions: use the generated list of extensions (issue1708)
Cédric Duval
cedricduval at free.fr
Sat Jul 4 15:05:13 CDT 2009
# HG changeset patch
# User Cédric Duval <cedricduval at free.fr>
# Date 1246737838 -7200
# Node ID 34339d7a94a81820e6aa3e5b649435cd8a0a6b97
# Parent 1df45aa6f8119609e43b108a7bff7f632f22f92a
extensions: use the generated list of extensions (issue1708)
The list of available extensions is built as follows:
- first, use the build-time list of officially shipped extensions
- then, update that list at run-time with extensions found in the path
The benefit of this twofold approach is:
- the build-time list removes the exclusive reliance on the ability to extract
documentation at run-time (which is defeated in particular with py2exe
distributions, in a zipped file stripped of source py:s): in case run-time
extraction is not possible, we fall back to the known list (issue1708)
- the list generated at run-time allows the use case of users (or more
likely distributors) dropping third-party extensions in the hgext directory
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,7 @@
$(PYTHON) setup.py $(PURE) build
doc:
+ $(PYTHON) setup.py $(PURE) build_extensions_list
$(MAKE) -C doc
clean:
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -122,10 +122,16 @@
'''find disabled extensions
returns a dict of {name: desc}, and the max name length'''
+ # extensions from the source tree (list generated at build-time)
+ import extdoc_list
+ d = extdoc_list.descriptions
+ if not raw:
+ d = dict([ (k, extdoc.synopsis(v)) for k, v in d.iteritems() ])
+
# extensions found from hgext's path
import hgext
extpath = os.path.dirname(os.path.abspath(hgext.__file__))
- d = extdoc.extract(extpath, raw)
+ d.update(extdoc.extract(extpath, raw))
exts = dict([ (k, v) for k, v in d.iteritems() if k not in _order ])
maxlength = max([ len(name) for name in exts.keys() or [''] ])
More information about the Mercurial-devel
mailing list