summaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-01-18 14:49:15 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-01-18 14:49:15 -0500
commitb6576d28ec21411f8da58cedab7a6c6c57dc172b (patch)
tree982ac027c6ff335828b1a5bbb3b5e4523cbb3413 /setup.py
parent11a6465965af445f2cc2b8eaf91caaa2860b935c (diff)
downloadopenshift-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.py22
1 files changed, 16 insertions, 6 deletions
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 '''