Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
Add a third .travis.yml template, based on tox
Browse files Browse the repository at this point in the history
This is untested because I'm not sure how to test it.  This probably
needs to be a per-package switch somehow.  E.g. check for existence of
tox.ini.
  • Loading branch information
mgedmin committed Apr 9, 2014
1 parent ab0bfc5 commit ec53bdc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/zope/githubsupport/repos.py
Expand Up @@ -42,6 +42,14 @@
"Programming Language :: Python :: Implementation :: PyPy": 'pypy',
}

TROVE_TO_TOXENV_VERSIONS = {
"Programming Language :: Python :: 2.6": 'py26',
"Programming Language :: Python :: 2.7": 'py27',
"Programming Language :: Python :: 3.2": 'py32',
"Programming Language :: Python :: 3.3": 'py33',
"Programming Language :: Python :: Implementation :: PyPy": 'pypy',
}

def get_sub_ns(config, options, repo=None):
return {
'github_username': options.username,
Expand Down Expand Up @@ -99,9 +107,15 @@ def update_travis_yaml(repo, config, options):
classifiers = get_repo_classifiers(name, config, options)
py_versions = [v for k, v in TROVE_TO_TRAVIS_PY_VERSIONS.items()
if k in classifiers]
toxenvs = [v for k, v in TROVE_TO_TOXENV_VERSIONS.items()
if k in classifiers]
if not py_versions:
py_versions.append('2.7')
ns = {'python_versions': '- ' + '\n - '.join(sorted(py_versions))}
if not toxenvs:
toxenvs.append('py27')
ns = {'python_versions': '- ' + '\n - '.join(sorted(py_versions)),
'tox_environments': '\n '.join('- TOXENV=' + e for e in sorted(toxenvs))}

with open(yaml_path, 'w') as out_file:
with open(config.get('travis', 'yaml-template'), 'r') as in_file:
out_file.write(in_file.read().format(**ns))
Expand Down
9 changes: 9 additions & 0 deletions travis.yml.tmpl3
@@ -0,0 +1,9 @@
language: python
env:
{tox_environments}
install:
- pip install tox
script:
- tox
notifications:
email: false

0 comments on commit ec53bdc

Please sign in to comment.