##// END OF EJS Templates
contrib: have import-checker work mostly with native strings for mod names...
Augie Fackler -
r33891:3de9a2df default
parent child Browse files
Show More
@@ -147,6 +147,8 def fromlocalfunc(modulename, localmods)
147 >>> fromlocal2('bar', 2)
147 >>> fromlocal2('bar', 2)
148 ('foo.bar', 'foo.bar.__init__', True)
148 ('foo.bar', 'foo.bar.__init__', True)
149 """
149 """
150 if not isinstance(modulename, str):
151 modulename = modulename.decode('ascii')
150 prefix = '.'.join(modulename.split('.')[:-1])
152 prefix = '.'.join(modulename.split('.')[:-1])
151 if prefix:
153 if prefix:
152 prefix += '.'
154 prefix += '.'
@@ -406,6 +408,8 def verify_modern_convention(module, roo
406 * Certain modules must be aliased to alternate names to avoid aliasing
408 * Certain modules must be aliased to alternate names to avoid aliasing
407 and readability problems. See `requirealias`.
409 and readability problems. See `requirealias`.
408 """
410 """
411 if not isinstance(module, str):
412 module = module.decode('ascii')
409 topmodule = module.split('.')[0]
413 topmodule = module.split('.')[0]
410 fromlocal = fromlocalfunc(module, localmods)
414 fromlocal = fromlocalfunc(module, localmods)
411
415
@@ -724,6 +728,9 def main(argv):
724 localmodpaths[modname] = source_path
728 localmodpaths[modname] = source_path
725 localmods = populateextmods(localmodpaths)
729 localmods = populateextmods(localmodpaths)
726 for localmodname, source_path in sorted(localmodpaths.items()):
730 for localmodname, source_path in sorted(localmodpaths.items()):
731 if not isinstance(localmodname, bytes):
732 # This is only safe because all hg's files are ascii
733 localmodname = localmodname.encode('ascii')
727 for src, modname, name, line in sources(source_path, localmodname):
734 for src, modname, name, line in sources(source_path, localmodname):
728 try:
735 try:
729 used_imports[modname] = sorted(
736 used_imports[modname] = sorted(
General Comments 0
You need to be logged in to leave comments. Login now