From b6576d28ec21411f8da58cedab7a6c6c57dc172b Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Wed, 18 Jan 2017 14:49:15 -0500 Subject: Updated the generate.py scripts for tox and virtualenv. --- setup.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 597782db2..372aca9ff 100644 --- a/setup.py +++ b/setup.py @@ -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 ''' -- cgit v1.2.1