Skip to content

Commit 6e2b5a3

Browse files
authored
Merge pull request #2523 from RonnyPfannschmidt/vendoring-tasks
Vendoring tasks
2 parents bb659fc + b3bf7fc commit 6e2b5a3

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

changelog/2474.trivial

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Create invoke tasks for updating the vendored packages.

tasks/__init__.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
import invoke
66

7-
from . import generate
7+
from . import generate, vendoring
88

9-
ns = invoke.Collection(generate)
9+
10+
ns = invoke.Collection(
11+
generate,
12+
vendoring
13+
)

tasks/vendoring.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from __future__ import absolute_import, print_function
2+
import py
3+
import invoke
4+
5+
VENDOR_TARGET = py.path.local("_pytest/vendored_packages")
6+
GOOD_FILES = 'README.md', '__init__.py'
7+
8+
@invoke.task()
9+
def remove_libs(ctx):
10+
print("removing vendored libs")
11+
for path in VENDOR_TARGET.listdir():
12+
if path.basename not in GOOD_FILES:
13+
print(" ", path)
14+
path.remove()
15+
16+
@invoke.task(pre=[remove_libs])
17+
def update_libs(ctx):
18+
print("installing libs")
19+
ctx.run("pip install -t {target} pluggy".format(target=VENDOR_TARGET))
20+
ctx.run("git add {target}".format(target=VENDOR_TARGET))
21+
print("Please commit to finish the update after running the tests:")
22+
print()
23+
print(' git commit -am "Updated vendored libs"')

0 commit comments

Comments
 (0)