Skip to content

Commit f135f99

Browse files
add tasks for updating vendored libs
1 parent bab18e1 commit f135f99

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

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

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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 updae after running the tests")

0 commit comments

Comments
 (0)