Skip to content

Commit

Permalink
Merge pull request #35 from joextodd/fix/windows-pat
Browse files Browse the repository at this point in the history
Fix Windows install and test build
  • Loading branch information
joextodd committed Feb 26, 2021
2 parents c761b49 + 9646ad9 commit 4071540
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 1,326 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/test.yml
Expand Up @@ -10,14 +10,16 @@ on:

jobs:

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

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand All @@ -36,8 +38,26 @@ jobs:
parallel: true
flag-name: unittest

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Run tests
run: python3 setup.py test

windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Run tests
run: python setup.py test

coveralls_finish:
needs: unittest
needs: linux
runs-on: ubuntu-latest
steps:
- name: coveralls
Expand Down
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
__pycache__
*.pyc
*.pyd
build
dist
pysoundio.egg-info/
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
@@ -1,3 +1,3 @@
[submodule "pysoundio/libraries/windows"]
path = pysoundio/libraries/windows
url = git@github.com:cameronmaske/libsoundio-binaries.git
[submodule "pysoundio/libraries"]
path = pysoundio/libraries
url = git@github.com:joextodd/libsoundio-binaries.git
12 changes: 7 additions & 5 deletions MANIFEST.in
Expand Up @@ -7,10 +7,12 @@ include examples/sine.py
include tests/__init__.py
include tests/test_pysoundio.py
include pysoundio/builder/soundio.py
include pysoundio/include/soundio/*
include pysoundio/libraries/include/soundio/*
include pysoundio/libraries/darwin/*
include pysoundio/libraries/linux/*
include pysoundio/libraries/windows/win/x64/*
include pysoundio/libraries/windows/win/x86/*
exclude pysoundio/libraries/windows/.git
exclude pysoundio/libraries/windows/.gitignore
include pysoundio/libraries/win32/*
include pysoundio/libraries/win64/*
include pysoundio/libraries/rpiv6/*
include pysoundio/libraries/rpiv7/*
exclude pysoundio/libraries/.git
exclude **/.DS_Store
13 changes: 13 additions & 0 deletions pysoundio/__init__.py
Expand Up @@ -19,6 +19,19 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import os
import platform

from cffi import FFI

if platform.system() == 'Windows':
ffi = FFI()
base_path = os.path.dirname(os.path.abspath(__file__))
if platform.architecture()[0] == '32bit':
soundio = ffi.dlopen(os.path.join(base_path, 'libraries', 'win32', 'libsoundio.dll'))
elif platform.architecture()[0] == '64bit':
soundio = ffi.dlopen(os.path.join(base_path, 'libraries', 'win64', 'libsoundio.dll'))

from pysoundio._soundio.lib import ( # noqa: F401
SoundIoBackendNone, SoundIoBackendJack, SoundIoBackendPulseAudio,
SoundIoBackendAlsa, SoundIoBackendCoreAudio, SoundIoBackendWasapi,
Expand Down
27 changes: 20 additions & 7 deletions pysoundio/builder/soundio.py
Expand Up @@ -11,7 +11,7 @@

build_kwargs = {
'libraries': ['soundio'],
'include_dirs': ['./pysoundio/include'],
'include_dirs': ['./pysoundio/libraries/include'],
'library_dirs': []
}

Expand All @@ -24,16 +24,29 @@
]
elif platform.system() == 'Linux':
build_kwargs['library_dirs'].append('/usr/local/lib')
build_kwargs['library_dirs'].append('./pysoundio/libraries/linux')
if os.uname()[4].startswith('arm'):
cpuinfo = subprocess.check_output(['cat', '/proc/cpuinfo']).decode()
if 'neon' in cpuinfo:
architecture = 'rpi7'
else:
architecture = 'rpi6'
else:
architecture = 'linux'

build_kwargs['library_dirs'].append('./pysoundio/libraries/' + architecture)
build_kwargs['extra_link_args'] = [
'-Wl,-rpath=./pysoundio/libraries/linux',
f'-Wl,-rpath={site.getsitepackages()[0]}/pysoundio/libraries/linux'
'-Wl,-rpath=./pysoundio/libraries/' + architecture,
f'-Wl,-rpath={site.getsitepackages()[0]}/pysoundio/libraries/' + architecture
]
elif platform.system() == 'Windows':
if platform.machine().endswith('64'):
build_kwargs['library_dirs'].append(os.path.join(base_path, 'libraries', 'windows', 'win', 'x64'))
builder_path = os.path.dirname(os.path.realpath(__file__))
base_path = os.path.abspath(os.path.join(builder_path, os.pardir))
if platform.architecture()[0] == '32bit':
build_kwargs['library_dirs'].append(os.path.join(base_path, 'libraries', 'win32'))
elif platform.architecture()[0] == '64bit':
build_kwargs['library_dirs'].append(os.path.join(base_path, 'libraries', 'win64'))
else:
build_kwargs['library_dirs'].append(os.path.join(base_path, 'libraries', 'windows', 'win', 'x86'))
raise RuntimeError('Windows architecture %s is not supported' % platform.architecture()[0])
else:
raise RuntimeError('%s platform is not supported' % platform.system())

Expand Down
97 changes: 0 additions & 97 deletions pysoundio/include/soundio/endian.h

This file was deleted.

0 comments on commit 4071540

Please sign in to comment.