Skip to content

Commit 397cddc

Browse files
committed
Reorganize cibuildwheel config files, monkey patch package name in pyproject.toml
1 parent 079f416 commit 397cddc

File tree

4 files changed

+86
-99
lines changed

4 files changed

+86
-99
lines changed

.github/workflows/build-wheels-cibuildwheel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
os: [ubuntu-22.04, macos-13, macos-15]
12-
config: [pyproject, pyproject-tensorflow]
12+
config: [cibuildwheel, cibuildwheel-tensorflow]
1313

1414
steps:
1515
- uses: actions/checkout@v4
Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
[tool.cibuildwheel]
2+
3+
before-all = [
4+
# Monkey-patch package name. We could have a separate pyproject.toml configuration, but the build backend does not accept custom configuration filepaths.
5+
"sed -i 's/^name *= *\"essentia\"$/name = \"essentia-tensorflow\"/' pyproject.toml"
6+
]
7+
8+
19
[tool.cibuildwheel.linux]
210

311
manylinux-x86_64-image = "mtgupf/essentia-builds:manylinux2014_x86_64"
@@ -13,7 +21,7 @@ before-all = [
1321
"PYBIN=/opt/python/cp36-cp36m/bin/",
1422
"\"${PYBIN}/python\" waf configure --with-gaia --with-tensorflow --build-static --static-dependencies --pkg-config-path=\"${PKG_CONFIG_PATH}\"",
1523
"\"${PYBIN}/python\" waf",
16-
"\"${PYBIN}/python\" waf install"
24+
"\"${PYBIN}/python\" waf install",
1725
]
1826

1927
test-command = "python -c 'import essentia; import essentia.standard; import essentia.streaming; from essentia.standard import MonoLoader, MetadataReader, YamlInput, Chromaprinter, TensorflowPredict'"
@@ -96,23 +104,3 @@ repair-wheel-command = [
96104
"wheel_rel=$(echo {wheel} | grep -o '[^/]*$')",
97105
"cd {dest_dir} && zip -u {dest_dir}/$wheel_rel essentia/.dylibs/*"
98106
]
99-
100-
101-
[build-system]
102-
requires = [
103-
"wheel >= 0.29.0",
104-
"setuptools >= 48",
105-
"numpy>=2.0.0rc1",
106-
"six",
107-
]
108-
build-backend = "setuptools.build_meta"
109-
110-
[project]
111-
name="essentia-tensorflow"
112-
license = "AGPL-3.0-only"
113-
dynamic = ["version", "description", "readme", "authors", "keywords", "classifiers", "urls"]
114-
dependencies = [
115-
"numpy>=1.25",
116-
"pyyaml",
117-
"six",
118-
]

