Global requirements for OpenStack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

check-install.py 799B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python
  2. from __future__ import print_function
  3. import importlib
  4. import re
  5. import sys
  6. import six.moves.configparser as configparser
  7. def main():
  8. errors = 0
  9. pattern = re.compile('^(.*?)\s*=\s*([^:]*?):.*$')
  10. config = configparser.ConfigParser()
  11. config.read('setup.cfg')
  12. console_scripts = config.get('entry_points', 'console_scripts')
  13. for script in console_scripts.split('\n'):
  14. match = pattern.match(script)
  15. if match:
  16. (script, module) = match.groups()
  17. try:
  18. importlib.import_module(module)
  19. except ImportError as err:
  20. print('Imports for %s failed:\n\t%s' % (script, err))
  21. errors += 1
  22. return 1 if errors else 0
  23. if __name__ == '__main__':
  24. sys.exit(main())