Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 11 additions & 20 deletions build_wheels.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
import os
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a script, it should probably be executable and have a shebang?

import shutil

architectures = dict(darwin=['64bit'],
win32=['32bit', '64bit'],
noplatform='noarch')

def cleanup():
shutil.rmtree('build', ignore_errors=True)
try:
os.remove('_soundfile.py')
except:
pass

for platform, archs in architectures.items():
def make_wheel(platform, arch, dist):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name make_wheel is not quite accurate, since it's also used to make sdist.

os.system('python setup.py clean --all')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.system() is a bit old-school and could probably be replaced with subprocess.run() https://docs.python.org/3/library/subprocess.html#subprocess.run.
This would also provide a nice way to set the environment with env.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply using 'python' uses Python 2.7 on my (Debian Linux) system (which isn't really a problem but it was probably not intended).

You should probably use sys.executable instead.

os.environ['PYSOUNDFILE_PLATFORM'] = platform
for arch in archs:
os.environ['PYSOUNDFILE_ARCHITECTURE'] = arch
cleanup()
os.system('python setup.py bdist_wheel')

cleanup()
os.system('python setup.py sdist')
os.environ['PYSOUNDFILE_ARCHITECTURE'] = arch
os.system(f'python setup.py {dist}')

if __name__ == '__main__':
make_wheel('darwin', '64bit', 'bdist_wheel')
make_wheel('win32', '32bit', 'bdist_wheel')
make_wheel('win32', '64bit', 'bdist_wheel')
make_wheel('', '', 'bdist_wheel')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before running sdist, you should remove the egg-info directory, as I've done in https://github.com/spatialaudio/python-sounddevice/blob/master/make_dist.sh.

make_wheel('', '', 'sdist')
9 changes: 8 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
from setuptools.command.test import test as TestCommand
import sys

for line in open('soundfile.py'):
if line.startswith('__version__'):
exec(line)
break
else:
raise RuntimeException('No version number found')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a thing.


PYTHON_INTERPRETERS = '.'.join([
'cp26', 'cp27',
'cp32', 'cp33', 'cp34', 'cp35', 'cp36',
Expand Down Expand Up @@ -87,7 +94,7 @@ def get_tag(self):

setup(
name='SoundFile',
version='0.10.1',
version=__version__,
description='An audio library based on libsndfile, CFFI and NumPy',
author='Bastian Bechtold',
author_email='[email protected]',
Expand Down