Skip to content

Commit 0e1558e

Browse files
committed
Change the suffix (macOS)
Remove the unnecessary files. Add VapourSynth autoload test.
1 parent 9cf8593 commit 0e1558e

3 files changed

Lines changed: 104 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,71 @@ jobs:
155155
output-dir: dist
156156
extras: uv
157157

158+
- name: Test macOS Wheel
159+
if: runner.os == 'macOS'
160+
run: |
161+
export HOMEBREW_NO_REQUIRE_TAP_TRUST=1
162+
brew install vapoursynth
163+
BREW_PREFIX=$(brew --prefix)
164+
165+
python3 -m venv test_env
166+
source test_env/bin/activate
167+
168+
export LIBRARY_PATH="$BREW_PREFIX/lib:$LIBRARY_PATH"
169+
export PKG_CONFIG_PATH="$BREW_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
170+
export DYLD_FALLBACK_LIBRARY_PATH="$BREW_PREFIX/lib:$DYLD_FALLBACK_LIBRARY_PATH"
171+
172+
pip install --upgrade pip
173+
pip install vapoursynth
174+
pip install dist/*macosx*.whl
175+
176+
python3 -c "import vapoursynth, os; core = vapoursynth.core; plugins = [p.name for p in core.plugins()]; print('Successfully loaded plugins:', plugins); p_dir = os.path.join(os.path.dirname(vapoursynth.__file__), 'plugins'); print('Contents of plugins directory:', os.listdir(p_dir) if os.path.exists(p_dir) else 'DIR NOT FOUND'); assert any('lsmash' in p.lower() for p in plugins), 'lsmashsource plugin failed to autoload!'"
177+
178+
#- name: Test macOS Wheel
179+
# if: runner.os == 'macOS'
180+
# run: |
181+
# export HOMEBREW_NO_REQUIRE_TAP_TRUST=1
182+
# brew install vapoursynth
183+
# BREW_PREFIX=$(brew --prefix)
184+
#
185+
# python3 -m venv test_env
186+
# source test_env/bin/activate
187+
#
188+
# export LIBRARY_PATH="$BREW_PREFIX/lib:$LIBRARY_PATH"
189+
# export PKG_CONFIG_PATH="$BREW_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
190+
# export DYLD_FALLBACK_LIBRARY_PATH="$BREW_PREFIX/lib:$DYLD_FALLBACK_LIBRARY_PATH"
191+
#
192+
# pip install --upgrade pip
193+
# pip install vapoursynth
194+
# pip install dist/*macosx*.whl
195+
#
196+
# echo "Locating installed plugin..."
197+
# # Use Python to find the exact path pip installed the .so file to
198+
# PLUGIN_PATH=$(python3 -c "import vapoursynth, os; print(os.path.join(os.path.dirname(vapoursynth.__file__), 'plugins', 'liblsmashsource.so'))")
199+
# echo "Plugin located at: $PLUGIN_PATH"
200+
#
201+
# echo "--- Checking dynamic dependencies (otool) ---"
202+
# # This shows what the plugin THINKS it needs
203+
# otool -L "$PLUGIN_PATH"
204+
#
205+
# echo "--- Forcing macOS dyld to load the plugin (ctypes) ---"
206+
# # This will intentionally crash and print the EXACT missing library or architecture error
207+
# python3 -c "import ctypes; ctypes.CDLL('$PLUGIN_PATH')"
208+
209+
- name: Test Linux Wheel
210+
if: runner.os == 'Linux'
211+
run: |
212+
python3 -m venv test_env
213+
source test_env/bin/activate
214+
215+
pip install --upgrade pip
216+
pip install vapoursynth
217+
218+
pip install dist/*manylinux*.whl
219+
220+
echo "Testing VapourSynth Autoloading..."
221+
python3 -c "import vapoursynth; core = vapoursynth.core; plugins = [p.name for p in core.plugins()]; print('Successfully loaded plugins:', plugins); assert any('lsmash' in p.lower() for p in plugins), 'Plugin failed to autoload!'; print('✅ SUCCESS: Plugin autoloaded correctly!')"
222+
158223
- uses: actions/upload-artifact@v7.0.1
159224
with:
160225
name: lsmashsource-${{ matrix.arch }}
@@ -202,6 +267,27 @@ jobs:
202267
python -m pip install build scikit-build-core --break-system-packages
203268
export LDFLAGS="-static-libgcc -static-libstdc++ -static"
204269
python -m build --wheel --outdir dist
270+
271+
- name: Test Windows Wheel
272+
run: |
273+
echo "Creating isolated Python virtual environment..."
274+
python -m venv test_env
275+
source test_env/bin/activate
276+
277+
echo "Installing VapourSynth via pip..."
278+
pip install --upgrade pip
279+
# Pulls the official, latest VapourSynth directly from PyPI
280+
pip install vapoursynth
281+
282+
echo "Installing the built wheel for testing..."
283+
pip install dist/*ucrt_gnu.whl
284+
285+
echo "Testing VapourSynth Autoloading on Windows..."
286+
python -c "import vapoursynth; core = vapoursynth.core; plugins = [p.name for p in core.plugins()]; print('Successfully loaded plugins:', plugins); assert any('lsmash' in p.lower() for p in plugins), 'Plugin failed to autoload!'; print('SUCCESS: Plugin autoloaded correctly!')"
287+
288+
- name: Retag Wheel for Distribution
289+
run: |
290+
echo "Test passed! Retagging wheel to win_amd64 for standard Windows users..."
205291
python -m wheel tags --platform-tag=win_amd64 --remove dist/*.whl
206292
207293
- uses: actions/upload-artifact@v7.0.1

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,10 @@ if (BUILD_AVS_PLUGIN OR BUILD_VS_PLUGIN OR BUILD_AU2_PLUGIN)
322322
set_target_properties(LSMASHSource PROPERTIES OUTPUT_NAME "lsmashsource.${ver}")
323323
endif()
324324
endif()
325+
326+
if (APPLE)
327+
set_target_properties(LSMASHSource PROPERTIES SUFFIX ".dylib")
328+
endif()
325329

326330
include(GNUInstallDirs)
327331

pyproject.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,20 @@ wheel.install-dir = "vapoursynth/plugins"
4242
wheel.py-api = "py3"
4343
sdist.reproducible = true
4444
wheel.expand-macos-universal-tags = true
45+
wheel.exclude = [
46+
# Exclude directories and their contents explicitly
47+
"**/bin/", # Excludes the bin folder (and obudump)
48+
"**/include/", # Excludes the include folder (headers)
49+
"**/lib/cmake/", # Excludes the cmake config folder
50+
"**/lib/pkgconfig/", # Excludes the pkgconfig folder
51+
"**/share/", # Excludes share folder (man pages/docs, if any)
52+
53+
# Exclude specific static library files
54+
"**/lib/*.a", # Linux/macOS static libraries
55+
"**/lib/*.lib", # Windows static libraries
56+
"**/*.lib", # Catch-all for Windows static libs just in case
57+
"**/*.a" # Catch-all for Unix static libs just in case
58+
]
4559

4660
[tool.scikit-build.cmake.define]
4761
BUILD_AVS_PLUGIN = "OFF"

0 commit comments

Comments
 (0)