~cnx/palace

5c932d2f0f0302f4349184f010a501284805bca8 — Nguyễn Gia Phong 11 months ago 566911e 0.2.3
Employ builds.sr.ht
16 files changed, 119 insertions(+), 209 deletions(-)

D .appveyor.yml
R .ci/before-build-manylinux2014 => .builds/before
A .builds/cp36.yml
A .builds/cp37.yml
A .builds/cp38.yml
A .builds/cp39.yml
D .ci/before-build-macos
D .ci/repair-whl-macos
D .github/FUNDING.yml
D .github/workflows/docs.yml
D .github/workflows/lint.yml
D .travis.yml
M setup.cfg
M tests/functional/test_examples.py
M tests/functional/test_message_handling.py
M tox.ini
D .appveyor.yml => .appveyor.yml +0 -24
@@ 1,24 0,0 @@
branches:
  only:
    - master
    - /^\d+(\.\d+)+((a|b|rc)\d+)?(\.post\d+)?(\.dev\d+)?$/

environment:
  global:
    APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
    Alure2_DIR: C:\Program Files (x86)\alure\lib\cmake\Alure2
  matrix:
    - CIBW_BUILD: cp36-win_amd64
    - CIBW_BUILD: cp37-win_amd64
    - CIBW_BUILD: cp38-win_amd64

install:
  - curl "https://openal-soft.org/openal-binaries/openal-soft-1.20.1-bin.zip" -o openal-soft-1.20.1-bin.zip
  - 7z x -o%APPVEYOR_BUILD_FOLDER%\.. openal-soft-1.20.1-bin.zip
  - set OPENALDIR=%APPVEYOR_BUILD_FOLDER%\..\openal-soft-1.20.1-bin
  - git clone https://github.com/kcat/alure %APPVEYOR_BUILD_FOLDER%\..\alure
  - cmake -A x64 -S %APPVEYOR_BUILD_FOLDER%\..\alure -B %APPVEYOR_BUILD_FOLDER%\..\alure\build
  - cmake --build %APPVEYOR_BUILD_FOLDER%\..\alure\build --config Release --target install
  - py -3 -m pip install cibuildwheel

build_script: echo py -3 -m cibuildwheel --output-dir wheelhouse

R .ci/before-build-manylinux2014 => .builds/before +0 -0
A .builds/cp36.yml => .builds/cp36.yml +29 -0
@@ 0,0 1,29 @@
image: debian/sid
packages:
  - docker.io
  - python3-pip
sources:
  - https://git.sr.ht/~cnx/palace
