source: Makefile @ e56ac16

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchsampleryinfft+
Last change on this file since e56ac16 was e56ac16, checked in by Paul Brossier <piem@piem.org>, 3 years ago

Makefile: improve test_python and test_pure_python

  • Property mode set to 100644
File size: 3.3 KB
Line 
1WAFCMD=python waf
2WAFURL=https://waf.io/waf-1.8.22
3
4SOX=sox
5
6ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )
7TESTSOUNDS := python/tests/sounds
8
9all: build
10
11checkwaf:
12        @[ -f waf ] || make getwaf
13
14getwaf:
15        ./scripts/get_waf.sh
16
17expandwaf: getwaf
18        [ -d wafilb ] || rm -fr waflib
19        $(WAFCMD) --help > /dev/null
20        mv .waf*/waflib . && rm -fr .waf*
21        sed '/^#==>$$/,$$d' waf > waf2 && mv waf2 waf
22        chmod +x waf
23
24cleanwaf:
25        rm -rf waf waflib .waf*
26
27configure: checkwaf
28        $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE)
29
30build: configure
31        $(WAFCMD) build $(WAFOPTS)
32
33build_python:
34        python ./setup.py build_ext $(ENABLE_DOUBLE)
35
36test_python: export LD_LIBRARY_PATH=$(PWD)/build/src
37test_python:
38        # clean
39        -pip uninstall -v -y aubio
40        ./setup.py clean
41        $(WAFCMD) distclean
42        # build library
43        $(WAFCMD) configure build
44        # install python requirements
45        pip install -v -r requirements.txt
46        # install package
47        pip install -v .
48        # can clean twice
49        ./setup.py clean
50        ./setup.py clean
51        # run test with installed package
52        ./python/tests/run_all_tests --verbose
53        nose2 -N 4 #--verbose
54        # uninstall package
55        pip uninstall -y -v aubio
56
57local_dylib:
58        # create links from ~/lib/lib* to build/src/lib*
59        [ -f build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
60
61test_python_osx: local_dylib test_python
62
63clean_python:
64        ./setup.py clean
65
66test_pure_python:
67        # clean
68        -pip uninstall -v -y aubio
69        -$(WAFCMD) distclean
70        ./setup.py clean
71        # install python requirements
72        pip install --verbose --requirement requirements.txt
73        # compile
74        CFLAGS=-Os python setup.py build $(ENABLE_DOUBLE)
75        # needs recompile, disabled
76        #./setup.py test
77        # install package
78        pip install --verbose .
79        # can clean twice
80        ./setup.py clean
81        ./setup.py clean
82        # run test with installed package
83        ./python/tests/run_all_tests --verbose
84        nose2 -N 4 #--verbose
85        # uninstall
86        pip uninstall -v -y aubio
87
88test_pure_python_wheel:
89        -pip uninstall -v -y aubio
90        -rm -rf build/ python/gen/
91        -rm -f dist/*.whl
92        -pip install -v -r requirements.txt
93        -pip install -v wheel
94        CFLAGS=-Os python setup.py build_ext $(ENABLE_DOUBLE) bdist_wheel --universal
95        wheel install dist/*.whl
96        nose2 -N 4
97        pip uninstall -v -y aubio
98
99build_python3:
100        python3 ./setup.py build_ext $(ENABLE_DOUBLE)
101
102clean_python3:
103        python3 ./setup.py clean
104
105clean:
106        $(WAFCMD) clean
107
108distclean:
109        $(WAFCMD) distclean
110
111distcheck: checkwaf
112        $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
113
114help:
115        $(WAFCMD) --help
116
117create_test_sounds:
118        -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
119        -mkdir -p $(TESTSOUNDS)
120        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav"          synth 1s   silence 0        dcshift .01
121        -$(SOX) -r 22050 -b 16 -n "$(TESTSOUNDS)/22050Hz_5s_brownnoise.wav"   synth 5    brownnoise      vol 0.9
122        -$(SOX) -r 32000 -b 16 -n "$(TESTSOUNDS)/32000Hz_127f_sine440.wav"    synth 127s sine 440        vol 0.9
123        -$(SOX) -r  8000 -b 16 -n "$(TESTSOUNDS)/8000Hz_30s_silence.wav"      synth 30   silence 0       vol 0.9
124        -$(SOX) -r 48000 -b 32 -n "$(TESTSOUNDS)/48000Hz_60s_sweep.wav"       synth 60   sine 100-20000  vol 0.9
125        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_44100f_sine441.wav"  synth 44100s   sine 441   vol 0.9
126        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_100f_sine441.wav"    synth 100s sine 441       vol 0.9
127
128html:
129        cd doc && make html
130
131dist: distclean expandwaf
132        $(WAFCMD) dist
Note: See TracBrowser for help on using the repository browser.