cibuildwheel.toml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
[tool.cibuildwheel]
2+
3+
[tool.cibuildwheel.linux]
4+
manylinux-x86_64-image = "mtgupf/essentia-builds:manylinux2014_x86_64"
5+
manylinux-i686-image = "mtgupf/essentia-builds:manylinux2014_i686"
6+
7+
skip = ["pp*", "*-musllinux*", "*i686", "*cp36*", "*cp37*", "*cp38*"]
8+
9+
environment = { PROJECT_NAME="essentia", ESSENTIA_PROJECT_NAME="${PROJECT_NAME}", ESSENTIA_WHEEL_SKIP_3RDPARTY=1, ESSENTIA_WHEEL_ONLY_PYTHON=1 }
10+
11+
before-all = [
12+
"PYBIN=/opt/python/cp36-cp36m/bin/",
13+
"\"${PYBIN}/python\" waf configure --with-gaia --build-static --static-dependencies --pkg-config-path=\"${PKG_CONFIG_PATH}\"",
14+
"\"${PYBIN}/python\" waf",
15+
"\"${PYBIN}/python\" waf install"
16+
]
17+
18+
test-command = "python -c 'import essentia; import essentia.standard; import essentia.streaming; from essentia.standard import MonoLoader, MetadataReader, YamlInput, Chromaprinter'"
19+
20+
21+
[tool.cibuildwheel.macos]
22+
23+
skip = ["pp*", "*cp36*", "*cp37*", "*cp38*"]
24+
25+
environment = { PROJECT_NAME="essentia", ESSENTIA_PROJECT_NAME="${PROJECT_NAME}", ESSENTIA_WHEEL_SKIP_3RDPARTY=1, ESSENTIA_WHEEL_ONLY_PYTHON=1, MACOSX_DEPLOYMENT_TARGET=13.0 }
26+
27+
before-all = [
28+
"brew install pkg-config gcc readline sqlite gdbm freetype libpng",
29+
"brew install eigen libyaml fftw ffmpeg@2.8 libsamplerate libtag",
30+
"brew link --force ffmpeg@2.8",
31+
"brew install chromaprint",
32+
"brew link --overwrite ffmpeg@2.8",
33+
#"brew tap MTG/essentia",
34+
#"brew install gaia --HEAD",
35+
# Override VIRTUAL_ENV set by cibuildwheel to ensure global install
36+
"VIRTUAL_ENV=/usr/local python waf configure --pkg-config-path=\"${PKG_CONFIG_PATH}\"",
37+
"python waf",
38+
"python waf install"
39+
]
40+
41+
test-command = "python -c 'import essentia; import essentia.standard; import essentia.streaming; from essentia.standard import MonoLoader, MetadataReader, YamlInput, Chromaprinter'"
42+
43+
[[tool.cibuildwheel.overrides]]
44+
select = "*macosx_arm64*"
45+
46+
skip = ["pp*", "*cp36*", "*cp37*", "*cp38*"]
47+
48+
environment = { PROJECT_NAME="essentia", ESSENTIA_PROJECT_NAME="${PROJECT_NAME}", ESSENTIA_WHEEL_SKIP_3RDPARTY=1, ESSENTIA_WHEEL_ONLY_PYTHON=1, ESSENTIA_MACOSX_ARM64=1, MACOSX_DEPLOYMENT_TARGET=15.0 }
49+
50+
before-all = [
51+
"brew install pkg-config gcc readline sqlite gdbm libpng",
52+
"brew install eigen libyaml fftw ffmpeg@2.8 libsamplerate libtag",
53+
"brew link --force ffmpeg@2.8",
54+
"brew install chromaprint",
55+
"brew link --overwrite ffmpeg@2.8",
56+
# Override VIRTUAL_ENV set by cibuildwheel to ensure global install
57+
"VIRTUAL_ENV=/usr/local python waf configure --pkg-config-path=\"${PKG_CONFIG_PATH}\" --arch arm64 --no-msse",
58+
"python waf",
59+
"sudo python waf install",
60+
]
61+
62+
# On Mac arm64, libavcodec.56.60.100, libavformat.56.40.101 and
63+
# libavutil.54.31.100, depend on libSDL1.2-compat, which is a compatibility
64+
# layer for SDL2. libSDL1.2-compat expects SDL2 to be installed in the default
65+
# brew location (i.e., /opt/homebrew/opt/sdl2/lib), so the user would need to
66+
# install it via brew manually. Alternativelly, we can manualy copy the SDL2
67+
# libs into the wheel. This is a temporary solution, and in the long term we
68+
# should move to FFmpeg > 2.X.
69+
repair-wheel-command = [
70+
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}",
71+
"mkdir -p {dest_dir}/essentia/.dylibs",
72+
"cp /opt/homebrew/opt/sdl2/lib/libSDL2*.dylib {dest_dir}/essentia/.dylibs",
73+
"wheel_rel=$(echo {wheel} | grep -o '[^/]*$')",
74+
"cd {dest_dir} && zip -u {dest_dir}/$wheel_rel essentia/.dylibs/*"
75+
]