tasks:
  - cfg: sudo usermod -aG docker $(whoami)
  - ci: |
      cd palace
      python3 -m pip install cibuildwheel
      python3 -m cibuildwheel --output-dir=dist
  - cd: |
      cd palace
      if [[ $(git tag --points-at HEAD) ]]
      then
        python3 -m pip install twine
        twine upload dist/*.whl
      fi
environment:
  PIP_PROGRESS_BAR: 'off'
  CIBW_PLATFORM: linux
  CIBW_BUILD: cp36-manylinux_x86_64
  CIBW_BEFORE_BUILD: .builds/before
  CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
  CIBW_TEST_COMMAND: tox -c {project}
  CIBW_TEST_REQUIRES: tox
secrets:
  - d5fcfb32-28a9-4a3c-9012-aa68b4b887ff

A .builds/cp37.yml => .builds/cp37.yml +29 -0
@@ 0,0 1,29 @@
image: debian/sid
packages:
  - docker.io
  - python3-pip
sources:
  - https://git.sr.ht/~cnx/palace
tasks:
  - cfg: sudo usermod -aG docker $(whoami)
  - ci: |
      cd palace
      python3 -m pip install cibuildwheel
      python3 -m cibuildwheel --output-dir=dist
  - cd: |
      cd palace
      if [[ $(git tag --points-at HEAD) ]]
      then
        python3 -m pip install twine
        twine upload dist/*.whl
      fi
environment:
  PIP_PROGRESS_BAR: 'off'
  CIBW_PLATFORM: linux
  CIBW_BUILD: cp37-manylinux_x86_64
  CIBW_BEFORE_BUILD: .builds/before
  CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
  CIBW_TEST_COMMAND: tox -c {project}
  CIBW_TEST_REQUIRES: tox
secrets:
  - d5fcfb32-28a9-4a3c-9012-aa68b4b887ff

A .builds/cp38.yml => .builds/cp38.yml +29 -0
@@ 0,0 1,29 @@
image: debian/sid
packages:
  - docker.io
  - python3-pip
sources:
  - https://git.sr.ht/~cnx/palace
tasks:
  - cfg: sudo usermod -aG docker $(whoami)
  - ci: |
      cd palace
      python3 -m pip install cibuildwheel
      python3 -m cibuildwheel --output-dir=dist
  - cd: |
      cd palace
      if [[ $(git tag --points-at HEAD) ]]
      then
        python3 -m pip install twine
        twine upload dist/*.whl
      fi
environment:
  PIP_PROGRESS_BAR: 'off'
  CIBW_PLATFORM: linux
  CIBW_BUILD: cp38-manylinux_x86_64
  CIBW_BEFORE_BUILD: .builds/before
  CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
  CIBW_TEST_COMMAND: tox -c {project}
  CIBW_TEST_REQUIRES: tox
secrets:
  - d5fcfb32-28a9-4a3c-9012-aa68b4b887ff

A .builds/cp39.yml => .builds/cp39.yml +29 -0
@@ 0,0 1,29 @@
image: debian/sid
packages:
  - docker.io
  - python3-pip
sources:
  - https://git.sr.ht/~cnx/palace
tasks:
  - cfg: sudo usermod -aG docker $(whoami)
  - ci: |
      cd palace
      python3 -m pip install cibuildwheel
      python3 -m cibuildwheel --output-dir=dist
  - cd: |
      cd palace
      if [[ $(git tag --points-at HEAD) ]]
      then
        python3 -m pip install twine
        twine upload dist/*.whl
      fi
environment:
  PIP_PROGRESS_BAR: 'off'
  CIBW_PLATFORM: linux
  CIBW_BUILD: cp39-manylinux_x86_64
  CIBW_BEFORE_BUILD: .builds/before
  CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
  CIBW_TEST_COMMAND: tox -c {project}
  CIBW_TEST_REQUIRES: tox
secrets:
  - d5fcfb32-28a9-4a3c-9012-aa68b4b887ff

D .ci/before-build-macos => .ci/before-build-macos +0 -7
@@ 1,7 0,0 @@
#!/bin/sh
set -ex
git clone --depth 1 https://github.com/kcat/alure /tmp/alure
OPENALDIR=$(brew --prefix openal-soft) cmake -DCMAKE_FIND_FRAMEWORK=NEVER \
  -S /tmp/alure -B /tmp/alure/build
sudo cmake --build /tmp/alure/build --parallel $(sysctl -n hw.ncpu) \
  --config Release --target install

D .ci/repair-whl-macos => .ci/repair-whl-macos +0 -12
@@ 1,12 0,0 @@
#!/bin/sh
set -ex
cd $(mktemp -d)
unzip $1
DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib delocate-path -L palace.dylibs .
wheel=$(basename $1)
zip -r $wheel *
mkdir -p $2
mv $wheel $2
tempdir=$(pwd)
cd -
rm -rf $tempdir

D .github/FUNDING.yml => .github/FUNDING.yml +0 -12
@@ 1,12 0,0 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: __huy_ngo__
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: McSinyx
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

D .github/workflows/docs.yml => .github/workflows/docs.yml +0 -48
@@ 1,48 0,0 @@
name: Deploy documentation

on:
  push:
    branches:
    - master
    paths:
    - .github/workflows/*
    - docs/**
    - src/**

jobs:
  docs:
    runs-on: ubuntu-latest

    steps:
    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.9

    - name: Checkout palace
      uses: actions/checkout@v2

    - name: Checkout alure
      uses: actions/checkout@v2
      with:
        repository: kcat/alure
        path: alure

    - name: Install dependencies
      run: |
        sudo apt install \
          cmake libopenal-dev libvorbis-dev libopusfile-dev libsndfile1-dev
        cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -S alure -B alure/build
        sudo cmake --build alure/build --parallel `nproc` --target install
        rm -fr alure
        python -m pip install Sphinx sphinx_rtd_theme .

    - name: Build site
      working-directory: docs
      run: make html

    - name: Deploy site
      uses: peaceiris/actions-gh-pages@v3
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        publish_dir: ./docs/build/html

D .github/workflows/lint.yml => .github/workflows/lint.yml +0 -28
@@ 1,28 0,0 @@
name: Quick check

on:
  push:
    branches:
    - master
  pull_request:
    branches:
    - master

jobs:
  lint:
    runs-on: ubuntu-latest

    steps:
    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        python-version: 3.9

    - name: Install tox
      run: python -m pip install tox

    - name: Checkout
      uses: actions/checkout@v2

    - name: Main check
      run: python -m tox -e lint

D .travis.yml => .travis.yml +0 -51
@@ 1,51 0,0 @@
branches:
  only:
    - master
    - /^\d+(\.\d+)+((a|b|rc)\d+)?(\.post\d+)?(\.dev\d+)?$/

language: python

env:
  global:
    - TWINE_USERNAME=__token__
    - MACOSX_DEPLOYMENT_TARGET=10.9
    - CIBW_BEFORE_BUILD_MACOS=.ci/before-build-macos
    - CIBW_BEFORE_BUILD_LINUX=.ci/before-build-manylinux2014
    - CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014
    - CIBW_REPAIR_WHEEL_COMMAND_MACOS=".ci/repair-whl-macos {wheel} {dest_dir}"
    - CIBW_TEST_REQUIRES=tox
    - CIBW_TEST_COMMAND="tox -c {project}"

addons:
  homebrew:
    packages:
      - openal-soft
      - libvorbis
      - opusfile
      - libsndfile

install: python3 -m pip install twine cibuildwheel

jobs:
  include:
    - os: osx
      osx_image: xcode11.3
      language: shell
      env: CIBW_BUILD=cp36-macosx_x86_64
    - services: docker
      env: CIBW_BUILD="cp36-manylinux_x86_64 cp36-manylinux_aarch64"
    - services: docker
      env: CIBW_BUILD="cp37-manylinux_x86_64 cp37-manylinux_aarch64"
    - services: docker
      env: CIBW_BUILD="cp38-manylinux_x86_64 cp38-manylinux_aarch64"
    - services: docker
      env: CIBW_BUILD="cp39-manylinux_x86_64 cp39-manylinux_aarch64"

script: python3 -m cibuildwheel --output-dir=dist

deploy:
  skip_cleanup: true
  provider: script
  script: twine upload dist/*.whl
  on:
    tags: true

M setup.cfg => setup.cfg +1 -1
@@ 1,6 1,6 @@
[metadata]
name = palace
version = 0.2.2
version = 0.2.3
url = https://mcsinyx.github.io/palace
author = Nguyễn Gia Phong
author_email = mcsinyx@disroot.org

M tests/functional/test_examples.py => tests/functional/test_examples.py +0 -10
@@ 17,9 17,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with palace.  If not, see <https://www.gnu.org/licenses/>.

from os import environ
from os.path import abspath, dirname, join
from platform import system
from random import choices
from subprocess import PIPE, run, CalledProcessError
from sys import executable


@@ 42,16 40,12 @@ REVERB_PRESETS = choices(reverb_preset_names, k=5)
WAVEFORMS = ['sine', 'square', 'sawtooth',
             'triangle', 'impulse', 'white-noise']

travis_macos = bool(environ.get('TRAVIS')) and system() == 'Darwin'
skipif_travis_macos = mark.skipif(travis_macos, reason='Travis CI for macOS')


def capture(*argv):
    """Return the captured standard output of given Python script."""
    return run([executable, *argv], stdout=PIPE).stdout.decode()


@skipif_travis_macos
def test_event(aiff, flac, mp3, ogg, wav):
    """Test the event handling example."""
    event = capture(EVENT, aiff, flac, mp3, ogg, wav)


@@ 63,7 57,6 @@ def test_event(aiff, flac, mp3, ogg, wav):
    assert f'Playing {wav}' in event


@skipif_travis_macos
def test_hrtf(ogg):
    """Test the HRTF example."""
    hrtf = capture(HRTF, ogg)


@@ 78,7 71,6 @@ def test_info():
        run([executable, INFO, MADEUP_DEVICE], check=True)


@skipif_travis_macos
def test_latency(mp3):
    """Test the latency example."""
    latency = capture(LATENCY, mp3)


@@ 87,7 79,6 @@ def test_latency(mp3):
    assert 'Offset' in latency


@skipif_travis_macos
@mark.parametrize('preset', REVERB_PRESETS)
def test_reverb(preset, flac):
    """Test the reverb example."""


@@ 97,7 88,6 @@ def test_reverb(preset, flac):
    assert f'Loading reverb preset {preset}' in reverb


@skipif_travis_macos
def test_stdec(aiff):
    """Test the stdec example."""
    stdec = capture(STDEC, aiff)

M tests/functional/test_message_handling.py => tests/functional/test_message_handling.py +0 -9
@@ 17,8 17,6 @@
# along with palace.  If not, see <https://www.gnu.org/licenses/>.

import aifc
from os import environ
from platform import system
from unittest.mock import Mock
from uuid import uuid4



@@ 27,10 25,6 @@ from palace import (channel_configs, sample_types, decode,
from pytest import mark


travis_macos = bool(environ.get('TRAVIS')) and system() == 'Darwin'
skipif_travis_macos = mark.skipif(travis_macos, reason='Travis CI for macOS')


def mock(message):
    """Return the MessageHandler corresponding to the given message."""
    return type(''.join(map(str.capitalize, message.split('_'))),


@@ 42,7 36,6 @@ def test_device_diconnected():
    """Test the handling of device disconnected message."""


@skipif_travis_macos
def test_source_stopped(wav):
    """Test the handling of source stopped message."""
    with Device() as device, Context(device) as context, Buffer(wav) as buffer:


@@ 53,7 46,6 @@ def test_source_stopped(wav):
            context.message_handler.source_stopped.assert_called_with(source)


@skipif_travis_macos
def test_source_force_stopped(ogg):
    """Test the handling of source force stopped message."""
    with Device() as device, Context(device) as context:


@@ 69,7 61,6 @@ def test_source_force_stopped(ogg):
        source.destroy()


@skipif_travis_macos
def test_buffer_loading(aiff):
    """Test the handling of buffer loading message."""
    with Device() as device, Context(device) as context:

M tox.ini => tox.ini +2 -7
@@ 8,14 8,9 @@ deps =
    Cython
    scipy
    pytest-cov
commands = pytest
    pytest-flake8
commands = pytest --flake8
setenv = CYTHON_TRACE = 1
passenv = TRAVIS

[testenv:lint]
skip_install = true
deps = flake8
commands = flake8

[flake8]
filename = *.pxd, *.pyx, *.py