diff --git a/changelog/2474.trivial b/changelog/2474.trivial new file mode 100644 index 000000000..9ea3fb651 --- /dev/null +++ b/changelog/2474.trivial @@ -0,0 +1 @@ +Create invoke tasks for updating the vendored packages. \ No newline at end of file diff --git a/tasks/__init__.py b/tasks/__init__.py index 9551ff059..992f4a4ad 100644 --- a/tasks/__init__.py +++ b/tasks/__init__.py @@ -4,6 +4,10 @@ Invoke tasks to help with pytest development and release process. import invoke -from . import generate +from . import generate, vendoring -ns = invoke.Collection(generate) + +ns = invoke.Collection( + generate, + vendoring +) diff --git a/tasks/vendoring.py b/tasks/vendoring.py new file mode 100644 index 000000000..867f2946b --- /dev/null +++ b/tasks/vendoring.py @@ -0,0 +1,23 @@ +from __future__ import absolute_import, print_function +import py +import invoke + +VENDOR_TARGET = py.path.local("_pytest/vendored_packages") +GOOD_FILES = 'README.md', '__init__.py' + +@invoke.task() +def remove_libs(ctx): + print("removing vendored libs") + for path in VENDOR_TARGET.listdir(): + if path.basename not in GOOD_FILES: + print(" ", path) + path.remove() + +@invoke.task(pre=[remove_libs]) +def update_libs(ctx): + print("installing libs") + ctx.run("pip install -t {target} pluggy".format(target=VENDOR_TARGET)) + ctx.run("git add {target}".format(target=VENDOR_TARGET)) + print("Please commit to finish the update after running the tests:") + print() + print(' git commit -am "Updated vendored libs"')