-
Notifications
You must be signed in to change notification settings - Fork 27
/
setup.py
181 lines (158 loc) · 5.88 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
import os
import platform
from setuptools import setup
# "Import" __version__ from PyOgg's __init__.py. This allows us to
# query PyOgg's version from within Python too. For discussion on
# alternative techniques see
# https://packaging.python.org/guides/single-sourcing-package-version/
__version__ = 'unknown'
for line in open('pyogg/__init__.py'):
if line.startswith('__version__'):
exec(line)
break
# Eventually we may wish to be specific as to which interpreters we
# support. This could be done with the following:
# pythons = '.'.join([
# 'cp32', 'cp33', 'cp34', 'cp35', 'cp36', 'cp37', 'cp38', 'cp39',
# 'pp32', 'pp33', 'pp34', 'pp35', 'pp36', 'pp37',
# ])
# However, for the moment, we'll just say the we support all Python 2
# and Python 3 interpreters. For more information see
# https://www.python.org/dev/peps/pep-0425/#platform-tag
pythons = '.'.join(['py2', 'py3'])
# Environment variables for cross-platform package creation. Set the
# appropriate environment variable to override the current system's
# value.
system = os.environ.get(
'PYTHON_PYOGG_PLATFORM',
platform.system()
)
architecture = os.environ.get(
'PYTHON_PYOGG_ARCHITECTURE',
platform.architecture()[0]
)
# Define the shared libraries to include in the Wheel packages.
if system == 'Darwin':
print("Packaging shared libraries for macOS")
package_data = {
'pyogg': ["libs/macos/"+libname for libname in [
'libogg.0.dylib',
'libopus.0.dylib',
'libopusfile.0.dylib',
'libopusenc.0.dylib',
'libvorbis.0.dylib',
'libvorbisfile.3.dylib',
'libvorbisenc.2.dylib',
'libFLAC.8.dylib'
]]
}
zip_safe = False
elif system == 'Windows':
# This could be made dependent on 32/64-bit architectures, based
# on the achitecture variable above.
print("Packaging shared libraries for Windows")
print("achitecture:", architecture)
win_dirs = {
"32bit": "win32",
"64bit": "win_amd64"
}
win_dir = win_dirs[architecture]
package_data = {
'pyogg': ["libs/"+win_dir+"/"+libname for libname in [
'libFLAC.dll',
'ogg.dll',
'libvorbis.dll',
'libvorbisfile.dll',
'opus.dll',
'opusenc.dll',
'opusfile.dll',
'libssl-1_1-x64.dll',
'libcrypto-1_1-x64.dll'
]]
}
zip_safe = False
else:
print("Unknown system; not packaging any shared libraries")
package_data = {'pyogg': []}
zip_safe = True
# Include the py.typed file in package_data
package_data["pyogg"].append("py.typed")
# Override the 'bdist_wheel' command to create OS-dependent byt
# Python-independent wheels
try:
from wheel.bdist_wheel import bdist_wheel
except ImportError:
cmdclass = {}
else:
class bdist_wheel_half_pure(bdist_wheel):
"""Create OS-dependent, but Python-independent wheels."""
def get_tag(self):
abi = 'none'
if system == 'Darwin':
oses = 'macosx_10_6_x86_64'
elif system == 'Windows':
if architecture == '32bit':
oses = 'win32'
else:
oses = 'win_amd64'
else:
oses = 'any'
return pythons, abi, oses
cmdclass = {'bdist_wheel': bdist_wheel_half_pure}
setup(
name='PyOgg',
version=__version__,
description="Xiph.org's Ogg Vorbis, Opus and FLAC for Python",
long_description=open('docs/description.rst').read(),
long_description_content_type='text/x-rst',
url='https://github.com/Zuzu-Typ/PyOgg',
author='Zuzu_Typ',
author_email='[email protected]',
license='BSD 3-clause "New" or "Revised"',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
# Indicate who your project is intended for
'Intended Audience :: Developers',
'Topic :: Multimedia :: Sound/Audio',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: BSD License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
# What does your project relate to?
keywords='Xiph ogg vorbis opus flac sound playback audio',
# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=['pyogg'],
# The shared libraries to include are defined above
package_data=package_data,
zip_safe=zip_safe,
# List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[
],
# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
# for example:
# $ pip install -e .[dev,test]
# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
# have to be included in MANIFEST.in as well.
# Reference to the command class defined above
cmdclass=cmdclass,
)