source: Makefile @ e56ac16

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5sampleryinfft+
Last change on this file since e56ac16 was e56ac16, checked in by Paul Brossier <piem@piem.org>, 7 years ago

Makefile: improve test_python and test_pure_python

  • Property mode set to 100644
File size: 3.3 KB
RevLine 
[81ad577]1WAFCMD=python waf
[7f35041]2WAFURL=https://waf.io/waf-1.8.22
[6a6cb48]3
[be06e53]4SOX=sox
5
[6a6cb48]6ENABLE_DOUBLE := $(shell [ -z $(HAVE_DOUBLE) ] || echo --enable-double )
[ceb884d]7TESTSOUNDS := python/tests/sounds
[6a6cb48]8
[8e94af5]9all: build
10
11checkwaf:
12        @[ -f waf ] || make getwaf
13
14getwaf:
[bab8e3d]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*
[8e94af5]26
[e372a0f]27configure: checkwaf
[6a6cb48]28        $(WAFCMD) configure $(WAFOPTS) $(ENABLE_DOUBLE)
[e372a0f]29
30build: configure
[3fc5696]31        $(WAFCMD) build $(WAFOPTS)
[8e94af5]32
[972a326]33build_python:
[8d09036]34        python ./setup.py build_ext $(ENABLE_DOUBLE)
[972a326]35
[1167631]36test_python: export LD_LIBRARY_PATH=$(PWD)/build/src
[69212a0]37test_python:
[e56ac16]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
[1167631]45        pip install -v -r requirements.txt
[e56ac16]46        # install package
[1167631]47        pip install -v .
[e56ac16]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
[1167631]55        pip uninstall -y -v aubio
[39122f0]56
[e56ac16]57local_dylib:
[1167631]58        # create links from ~/lib/lib* to build/src/lib*
[4c38b62]59        [ -f build/src/libaubio.[0-9].dylib ] && ( mkdir -p ~/lib && cp -prv build/src/libaubio.[0-9].dylib ~/lib ) || true
[e56ac16]60
61test_python_osx: local_dylib test_python
[69212a0]62
[972a326]63clean_python:
[1167631]64        ./setup.py clean
[972a326]65
[f465088]66test_pure_python:
[e56ac16]67        # clean
[f465088]68        -pip uninstall -v -y aubio
[e56ac16]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
[f465088]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
[5864b43]94        CFLAGS=-Os python setup.py build_ext $(ENABLE_DOUBLE) bdist_wheel --universal
[f465088]95        wheel install dist/*.whl
96        nose2 -N 4
97        pip uninstall -v -y aubio
98
[a2ae70a]99build_python3:
[8d09036]100        python3 ./setup.py build_ext $(ENABLE_DOUBLE)
[a2ae70a]101
102clean_python3:
[1167631]103        python3 ./setup.py clean
[a2ae70a]104
[ddd9861]105clean:
[81ad577]106        $(WAFCMD) clean
[ddd9861]107
[5864b43]108distclean:
109        $(WAFCMD) distclean
110
[e372a0f]111distcheck: checkwaf
[7aed123]112        $(WAFCMD) distcheck $(WAFOPTS) $(ENABLE_DOUBLE)
[8e94af5]113
114help:
[81ad577]115        $(WAFCMD) --help
[be06e53]116
117create_test_sounds:
[3a7b7c6]118        -[ -z `which $(SOX)` ] && ( echo $(SOX) could not be found) || true
119        -mkdir -p $(TESTSOUNDS)
[9e36acd]120        -$(SOX) -r 44100 -b 16 -n "$(TESTSOUNDS)/44100Hz_1f_silence.wav"          synth 1s   silence 0        dcshift .01
[ceb884d]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
[9e36acd]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
[e48b072]127
128html:
129        cd doc && make html
130
131dist: distclean expandwaf
132        $(WAFCMD) dist
Note: See TracBrowser for help on using the repository browser.