ref: c7155e9da728208fcbd125d8317669e3d38993b3
parent: 12a111574fe94dbc875f3be6b328c99aa7ce3583
parent: d21412462a26c3872dc3844b83075ff2195c1c99
author: Paul Brossier <piem@piem.org>
date: Wed Sep 26 11:03:11 EDT 2018
Merge branch 'feature/travispy37'
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -3,64 +3,84 @@
environment:
+ global:
+ CUSTOM64PATH: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
+
matrix:
# pre-installed python version, see:
# http://www.appveyor.com/docs/installed-software#python
- - PYTHONDIR: "C:\\Python27"
- PYTHON_VERSION: "2.7.x"
- PYTHON_ARCH: "32"
+ - PYTHONDIR: C:\Python27
+ PYTHON_VERSION: 2.7.x
+ PYTHON_ARCH: 32
- - PYTHONDIR: "C:\\Python27-x64"
- PYTHON_VERSION: "2.7.x"
- PYTHON_ARCH: "64"
+ - PYTHONDIR: C:\Python27-x64
+ PYTHON_VERSION: 2.7.x
+ PYTHON_ARCH: 64
- - PYTHONDIR: "C:\\Python34"
- PYTHON_VERSION: "3.4.x"
- PYTHON_ARCH: "32"
+ - PYTHONDIR: C:\Python35
+ PYTHON_VERSION: 3.5.x
+ PYTHON_ARCH: 32
- - PYTHONDIR: "C:\\Python34-x64"
- PYTHON_VERSION: "3.4.x"
- PYTHON_ARCH: "64"
+ - PYTHONDIR: C:\Python35-x64
+ PYTHON_VERSION: 3.5.x
+ PYTHON_ARCH: 64
- - PYTHONDIR: "C:\\Python35"
- PYTHON_VERSION: "3.5.x"
- PYTHON_ARCH: "32"
+ - PYTHONDIR: C:\Python36
+ PYTHON_VERSION: 3.6.x
+ PYTHON_ARCH: 32
- - PYTHONDIR: "C:\\Python35-x64"
- PYTHON_VERSION: "3.5.x"
- PYTHON_ARCH: "64"
- # add path required to run preprocessor step
- PATH_EXTRAS: "c:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin"
+ - PYTHONDIR: C:\Python36-x64
+ PYTHON_VERSION: 3.6.x
+ PYTHON_ARCH: 64
+ - PYTHONDIR: C:\Python37
+ PYTHON_VERSION: 3.7.x
+ PYTHON_ARCH: 32
+
+ - PYTHONDIR: C:\Python37-x64
+ PYTHON_VERSION: 3.7.x
+ PYTHON_ARCH: 64
+
install:
- ECHO "Installed SDKs:"
- ps: "ls \"C:/Program Files/Microsoft SDKs/Windows\""
+ - "SET PATH=%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%"
+
+ - if [%PYTHON_ARCH%]==[64] SET PATH=%CUSTOM64PATH%;%PATH%
+
# Check that we have the expected version and architecture for Python
- - "%PYTHONDIR%\\python.exe --version"
- - "%PYTHONDIR%\\python.exe -c \"import struct; print(struct.calcsize('P') * 8)\""
+ - "python --version"
+ - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
- - "%PYTHONDIR%\\python.exe -m pip install --disable-pip-version-check --user --upgrade pip"
- - "%PYTHONDIR%\\python.exe -m pip install --upgrade setuptools"
+ - "python -m pip install --disable-pip-version-check --user --upgrade pip"
+ - "python -m pip install --upgrade setuptools"
# We need wheel installed to build wheels
- - "%PYTHONDIR%\\python.exe -m pip install wheel"
+ - "python -m pip install wheel"
- - "SET PATH=%PATH_EXTRAS%;%PYTHONDIR%;%PYTHONDIR%\\Scripts;%PATH%"
+ - "pip install -r requirements.txt"
before_build:
- "bash scripts/get_waf.sh"
build_script:
+ # also build libaubio with waf
+ - python waf configure build install --verbose --msvc_version="msvc 14.0"
+ # clean before building python package
+ - python waf distclean
# build python module without using libaubio
- - "%PYTHONDIR%\\python.exe -m pip install -r requirements.txt"
- - "python setup.py build"
- - "%PYTHONDIR%\\python.exe -m pip install ."
+ - pip wheel -v -v -v --wheel-dir=dist .
+ # build, upload and install wheel (inspired by numpy's appveyor)
+ - ps: |
+ pip wheel -v -v -v --wheel-dir=dist .
+ ls dist -r | Foreach-Object {
+ Push-AppveyorArtifact $_.FullName
+ pip install $_.FullName
+ }
+
+test_script:
- "python python\\demos\\demo_create_test_sounds.py"
- "nose2 --verbose"
- # clean up
- - "python waf distclean"
- # build libaubio
- - python waf configure build --verbose --msvc_version="msvc 14.0"
--- a/.gitignore
+++ b/.gitignore
@@ -43,6 +43,7 @@
aubio-*.tar.bz2
aubio-*.zip
dist/*.tar.gz
+dist/*.whl
# test sounds
python/tests/sounds
--- a/python/lib/gen_external.py
+++ b/python/lib/gen_external.py
@@ -85,6 +85,12 @@
def get_c_declarations(header=header, usedouble=False):
''' return a dense and preprocessed string of all c declarations implied by aubio.h
'''
+ cpp_output = get_cpp_output(header=header, usedouble=usedouble)
+ return filter_cpp_output (cpp_output)
+
+
+def get_cpp_output(header=header, usedouble=False):
+ ''' find and run a C pre-processor on aubio.h '''
cpp_cmd = get_preprocessor()
macros = [('AUBIO_UNSTABLE', 1)]
@@ -105,14 +111,25 @@
assert proc, 'Proc was none'
cpp_output = proc.stdout.read()
err_output = proc.stderr.read()
+ if err_output:
+ print("Warning: preprocessor produced errors or warnings:\n%s" \
+ % err_output.decode('utf8'))
if not cpp_output:
- raise Exception("preprocessor output is empty:\n%s" % err_output)
- elif err_output:
- print("Warning: preprocessor produced warnings:\n%s" % err_output)
+ raise_msg = "preprocessor output is empty! Running command " \
+ + "\"%s\" failed" % " ".join(cpp_cmd)
+ if err_output:
+ raise_msg += " with stderr: \"%s\"" % err_output.decode('utf8')
+ else:
+ raise_msg += " with no stdout or stderr"
+ raise Exception(raise_msg)
if not isinstance(cpp_output, list):
cpp_output = [l.strip() for l in cpp_output.decode('utf8').split('\n')]
- cpp_output = filter(lambda y: len(y) > 1, cpp_output)
+ return cpp_output
+
+def filter_cpp_output(cpp_raw_output):
+ ''' prepare cpp-output for parsing '''
+ cpp_output = filter(lambda y: len(y) > 1, cpp_raw_output)
cpp_output = list(filter(lambda y: not y.startswith('#'), cpp_output))
i = 1