
This change creates a new tox environment that *only* installs openstack_requirements and then verifies that each of the console scripts has all of the modules that it imports. This will need to be added to our gate RSN Change-Id: Ibc37593afcc4d9f820cb88168e1aa15e773b2087
30 lines
771 B
Python
30 lines
771 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())
|