Skip to content

Commit

Permalink
Merge pull request #1 from Sonos-Inc/develop
Browse files Browse the repository at this point in the history
v1.0.0 review
  • Loading branch information
danieljonessonos authored Apr 15, 2021
2 parents a485947 + a429df1 commit 4516397
Show file tree
Hide file tree
Showing 54 changed files with 7,787 additions and 3 deletions.
28 changes: 28 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[run]
source = pyflac
relative_files = True
concurrency = thread

omit =
*/tests/*
.tox/*
setup.py
*/__init__.py
*/__main__.py
*/examples/*
*/libraries/*
*/builder/*

[report]
omit =
*/tests/*
.tox/*
setup.py
*/__init__.py
*/__main__.py
*/examples/*
*/libraries/*
*/builder/*
exclude_lines =
pragma: no cover
raise NotImplementedError
146 changes: 146 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: build

on:
workflow_dispatch:
inputs:
version:
description: 'The version of libFLAC to build'
required: false
default: '1.3.3'
debug:
description: 'Enable debug'
required: false
default: 'no'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y \
autoconf \
clang \
gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf \
libtool \
mingw-w64 \
patchelf \
wget
- name: Download libFLAC
run: |
wget https://ftp.osuosl.org/pub/xiph/releases/flac/flac-${{ github.event.inputs.version }}.tar.xz
- name: Build libFLAC (Linux)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-linux-x86_64
cd flac-linux-x86_64
CC=clang ./configure --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../linux-x86_64
cp src/libFLAC/.libs/libFLAC.so.8.3.0 ../linux-x86_64/libFLAC-8.3.0.so
cd ../linux-x86_64
patchelf --set-soname libFLAC-8.3.0.so libFLAC-8.3.0.so
- name: Upload Linux library
uses: actions/upload-artifact@v1
with:
name: linux-x86_64
path: linux-x86_64

- name: Build libFLAC (Windows x64)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-windows-x86_64
cd flac-windows-x86_64
./configure --host=x86_64-w64-mingw32 --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../windows-x86_64
cp src/libFLAC/.libs/libFLAC-8.dll ../windows-x86_64/
cp src/libFLAC/.libs/libFLAC.dll.a ../windows-x86_64/FLAC-8.lib
- name: Upload Windows x64 library
uses: actions/upload-artifact@v1
with:
name: windows-x86_64
path: windows-x86_64

- name: Build libFLAC (Windows x86)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-windows-i686
cd flac-windows-i686
./configure --host=i686-w64-mingw32 --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../windows-i686
cp src/libFLAC/.libs/libFLAC-8.dll ../windows-i686/
cp src/libFLAC/.libs/libFLAC.dll.a ../windows-i686/FLAC-8.lib
- name: Upload Windows x64 library
uses: actions/upload-artifact@v1
with:
name: windows-i686
path: windows-i686

- name: Build libFLAC (Raspbian armv7a)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-raspbian-armv7a
cd flac-raspbian-armv7a
./configure --host=arm-linux-gnueabihf --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} CFLAGS="-mfpu=neon -march=armv7-a -mfloat-abi=hard" --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../raspbian-armv7a
cp src/libFLAC/.libs/libFLAC.so.8.3.0 ../raspbian-armv7a/libFLAC-8.3.0.so
cd ../raspbian-armv7a
patchelf --set-soname libFLAC-8.3.0.so libFLAC-8.3.0.so
- name: Upload Raspbian armv7a library
uses: actions/upload-artifact@v1
with:
name: raspbian-armv7a
path: raspbian-armv7a

- name: Build libFLAC (Raspbian armv6z)
run: |
tar xJf flac-${{ github.event.inputs.version }}.tar.xz
mv flac-${{ github.event.inputs.version }} flac-raspbian-armv6z
cd flac-raspbian-armv6z
./configure --host=arm-linux-gnueabihf --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} CFLAGS="-mfpu=vfp -mfloat-abi=hard" --enable-shared --disable-static --disable-examples
make
ls -l src/libFLAC/.libs
mkdir ../raspbian-armv6z
cp src/libFLAC/.libs/libFLAC.so.8.3.0 ../raspbian-armv6z/libFLAC-8.3.0.so
cd ../raspbian-armv6z
patchelf --set-soname libFLAC-8.3.0.so libFLAC-8.3.0.so
- name: Upload Raspbian armv6z library
uses: actions/upload-artifact@v1
with:
name: raspbian-armv6z
path: raspbian-armv6z

build_macos:
runs-on: macos-latest
steps:
- name: Install dependencies
run: brew install wget
- name: Download libFLAC
run: |
wget https://ftp.osuosl.org/pub/xiph/releases/flac/flac-${{ github.event.inputs.version }}.tar.xz
tar xvf flac-${{ github.event.inputs.version }}.tar.xz
- name: Build libFLAC
run: |
cd flac-${{ github.event.inputs.version }}
CC=clang ./configure --with-ogg=no --enable-debug=${{ github.event.inputs.debug }} --enable-shared --disable-static --disable-examples
make
mkdir ../darwin-x86_64
ls -l src/libFLAC/.libs
cp src/libFLAC/.libs/libFLAC.8.dylib ../darwin-x86_64/
cd ../darwin-x86_64
install_name_tool -id @rpath/libFLAC.8.dylib libFLAC.8.dylib
- name: Upload macOS library
uses: actions/upload-artifact@v1
with:
name: darwin-x86_64
path: darwin-x86_64
22 changes: 22 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: lint

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:

flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Lint the Python code
uses: TrueBrain/actions-flake8@master
with:
path: pyflac
60 changes: 60 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: tests

on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop

jobs:

linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.6', '3.7', '3.8', '3.9' ]

steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update -y
sudo apt-get install libsndfile1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tests
run: tox

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Run tests
run: tox

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Check install
run: python setup.py install
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ htmlcov/
.cache
nosetests.xml
coverage.xml
junit-report.xml
*.cover
*.py,cover
.hypothesis/
Expand Down Expand Up @@ -127,3 +128,19 @@ dmypy.json

# Pyre type checker
.pyre/

# VSCode
.vscode/

# macOS
.DS_Store

# CFFI
*.o
*.c

# Audio
*.flac

# Development
.archive
23 changes: 23 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: docs/requirements.txt

submodules:
exclude: all
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
pyFLAC Changelog
----------------

**v1.0.0**

* Added a `StreamEncoder` to compress raw audio data on-the-fly into a FLAC byte stream
* Added a `StreamDecoder` to decompress a FLAC byte stream back to raw audio data
* Added a `FileEncoder` to convert a WAV file to FLAC encoded data, optionally saving to a FLAC file
* Added a `FileDecoder` to convert a FLAC file to raw audio data, optionally saving to a WAV file
* Bundled with libFLAC version 1.3.3
49 changes: 49 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Contributing
------------

If you find any bugs or other things that need improvement,
or would like to add additional features, please create an issue or a pull request at
https://github.com/sonos/pyFLAC
Contributions are always welcome!

You get started, grab the latest version of the code from GitHub::

git clone https://github.com/sonos/pyFLAC.git
cd pyflac

To build the package for development::

python3 pyflac/builder/encoder.py

python3 pyflac/builder/decoder.py

you can also install your local copy with pip::

pip3 install .

Before submitting a pull request, make sure all tests are passing and the
test coverage has not been decreased.

Testing
-------

To run the test suite::

tox -r

Documentation
-------------

If you make changes to the documentation, you can locally re-create the HTML
pages using Sphinx_.
You can install it and the read the docs theme with::

pip3 install -r docs/requirements.txt

To create the HTML pages, use::

python3 setup.py build_sphinx

The generated files will be available in the directory ``docs/_build/html``.

.. _Sphinx: http://sphinx-doc.org/
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2021 Sonos, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 4516397

Please sign in to comment.