# HG changeset patch # User Yuya Nishihara # Date 1493731698 -32400 # Node ID a025ec43856c93153e8b584c255463bc91c5b7de # Parent 4c712b90c60a57a2a6c5965cbc1cd96396b1cd01 import-checker: guess names of C extension modules Since extension modules aren't included in the list of source files, they need to be populated somehow. Otherwise the import from cext/cffi would be treated as a global one. diff -r 4c712b90c60a -r a025ec43856c contrib/import-checker.py --- a/contrib/import-checker.py Sun May 28 15:21:18 2017 +0900 +++ b/contrib/import-checker.py Tue May 02 22:28:18 2017 +0900 @@ -170,6 +170,16 @@ return False return fromlocal +def populateextmods(localmods): + """Populate C extension modules based on pure modules""" + newlocalmods = set(localmods) + for n in localmods: + if n.startswith('mercurial.pure.'): + m = n[len('mercurial.pure.'):] + newlocalmods.add('mercurial.cext.' + m) + newlocalmods.add('mercurial.cffi._' + m) + return newlocalmods + def list_stdlib_modules(): """List the modules present in the stdlib. @@ -701,7 +711,7 @@ for source_path in argv[1:]: modname = dotted_name_of_path(source_path) localmodpaths[modname] = source_path - localmods = set(localmodpaths) + localmods = populateextmods(localmodpaths) for localmodname, source_path in sorted(localmodpaths.items()): for src, modname, name, line in sources(source_path, localmodname): try: