From 6e6bc89db83b3d1cfdfd4e81baabb8a1a08a1ac3 Mon Sep 17 00:00:00 2001 From: Sai Rahul Poruri Date: Mon, 22 Jun 2020 13:10:52 +0100 Subject: [PATCH 1/2] DEV : Add cron jobs to travis ci - update travis config to listen to TRAVIS_EVENT_TYPE environment variable and do something when the envvar is cron - add ability to install relevant packages from git source in etstool module modified: .travis.yml modified: etstool.py --- .travis.yml | 1 + etstool.py | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 26f301a0a..4e26b1d75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,6 +44,7 @@ before_install: - edm install -y wheel click coverage install: - for toolkit in ${TOOLKITS}; do edm run -- python etstool.py install --runtime=${RUNTIME} --toolkit=${toolkit} || exit; done + - if [[ ${TRAVIS_EVENT_TYPE} == 'cron' ]]; then for toolkit in ${TOOLKITS}; do edm run -- python etstool.py install --runtime=${RUNTIME} --toolkit=${toolkit} --source || exit; done; fi script: - for toolkit in ${TOOLKITS}; do edm run -- python etstool.py test --runtime=${RUNTIME} --toolkit=${toolkit} || exit; done diff --git a/etstool.py b/etstool.py index 203d5449f..4f01495d7 100644 --- a/etstool.py +++ b/etstool.py @@ -92,6 +92,11 @@ dependencies = {"traits", "numpy", "pygments", "coverage", "mock"} +# NOTE : traitsui is always installed from source +source_dependencies = { + "traits", +} + extra_dependencies = { "pyside": {"pyside"}, # XXX once pyside2 is available in EDM, we will want it here @@ -134,6 +139,8 @@ envvar="ETSTOOL_EDM", ) +github_url_fmt = "git+http://github.com/enthought/{0}.git#egg={0}" + @click.group() def cli(): @@ -145,7 +152,8 @@ def cli(): @click.option("--runtime", default="3.6", help="Python version to use") @click.option("--toolkit", default="pyqt", help="Toolkit and API to use") @click.option("--environment", default=None, help="EDM environment to use") -def install(edm, runtime, toolkit, environment): +@click.option('--source/--no-source', default=False) +def install(edm, runtime, toolkit, environment, source): """ Install project and dependencies into a clean EDM environment. """ @@ -184,6 +192,19 @@ def install(edm, runtime, toolkit, environment): click.echo("Creating environment '{environment}'".format(**parameters)) execute(commands, parameters) + + if source: + cmd_fmt = "edm plumbing remove-package --environment {environment} --force " + commands = [cmd_fmt+dependency for dependency in source_dependencies] + execute(commands, parameters) + source_pkgs = [github_url_fmt.format(pkg) for pkg in source_dependencies] + commands = [ + "python -m pip install {pkg} --no-deps".format(pkg=pkg) + for pkg in source_pkgs + ] + commands = ["edm run -e {environment} -- " + command for command in commands] + execute(commands, parameters) + click.echo("Done install") From 51245957fbb62de5393b0b54fe08083063cbd129 Mon Sep 17 00:00:00 2001 From: Sai Rahul Poruri Date: Tue, 23 Jun 2020 18:46:17 +0100 Subject: [PATCH 2/2] REF : source_dependencies is now a dict where the key is the package name and the value is the git/github source url for the package modified: etstool.py --- etstool.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/etstool.py b/etstool.py index 4f01495d7..8f05e584e 100644 --- a/etstool.py +++ b/etstool.py @@ -94,7 +94,7 @@ # NOTE : traitsui is always installed from source source_dependencies = { - "traits", + "traits": "git+http://github.com/enthought/traits.git#egg=traits", } extra_dependencies = { @@ -139,8 +139,6 @@ envvar="ETSTOOL_EDM", ) -github_url_fmt = "git+http://github.com/enthought/{0}.git#egg={0}" - @click.group() def cli(): @@ -195,9 +193,9 @@ def install(edm, runtime, toolkit, environment, source): if source: cmd_fmt = "edm plumbing remove-package --environment {environment} --force " - commands = [cmd_fmt+dependency for dependency in source_dependencies] + commands = [cmd_fmt+dependency for dependency in source_dependencies.keys()] execute(commands, parameters) - source_pkgs = [github_url_fmt.format(pkg) for pkg in source_dependencies] + source_pkgs = source_dependencies.values() commands = [ "python -m pip install {pkg} --no-deps".format(pkg=pkg) for pkg in source_pkgs