requirements/tools/check-install.py
Cady_Chen 6898f5d20d Fix "wrap functions with 2 blank lines" pep8 check
Now gates are requires this pep8 rule as mandatory so until it'll be
fixed merge is blocked.

Change-Id: I5b1ad7ec820911b5e765e184223f786c733836a5
2016-11-16 18:52:03 +08:00

31 lines
772 B
Python

#!/usr/bin/env python
from __future__ import print_function
import ConfigParser
import importlib
import re
import sys
def main():
errors = 0
pattern = re.compile('^(.*?)\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())