comparison tests/test-bad-extension.t @ 28541:4b81487a01d4

extensions: also search for extension in the 'hgext3rd' package Mercurial extensions are not meant to be normal python package/module. Yet the lack of an official location to install them means that a lot of them actually install as root level python package, polluting the global Python package namespace and risking collision with more legit packages. As we recently discovered, core python actually support namespace package. A way for multiples distinct "distribution" to share a common top level package without fear of installation headache. (Namespace package allow submodule installed in different location (of the 'sys.path') to be imported properly. So we are fine as long as extension includes a proper 'hgext3rd.__init__.py' to declare the namespace package.) Therefore we introduce a 'hgext3rd' namespace packages and search for extension in it. We'll then recommend third extensions to install themselves in it. Strictly speaking we could just get third party extensions to install in 'hgext' as it is also a namespace package. However, this would make the integration of formerly third party extensions in the main distribution more complicated as the third party install would overwrite the file from the main install. Moreover, having an explicit split between third party and core extensions seems like a good idea. The name 'hgext3rd' have been picked because it is short and seems explicit enough. Other alternative I could think of where: - hgextcontrib - hgextother - hgextunofficial
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 11 Mar 2016 10:30:08 +0000
parents 9974b8236cac
children a3a01194a337
comparison
equal deleted inserted replaced
28540:012411b9940d 28541:4b81487a01d4
54 Traceback (most recent call last): 54 Traceback (most recent call last):
55 Exception: bit bucket overflow 55 Exception: bit bucket overflow
56 could not import hgext.badext2 (No module named *badext2): trying badext2 (glob) 56 could not import hgext.badext2 (No module named *badext2): trying badext2 (glob)
57 Traceback (most recent call last): 57 Traceback (most recent call last):
58 ImportError: No module named *badext2 (glob) 58 ImportError: No module named *badext2 (glob)
59 could not import hgext3rd.badext2 (No module named badext2): trying badext2
60 Traceback (most recent call last):
61 ImportError: No module named badext2
59 *** failed to import extension badext2: No module named badext2 62 *** failed to import extension badext2: No module named badext2
60 Traceback (most recent call last): 63 Traceback (most recent call last):
61 ImportError: No module named badext2 64 ImportError: No module named badext2
62 65
63 confirm that there's no crash when an extension's documentation is bad 66 confirm that there's no crash when an extension's documentation is bad