diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-01-18 14:49:15 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-01-18 14:49:15 -0500 |
commit | b6576d28ec21411f8da58cedab7a6c6c57dc172b (patch) | |
tree | 982ac027c6ff335828b1a5bbb3b5e4523cbb3413 /setup.py | |
parent | 11a6465965af445f2cc2b8eaf91caaa2860b935c (diff) | |
download | openshift-b6576d28ec21411f8da58cedab7a6c6c57dc172b.tar.gz openshift-b6576d28ec21411f8da58cedab7a6c6c57dc172b.tar.bz2 openshift-b6576d28ec21411f8da58cedab7a6c6c57dc172b.tar.xz openshift-b6576d28ec21411f8da58cedab7a6c6c57dc172b.zip |
Updated the generate.py scripts for tox and virtualenv.
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -6,7 +6,7 @@ from __future__ import print_function import os import fnmatch import re -import subprocess +import sys import yaml # Always prefer setuptools over distutils @@ -170,22 +170,32 @@ class OpenShiftAnsibleGenerateValidation(Command): 'playbooks', 'utils'], None, - 'generate.py') + 'generate.py$') + + if len(generate_files) < 1: + print('Did not find any code generation. Please verify module code generation.') # noqa: E501 + raise SystemExit(1) - # call them with --verify errors = False for gen in generate_files: print('Checking generated module code: {0}'.format(gen)) try: - subprocess.call([gen, '--verify']) - except subprocess.CalledProcessError as cpe: - print(cpe) + sys.path.insert(0, os.path.dirname(gen)) + # we are importing dynamically. This isn't in + # the python path. + # pylint: disable=import-error + import generate + generate.verify() + except generate.GenerateAnsibleException as gae: + print(gae.args) errors = True if errors: print('Found errors while generating module code.') raise SystemExit(1) + print('\nAll generate scripts passed.\n') + class UnsupportedCommand(Command): ''' Basic Command to override unsupported commands ''' |