Mercurial > hg
changeset 22974:6bd43614d387
import-checker: treat "from mercurial import XXXX" style correctly
Before this patch, "import-checker.py" assumes that the name of
Mercurial module recognized by "imported_modules" doesn't have package
part: for example, "util".
This is reason why "import-checker.py" always builds fully qualified
module name up relatively, if the given module doesn't belong to
standard Python library.
But in fact, modules imported in "from mercurial import XXXX" style
already have fully qualified name: for example, "mercurial.util"
module imported by "mercurial.parsers" is treated as
"mercurial.mercurial.util" because of building module name up
relatively.
This prevents "import-checker.py" from correctly checking about cyclic
dependency in them.
This patch avoids building module name up relatively, also if module
name starts with "mercurial.", to treat modules imported in "from
mercurial import XXXX" style correctly.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 17 Oct 2014 02:07:05 +0900 |
parents | bcff9ecdaae0 |
children | 461342e1c8aa |
files | contrib/import-checker.py |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/import-checker.py Fri Oct 17 02:07:04 2014 +0900 +++ b/contrib/import-checker.py Fri Oct 17 02:07:05 2014 +0900 @@ -169,7 +169,7 @@ ignore = [] path = path + [mod] for i in sorted(imports.get(mod, [])): - if i not in stdlib_modules: + if i not in stdlib_modules and not i.startswith('mercurial.'): i = mod.rsplit('.', 1)[0] + '.' + i if i in path: firstspot = path.index(i)