From adf4b9ba48fff530bf55ea8b5ca380fa84267acb Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Tue, 23 Sep 2014 20:07:01 -0700 Subject: [PATCH] add tox2travis. --- resources/python/tox2travis.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 resources/python/tox2travis.py diff --git a/resources/python/tox2travis.py b/resources/python/tox2travis.py new file mode 100755 index 00000000..b75675eb --- /dev/null +++ b/resources/python/tox2travis.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python +from tox._config import parseconfig +from yaml import dump + + +class TravisFromTox(object): + + def __init__(self, tox_config): + self._tox_config = tox_config + + def build_travis_dict(self): + return { + 'language': 'python', + 'install': ['pip install -e hg+https://ivanmalison@bitbucket.org/hpk42/tox#egg=tox'], + 'script': 'tox', + 'env': self._get_environment_variables() + } + + def _get_environment_variables(self): + return ['TOXENV={0}'.format(env) for env in self._tox_config.envlist] + + def build_travis_yaml(self): + return dump(self.build_travis_dict(), default_flow_style=False) + + +if __name__ == '__main__': + print TravisFromTox(parseconfig()).build_travis_yaml()