-
Notifications
You must be signed in to change notification settings - Fork 7
/
tasks.py
36 lines (32 loc) · 875 Bytes
/
tasks.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from invoke import task
from pathlib import Path
from shutil import rmtree
@task
def build(ctx):
print("Building object library")
# /MD avoids a warning in the CFFI build. May affect the exe build...
ctx.run("cl /nologo /c /Ic_src /MD c_src\\lib.c")
ctx.run("lib /nologo /out:lib.lib lib.obj")
@task(build)
def build_cffi(ctx):
print("Building Python interface library")
ctx.run("py lib_build.py")
@task(build_cffi)
def test(ctx):
ctx.run("py.test")
@task
def clean(ctx):
cwd = Path.cwd()
patterns = ["lib.*", "_lib.*"]
for pattern in patterns:
for p in cwd.glob(pattern):
p.unlink()
dirs = [".cache", "__pycache__", "Release"]
for d in dirs:
if Path(d).exists():
rmtree(d)
others = []
for name in others:
p = Path(name)
if p.exists():
p.unlink()