|
|
|
@ -356,25 +356,20 @@ class PhpLanguage(object): |
|
|
|
|
|
|
|
|
|
class PythonLanguage(object): |
|
|
|
|
|
|
|
|
|
def __init__(self): |
|
|
|
|
self._build_python_versions = ['2.7'] |
|
|
|
|
self._has_python_versions = [] |
|
|
|
|
|
|
|
|
|
def configure(self, config, args): |
|
|
|
|
self.config = config |
|
|
|
|
self.args = args |
|
|
|
|
_check_compiler(self.args.compiler, ['default']) |
|
|
|
|
self._tox_env = self._get_tox_env(self.args.compiler) |
|
|
|
|
|
|
|
|
|
def test_specs(self): |
|
|
|
|
# load list of known test suites |
|
|
|
|
with open('src/python/grpcio/tests/tests.json') as tests_json_file: |
|
|
|
|
tests_json = json.load(tests_json_file) |
|
|
|
|
environment = dict(_FORCE_ENVIRON_FOR_WRAPPERS) |
|
|
|
|
environment['PYVER'] = '2.7' |
|
|
|
|
environment['PYTHONPATH'] = os.path.abspath('src/python/gens') |
|
|
|
|
if self.config.build_config != 'gcov': |
|
|
|
|
return [self.config.job_spec( |
|
|
|
|
['tools/run_tests/run_python.sh'], |
|
|
|
|
['tools/run_tests/run_python.sh', self._tox_env], |
|
|
|
|
None, |
|
|
|
|
environ=dict(environment.items() + |
|
|
|
|
[('GRPC_PYTHON_TESTRUNNER_FILTER', suite_name)]), |
|
|
|
@ -399,18 +394,7 @@ class PythonLanguage(object): |
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
|
def build_steps(self): |
|
|
|
|
commands = [] |
|
|
|
|
for python_version in self._build_python_versions: |
|
|
|
|
try: |
|
|
|
|
with open(os.devnull, 'w') as output: |
|
|
|
|
subprocess.check_call(['which', 'python' + python_version], |
|
|
|
|
stdout=output, stderr=output) |
|
|
|
|
commands.append(['tools/run_tests/build_python.sh', python_version]) |
|
|
|
|
self._has_python_versions.append(python_version) |
|
|
|
|
except: |
|
|
|
|
jobset.message('WARNING', 'Missing Python ' + python_version, |
|
|
|
|
do_newline=True) |
|
|
|
|
return commands |
|
|
|
|
return [['tools/run_tests/build_python.sh', self._tox_env]] |
|
|
|
|
|
|
|
|
|
def post_tests_steps(self): |
|
|
|
|
return [] |
|
|
|
@ -421,6 +405,15 @@ class PythonLanguage(object): |
|
|
|
|
def dockerfile_dir(self): |
|
|
|
|
return 'tools/dockerfile/test/python_jessie_%s' % _docker_arch_suffix(self.args.arch) |
|
|
|
|
|
|
|
|
|
def _get_tox_env(self, compiler): |
|
|
|
|
"""Returns name of tox environment based on selected compiler.""" |
|
|
|
|
if compiler == 'python2.7' or compiler == 'default': |
|
|
|
|
return 'py27' |
|
|
|
|
elif compiler == 'python3.4': |
|
|
|
|
return 'py34' |
|
|
|
|
else: |
|
|
|
|
raise Exception('Compiler %s not supported.' % compiler) |
|
|
|
|
|
|
|
|
|
def __str__(self): |
|
|
|
|
return 'python' |
|
|
|
|
|
|
|
|
@ -808,7 +801,8 @@ argp.add_argument('--compiler', |
|
|
|
|
choices=['default', |
|
|
|
|
'gcc4.4', 'gcc4.9', 'gcc5.3', |
|
|
|
|
'clang3.4', 'clang3.6', |
|
|
|
|
'vs2010', 'vs2013', 'vs2015'], |
|
|
|
|
'vs2010', 'vs2013', 'vs2015', |
|
|
|
|
'python2.7', 'python3.4'], |
|
|
|
|
default='default', |
|
|
|
|
help='Selects compiler to use. Allowed values depend on the platform and language.') |
|
|
|
|
argp.add_argument('--build_only', |
|
|
|
|