69e21be288
Change-Id: I1d6e583f41f95be7c2af232a2f22ee20fa83c4be Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
29 lines
734 B
Python
29 lines
734 B
Python
#!/usr/bin/env python
|
|
|
|
import configparser
|
|
import importlib
|
|
import re
|
|
import sys
|
|
|
|
|
|
def main():
|
|
errors = 0
|
|
pattern = re.compile(r'^(.*?)\s*=\s*([^:]*?):.*$')
|
|
config = configparser.ConfigParser()
|
|
config.read('setup.cfg')
|
|
console_scripts = config.get('entry_points', 'console_scripts')
|
|
for script in console_scripts.split('\n'):
|
|
match = pattern.match(script)
|
|
if match:
|
|
(script, module) = match.groups()
|
|
try:
|
|
importlib.import_module(module)
|
|
except ImportError as err:
|
|
print('Imports for %s failed:\n\t%s' % (script, err))
|
|
errors += 1
|
|
return 1 if errors else 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|