pyproject.toml

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,3 @@
1-
[tool.cibuildwheel]
2-
3-
[tool.cibuildwheel.linux]
4-
manylinux-x86_64-image = "mtgupf/essentia-builds:manylinux2014_x86_64"
5-
manylinux-i686-image = "mtgupf/essentia-builds:manylinux2014_i686"
6-
7-
skip = ["pp*", "*-musllinux*", "*i686", "*cp36*", "*cp37*", "*cp38*"]
8-
9-
environment = { PROJECT_NAME="essentia", ESSENTIA_PROJECT_NAME="${PROJECT_NAME}", ESSENTIA_WHEEL_SKIP_3RDPARTY=1, ESSENTIA_WHEEL_ONLY_PYTHON=1 }
10-
11-
before-all = [
12-
"PYBIN=/opt/python/cp36-cp36m/bin/",
13-
"\"${PYBIN}/python\" waf configure --with-gaia --build-static --static-dependencies --pkg-config-path=\"${PKG_CONFIG_PATH}\"",
14-
"\"${PYBIN}/python\" waf",
15-
"\"${PYBIN}/python\" waf install"
16-
]
17-
18-
test-command = "python -c 'import essentia; import essentia.standard; import essentia.streaming; from essentia.standard import MonoLoader, MetadataReader, YamlInput, Chromaprinter'"
19-
20-
21-
[tool.cibuildwheel.macos]
22-
23-
skip = ["pp*", "*cp36*", "*cp37*", "*cp38*"]
24-
25-
environment = { PROJECT_NAME="essentia", ESSENTIA_PROJECT_NAME="${PROJECT_NAME}", ESSENTIA_WHEEL_SKIP_3RDPARTY=1, ESSENTIA_WHEEL_ONLY_PYTHON=1, MACOSX_DEPLOYMENT_TARGET=13.0 }
26-
27-
before-all = [
28-
"brew install pkg-config gcc readline sqlite gdbm freetype libpng",
29-
"brew install eigen libyaml fftw ffmpeg@2.8 libsamplerate libtag",
30-
"brew link --force ffmpeg@2.8",
31-
"brew install chromaprint",
32-
"brew link --overwrite ffmpeg@2.8",
33-
#"brew tap MTG/essentia",
34-
#"brew install gaia --HEAD",
35-
# Override VIRTUAL_ENV set by cibuildwheel to ensure global install
36-
"VIRTUAL_ENV=/usr/local python waf configure --pkg-config-path=\"${PKG_CONFIG_PATH}\"",
37-
"python waf",
38-
"python waf install"
39-
]
40-
41-
test-command = "python -c 'import essentia; import essentia.standard; import essentia.streaming; from essentia.standard import MonoLoader, MetadataReader, YamlInput, Chromaprinter'"
42-
43-
[[tool.cibuildwheel.overrides]]
44-
select = "*macosx_arm64*"
45-
46-
skip = ["pp*", "*cp36*", "*cp37*", "*cp38*"]
47-
48-
environment = { PROJECT_NAME="essentia", ESSENTIA_PROJECT_NAME="${PROJECT_NAME}", ESSENTIA_WHEEL_SKIP_3RDPARTY=1, ESSENTIA_WHEEL_ONLY_PYTHON=1, ESSENTIA_MACOSX_ARM64=1, MACOSX_DEPLOYMENT_TARGET=15.0 }
49-
50-
before-all = [
51-
"brew install pkg-config gcc readline sqlite gdbm libpng",
52-
"brew install eigen libyaml fftw ffmpeg@2.8 libsamplerate libtag",
53-
"brew link --force ffmpeg@2.8",
54-
"brew install chromaprint",
55-
"brew link --overwrite ffmpeg@2.8",
56-
# Override VIRTUAL_ENV set by cibuildwheel to ensure global install
57-
"VIRTUAL_ENV=/usr/local python waf configure --pkg-config-path=\"${PKG_CONFIG_PATH}\" --arch arm64 --no-msse",
58-
"python waf",
59-
"sudo python waf install",
60-
]
61-
62-
# On Mac arm64, libavcodec.56.60.100, libavformat.56.40.101 and
63-
# libavutil.54.31.100, depend on libSDL1.2-compat, which is a compatibility
64-
# layer for SDL2. libSDL1.2-compat expects SDL2 to be installed in the default
65-
# brew location (i.e., /opt/homebrew/opt/sdl2/lib), so the user would need to
66-
# install it via brew manually. Alternativelly, we can manualy copy the SDL2
67-
# libs into the wheel. This is a temporary solution, and in the long term we
68-
# should move to FFmpeg > 2.X.
69-
repair-wheel-command = [
70-
"delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}",
71-
"mkdir -p {dest_dir}/essentia/.dylibs",
72-
"cp /opt/homebrew/opt/sdl2/lib/libSDL2*.dylib {dest_dir}/essentia/.dylibs",
73-
"wheel_rel=$(echo {wheel} | grep -o '[^/]*$')",
74-
"cd {dest_dir} && zip -u {dest_dir}/$wheel_rel essentia/.dylibs/*"
75-
]
76-
771
[build-system]
782
requires = [
793
"wheel >= 0.29.0",
@@ -84,7 +8,7 @@ requires = [
848
build-backend = "setuptools.build_meta"
859

8610
[project]
87-
name="essentia"
11+
name = "essentia"
8812
license = "AGPL-3.0-only"
8913
dynamic = ["version", "description", "readme", "authors", "keywords", "classifiers", "urls"]
9014
dependencies = [

0 commit comments

Comments
 (0)