mirror of
https://github.com/facebook/sapling.git
synced 2025-01-01 09:37:56 +03:00
hgext: officially turn 'hgext' into a namespace package
Actually since Python 2.3, there is some way to turn top level package into "namespace package" so that multiple subpackage installed in different part of the path can still be imported transparently. This feature was previously thought (at least by myself) to be only provided by some setuptool black magic. Turning hgext into such namespace package allows third extensions to install themselves inside the "hgext" namespace package to avoid polluting the global python module namespace. They will now be able to do so without making it a pain to use a Mercurial "installed" in a different way/location than these extensions. The only constrains is that the extension ship a 'hgext/__init__.py' containing the same call to 'pkgutil.extend_path' and nothing else. This seems realistic. The main question that remains is: should we introduce a dedicated namespace for third party extension (hgext3rd?) to make a clearer distinction between what is officially supported and what is not? If so, this will be introduced in a follow up patch.
This commit is contained in:
parent
6d2484af42
commit
cc59112ca7
@ -1 +1,3 @@
|
||||
# placeholder
|
||||
from __future__ import absolute_import
|
||||
import pkgutil
|
||||
__path__ = pkgutil.extend_path(__path__, __name__)
|
||||
|
@ -19,7 +19,6 @@
|
||||
doc/check-seclevel.py not using absolute_import
|
||||
doc/gendoc.py not using absolute_import
|
||||
doc/hgmanpage.py not using absolute_import
|
||||
hgext/__init__.py not using absolute_import
|
||||
hgext/color.py not using absolute_import
|
||||
hgext/eol.py not using absolute_import
|
||||
hgext/extdiff.py not using absolute_import
|
||||
|
Loading…
Reference in New Issue
Block a user