Skip to content

facade: shared/obs-scripting: move 21 platform conditionals into per-OS files #882

Closed

Description

@zackees

Part of #847.

Lua/Python scripting host: shared library extension, Python runtime link mode, macOS framework paths, MSVC warning pragmas.

Class totals: (a) movable 21, (b) stays - public header 0, (c) Rust-ported 0. Total: 21. Line numbers on origin/master.

file:line macro branch class proposed function / target
shared/obs-scripting/obs-scripting-lua.c:33 __APPLE__ SO_EXT "so" on macOS a obs-scripting-platform.h (SO_EXT, PATH_MAX) with -windows/-cocoa/-nix variants
shared/obs-scripting/obs-scripting-lua.c:35 elif _WIN32 include windows.h, SO_EXT "dll" a same
shared/obs-scripting/obs-scripting-lua.c:1327 _WIN32 PATH_MAX = MAX_PATH a same header
shared/obs-scripting/obs-scripting-lua.c:1334 __APPLE__ macOS bundle path add to package.cpath a obs_lua_platform_add_cpaths(dstr*) in obs-scripting-cocoa.m
shared/obs-scripting/obs-scripting-lua.c:1353 !_WIN32 && !__APPLE__ relative ../SCRIPT_DIR cpath on nix a same, in obs-scripting-nix.c
shared/obs-scripting/obs-scripting-lua.h:26 _MSC_VER pragma warning push a CMake /wd for target in the Windows cmake file
shared/obs-scripting/obs-scripting-lua.h:37 _MSC_VER pragma warning pop a same
shared/obs-scripting/obs-scripting-python-import.c:24 _MSC_VER disable warning 4152 a CMake /wd
shared/obs-scripting/obs-scripting-python-import.c:28 _WIN32 windows/io includes, F_OK, library name patterns a obs-scripting-python-import-windows.c
shared/obs-scripting/obs-scripting-python-import.c:36 elif __APPLE__ macOS dylib FILE_PATTERN a obs-scripting-python-import-cocoa.m
shared/obs-scripting/obs-scripting-python-import.h:22 `_WIN32 APPLE` RUNTIME_LINK=1 (dlopen python) vs link
shared/obs-scripting/obs-scripting-python-import.h:29 _MSC_VER pragma push 4115 a CMake /wd
shared/obs-scripting/obs-scripting-python-import.h:34 _WIN32 && _DEBUG undef _DEBUG around Python.h a Windows-only header
shared/obs-scripting/obs-scripting-python-import.h:42 _MSC_VER pragma pop a CMake /wd
shared/obs-scripting/obs-scripting-python.c:1617 __APPLE__ macOS Python.framework home path a obs_python_platform_home() in cocoa file
shared/obs-scripting/obs-scripting-python.c:1660 __APPLE__ dont_write_bytecode for app bundle a obs_python_platform_init()
shared/obs-scripting/obs-scripting-python.c:1680 __APPLE__ plugin/resource sys.path from bundle a same
shared/obs-scripting/obs-scripting-python.h:24 _MSC_VER pragma push a CMake /wd
shared/obs-scripting/obs-scripting-python.h:36 _MSC_VER pragma pop a CMake /wd
shared/obs-scripting/obs-scripting-python.h:45 _WIN32 func alias vs include dlfcn.h a obs-scripting-python-link.h
shared/obs-scripting/obs-scripting.c:162 !_WIN32 && !__APPLE__ auto-load system Python on nix a obs_scripting_platform_autoload_python()

Classes: (a) movable behind per-platform files; (b) public-header ABI/export/type selection, stays; (c) already replaced by the Rust port (platform code isolated in src/platform/). Macro column abbreviates the #if expression; ! means negated, elif means an #elif line.

Test approach: Add Tier 2 Linux load-a-Lua-script smoke test and a characterization test of the cpath/python-path builders; macOS/Windows via native builds (ci-full).

Each move is one function per facade entry, mechanical, so upstream merges stay manageable; the ratchet baseline (step 1) drops by the moved count.

Activity

  1. zackees commented on Oct 23, 2026

    @zackees
    MemberAuthor

    Claiming: #882, one PR per slice, following the #1292 (frontend-tools) pattern: a conditional-free *-host.h interface, *-host-{windows,macos,posix} implementations in per-OS unity groups, a cmocka RED test against stub hosts, and cross-check coverage.

    1. Lua: SO_EXT/PATH_MAX and the package.cpath build (obs-scripting-lua.c.h, obs-scripting-lua.pch.h), plus the MSVC pragmas in obs-scripting-lua.h.
    2. Python import: RUNTIME_LINK, library patterns and pragmas (obs-scripting-python-import.{h,c.h} and its PCH).
    3. Python runtime: the macOS framework home, bytecode and sys.path setup (obs-scripting-python.{c.h,h}), and the obs-scripting.c.h Python path check.

    The first PR (RED) goes up today.

  2. added
    claimed
    on Oct 23, 2026
  3. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Done in three slices, each following the #1292 host-interface pattern with Tier 2 host tests and cross-check coverage:

    shared/obs-scripting has no entries left in ci/platform-ifdef-baseline.json. Behavior changes: macOS no longer adds an uninitialized buffer to Lua's package.cpath when the bundle lacks PlugIns, and Windows Python lookup accepts non-ASCII install paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions