Mercurial > public > mercurial-scm > hg
comparison contrib/check-py3-compat.py @ 32421:778dc37ce683
check: check modules in hgdemandimport
A few places only check modules in mercurial and hgext. Add
hgdemandimport to the list in those places.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Sun, 21 May 2017 13:44:26 -0700 |
parents | 194b0f781132 |
children | 01417ca7f2e2 |
comparison
equal
deleted
inserted
replaced
32420:0906b85bf222 | 32421:778dc37ce683 |
---|---|
49 except SyntaxError as e: | 49 except SyntaxError as e: |
50 print('%s: invalid syntax: %s' % (f, e)) | 50 print('%s: invalid syntax: %s' % (f, e)) |
51 return | 51 return |
52 | 52 |
53 # Try to import the module. | 53 # Try to import the module. |
54 # For now we only support mercurial.* and hgext.* modules because figuring | 54 # For now we only support modules in packages because figuring out module |
55 # out module paths for things not in a package can be confusing. | 55 # paths for things not in a package can be confusing. |
56 if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'): | 56 if (f.startswith(('hgdemandimport/', 'hgext/', 'mercurial/')) |
57 and not f.endswith('__init__.py')): | |
57 assert f.endswith('.py') | 58 assert f.endswith('.py') |
58 name = f.replace('/', '.')[:-3] | 59 name = f.replace('/', '.')[:-3] |
59 try: | 60 try: |
60 importlib.import_module(name) | 61 importlib.import_module(name) |
61 except Exception as e: | 62 except Exception as e: |