[PATCH 4 of 4] extensions: provide a fallback for known extensions (issue1708)
Cédric Duval
cedricduval at free.fr
Fri Jul 31 01:06:36 CDT 2009
# HG changeset patch
# User Cédric Duval <cedricduval at free.fr>
# Date 1249020251 -7200
# Node ID ee9cadd728d6867d1eb5d6253b5704f24b7eec5a
# Parent 742aee956146f6c322d2a6e03fcd25c78ac477a5
extensions: provide a fallback for known extensions (issue1708)
Providing a fallback for cases when determining the list of extensions
is inconvenient, like with win32/py2exe where modules are shipped inside
a zip archive.
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -25,6 +25,7 @@
MANIFEST
patches
mercurial/__version__.py
+mercurial/extensions_list.py
Output/Mercurial-*.exe
.DS_Store
tags
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -160,6 +160,11 @@
import hgext
extpath = os.path.dirname(os.path.abspath(hgext.__file__))
names = listexts(extpath)
+ try:
+ from mercurial import extensions_list
+ names.update(extensions_list.names)
+ except ImportError:
+ pass
return synopses(names.difference(_order))
def enabled():
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -37,6 +37,15 @@
from distutils.spawn import spawn, find_executable
from distutils.ccompiler import new_compiler
+# fall back to pure modules if required C extensions are not yet available
+sys.path.append(os.path.join('mercurial', 'pure'))
+
+from mercurial import extensions
+f = open("mercurial/extensions_list.py", "w")
+f.write('# this file is autogenerated by setup.py\n')
+f.write('names = %s\n' % extensions.listexts('hgext'))
+f.close()
+
extra = {}
scripts = ['hg']
if os.name == 'nt':
More information about the Mercurial-devel
mailing list