-
Notifications
You must be signed in to change notification settings - Fork 33
/
setup.py
89 lines (71 loc) · 2.29 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
import os
import platform
import setuptools
# Include only the platform specific pre-compiled binary.
# For sources see https://github.com/audeering/opensmile
def platform_name():
r"""Platform name used in pip tag.
Expected outcomes are:
==================== ======================
Linux, 64-bit manylinux_2_17_x86_64
Raspberry Pi, 32-bit manylinux_2_17_armv7l
Raspberry Pi, 64-bit manylinux_2_17_aarch64
Windows win_amd64
MacOS Intel macosx_10_4_x86_64
MacOS M1 macosx_11_0_arm64
==================== ======================
Under Linux the manylinux version
can be extracted
by inspecting the wheel
with ``auditwheel``.
Too see all supported tags on your system run:
.. code-block:: bash
$ pip debug --verbose
"""
system = platform.system()
machine = platform.machine().lower()
if system == "Linux": # pragma: no cover
system = "manylinux_2_17"
elif system == "Windows": # pragma: no cover
system = "win"
elif system == "Darwin": # pragma: no cover
if machine == "x86_64":
system = "macosx_10_4"
else:
system = "macosx_11_0"
else: # pragma: no cover
raise RuntimeError(f"Unsupported platform {system}")
return f"{system}_{machine}"
# Look for enrionment variable PLAT_NAME
# to be able to enforce
# different platform names
# in CI on the same runner
plat_name = os.environ.get("PLAT_NAME", platform_name())
if "linux" in plat_name:
library = "*.so"
elif "macos" in plat_name:
library = "*.dylib"
elif "win" in plat_name:
library = "*.dll"
setuptools.setup(
package_data={
"opensmile.core": [
f"bin/{plat_name}/{library}",
"config/compare/*",
"config/egemaps/v01a/*",
"config/egemaps/v01b/*",
"config/egemaps/v02/*",
"config/emobase/*",
"config/gemaps/v01a/*",
"config/gemaps/v01b/*",
"config/shared/*",
],
},
# python -m build --wheel
# does no longer accept the --plat-name option,
# but we can set the desired platform as an option
# (https://stackoverflow.com/a/75010995)
options={
"bdist_wheel": {"plat_name": plat_name},
},
)