1864
|
1 from invoke import task
|
|
2 import glob
|
|
3
|
|
4 bin_sources = [
|
|
5 'bin/ascoltami2',
|
|
6 'bin/captureDevice',
|
|
7 'bin/collector',
|
|
8 'bin/collector_loadtest.py',
|
|
9 'bin/effecteval',
|
|
10 'bin/effectsequencer',
|
|
11 'bin/homepageConfig',
|
|
12 'bin/inputdemo',
|
|
13 'bin/inputquneo',
|
|
14 'bin/keyboardcomposer',
|
|
15 'bin/listsongs',
|
|
16 'bin/musicPad',
|
|
17 'bin/musictime',
|
|
18 'bin/paintserver',
|
|
19 'bin/picamserve',
|
|
20 'bin/rdfdb',
|
|
21 'bin/run_local.py',
|
|
22 'bin/subcomposer',
|
|
23 'bin/subserver',
|
|
24 'bin/vidref',
|
|
25 'bin/vidrefsetup',
|
|
26 'bin/wavecurve',
|
|
27 ]
|
|
28 def pkg_sources():
|
|
29 return glob.glob('light9/**/*.py', recursive=True)
|
|
30
|
|
31 @task
|
|
32 def mypy(ctx):
|
|
33 def run(sources):
|
|
34 ss = ' '.join(sources)
|
|
35 ctx.run(f'MYPYPATH=stubs env/bin/mypy --check-untyped-defs {ss}',
|
|
36 pty=True, warn=True)
|
|
37
|
|
38 sources = ' '.join(bin_sources + pkg_sources())
|
|
39 ctx.run(f'env/bin/flake8 --ignore=E115,E123,E124,E126,E225,E231,E261,E262,E265,E301,E302,E303,E305,E306,E401,E402,E501,E701,E731,W291,W293,W391,W504 {sources}', warn=True)
|
|
40
|
|
41 sources = ' '.join(pkg_sources())
|
|
42 for src in bin_sources:
|
|
43 print(f"mypy {src}")
|
|
44 run([src])# + pkg_sources())
|
|
45 @task
|
|
46 def reformat(ctx):
|
|
47 ctx.run("env/bin/yapf --verbose --parallel --in-place --style google light9/**/*.py `file --no-pad bin/* | grep 'Python script' | perl -lpe 's/:.*//'`")
|
|
48
|
|
49 @task
|
|
50 def test(ctx):
|
|
51 ctx.run('docker build -f Dockerfile.build -t light9_build:latest .')
|
|
52 ctx.run('docker run --rm -it -v `pwd`:/opt light9_build:latest'
|
|
53 ' nose2 -v light9.currentstategraphapi_test light9.graphfile_test',
|
|
54 pty=True)
|