From bb20f8c92b1e653d12d6c8c9e5e4b3d6b5fce73a Mon Sep 17 00:00:00 2001 From: Johnny D Date: Thu, 17 Sep 2026 12:58:22 -0400 Subject: [PATCH 1/3] Retain compact upstream attribution and actual third-party notices Link the fork origin in the existing credits and retain the MIT reference and SDL zlib notice without promotional UI. Document that the inherited application has no project-wide license grant at the reviewed revision; do not invent one or misapply a dependency license to the whole SDK. No permission to publicly redistribute is inferred from a GitHub fork. --- CREDITS.md | 4 +++- LICENSES/MIT-trevlars.txt | 21 +++++++++++++++++++++ LICENSES/README.md | 10 ++++++++++ LICENSES/SDL-zlib.txt | 17 +++++++++++++++++ 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 LICENSES/MIT-trevlars.txt create mode 100644 LICENSES/README.md create mode 100644 LICENSES/SDL-zlib.txt diff --git a/CREDITS.md b/CREDITS.md index a76862d..618d117 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,7 +1,9 @@ # Contributors -- Peter Sharma and contributors: application and controller protocol implementation. +- [Peter Sharma and contributors](https://github.com/Peterksharma/switch2mac): application and controller protocol implementation. - Andrei-Kondrykau: browser integration. - vialoh: RetroArch integration. - ndeadly, Nadeflore, coffincolors, trevlars, darthcloud, and the controller research community: protocol research. - Sam Lantinga and the SDL contributors: SDL. + +License scope and retained notices: [LICENSES/README.md](LICENSES/README.md). diff --git a/LICENSES/MIT-trevlars.txt b/LICENSES/MIT-trevlars.txt new file mode 100644 index 0000000..4db4b32 --- /dev/null +++ b/LICENSES/MIT-trevlars.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 trevlars + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/LICENSES/README.md b/LICENSES/README.md new file mode 100644 index 0000000..97d8078 --- /dev/null +++ b/LICENSES/README.md @@ -0,0 +1,10 @@ +# License scope + +Switch2Kit retains code from [Peterksharma/switch2mac](https://github.com/Peterksharma/switch2mac/tree/ea6719f0a1d6b6986c00aca9ed4169a85c8cc9ae), including its contributed integrations listed in [CREDITS.md](../CREDITS.md). No project-wide license grant was found in that revision. A public fork and attribution are not a substitute for permission; no blanket license for that inherited code is asserted here. Public binary releases need documented permission covering redistribution and the linked emulator's license requirements. + +The following notices cover only their respective third-party material, not Switch2Kit as a whole: + +- [MIT-trevlars.txt](MIT-trevlars.txt): controller reference implementation cited by the inherited protocol source, from [trevlars/switch2-controllers-linux](https://github.com/trevlars/switch2-controllers-linux). +- [SDL-zlib.txt](SDL-zlib.txt): retained SDL-derived patches, from [SDL 3.4.14](https://github.com/libsdl-org/SDL/tree/147a8ee32dbf9ac02f3794964490687b6bbda1bc). The patches are modified source, not official SDL releases. + +Dolphin and Cemu keep their own copyright notices and licenses. Their source archives and dependency notices must accompany release candidates; this file neither replaces those licenses nor grants rights to their code. diff --git a/LICENSES/SDL-zlib.txt b/LICENSES/SDL-zlib.txt new file mode 100644 index 0000000..acaf5b2 --- /dev/null +++ b/LICENSES/SDL-zlib.txt @@ -0,0 +1,17 @@ +Copyright (C) 1997-2026 Sam Lantinga + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. From 2f916f54ff5fb2bfe4964e1e7788b47340977dff Mon Sep 17 00:00:00 2001 From: Johnny D Date: Thu, 17 Sep 2026 13:02:35 -0400 Subject: [PATCH 2/3] Carry source notices into native bundles before signing and verify Finder metadata Copy the compact credits and scoped third-party notices into Switch2Kit.app, the universal native-C distribution and embedded emulator bundles before host signing. Notice edits participate in CMake relinking. Preserve upstream Dolphin/Cemu identifiers and existing copyright/license strings; reject missing or altered notices during native builds. Keep Switch2Kit's existing author copyright while removing the research tagline. Six new failure-path tests and all existing patch/bundle/inspection tests pass on Linux. No controller/ABI changes, permission grants, signing bypass or blanket relicensing. Apple-SDK builds and full native packaging are required on this head. --- Integrations/CMake/Bundle.cmake | 9 +++ Resources/Info.plist | 2 +- scripts/build-app.sh | 7 +- scripts/build-switch2kit-c.sh | 3 + scripts/build-switch2kit-emulator.sh | 1 + scripts/verify-distribution-notices.py | 52 +++++++++++++ tests/distribution-notices/run.sh | 3 + tests/distribution-notices/test_notices.py | 88 ++++++++++++++++++++++ 8 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 scripts/verify-distribution-notices.py create mode 100755 tests/distribution-notices/run.sh create mode 100644 tests/distribution-notices/test_notices.py diff --git a/Integrations/CMake/Bundle.cmake b/Integrations/CMake/Bundle.cmake index 11e066a..3650dc6 100644 --- a/Integrations/CMake/Bundle.cmake +++ b/Integrations/CMake/Bundle.cmake @@ -22,6 +22,9 @@ function(switch2kit_embed target) set_property(TARGET "${target}" PROPERTY MACOSX_BUNDLE_INFO_PLIST "${_prepared}") endif() + get_filename_component(_notice_root "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/../.." ABSOLUTE) + file(GLOB _notices CONFIGURE_DEPENDS "${_notice_root}/LICENSES/*") + set_property(TARGET "${target}" APPEND PROPERTY LINK_DEPENDS "${_notice_root}/CREDITS.md" ${_notices}) add_custom_command(TARGET "${target}" POST_BUILD COMMAND "${CMAKE_COMMAND}" -E make_directory "$/Frameworks" COMMAND "${CMAKE_COMMAND}" -E copy_if_different "$" @@ -29,6 +32,12 @@ function(switch2kit_embed target) COMMAND "${CMAKE_COMMAND}" "-DS2K_BUNDLE_LIBRARY=$/Frameworks/$" -P "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/PrepareBundle.cmake" + COMMAND "${CMAKE_COMMAND}" -E make_directory + "$/Resources/Switch2KitNotices" + COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${_notice_root}/CREDITS.md" + "$/Resources/Switch2KitNotices/CREDITS.md" + COMMAND "${CMAKE_COMMAND}" -E copy_directory "${_notice_root}/LICENSES" + "$/Resources/Switch2KitNotices/LICENSES" COMMAND xcrun swift-stdlib-tool --copy --platform macosx --scan-executable "$" --destination "$/Frameworks" diff --git a/Resources/Info.plist b/Resources/Info.plist index 9b1013d..a95d70e 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -23,6 +23,6 @@ NSBluetoothAlwaysUsageDescription Switch2Kit talks to your Nintendo Switch 2 controllers over Bluetooth so games on this Mac can use them. NSHumanReadableCopyright - © 2026 Peter Sharma. Protocol research by the Switch 2 controller community. + © 2026 Peter Sharma and Switch2Kit contributors. diff --git a/scripts/build-app.sh b/scripts/build-app.sh index 4ef9c8c..e1dab59 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -41,12 +41,17 @@ if [ -f Resources/AppIcon.icns ]; then "$OUT/Contents/Info.plist" 2>/dev/null || true fi +# Keep the compact source notices in the bundle before any signature is applied. +mkdir -p "$OUT/Contents/Resources/Switch2KitNotices" +cp CREDITS.md "$OUT/Contents/Resources/Switch2KitNotices/" +cp -R LICENSES "$OUT/Contents/Resources/Switch2KitNotices/" + # Keep setup resources with the binary; never install the extension automatically. mkdir -p "$OUT/Contents/Resources/BrowserExtension" cp browser/extension/manifest.json browser/extension/*.js "$OUT/Contents/Resources/BrowserExtension/" REVISION=$(git rev-parse HEAD) DIRTY=false -[ -z "$(git status --porcelain --untracked-files=normal -- Sources Resources browser/extension scripts Package.swift)" ] || DIRTY=true +[ -z "$(git status --porcelain --untracked-files=normal -- Sources Resources browser/extension scripts Package.swift CREDITS.md LICENSES)" ] || DIRTY=true /usr/libexec/PlistBuddy -c "Add :Switch2KitSourceRevision string $REVISION" "$OUT/Contents/Info.plist" /usr/libexec/PlistBuddy -c "Add :Switch2KitSourceDirty bool $DIRTY" "$OUT/Contents/Info.plist" /usr/libexec/PlistBuddy -c "Add :Switch2KitBuildArchitecture string $(uname -m)" "$OUT/Contents/Info.plist" diff --git a/scripts/build-switch2kit-c.sh b/scripts/build-switch2kit-c.sh index a4a5987..7c27f46 100755 --- a/scripts/build-switch2kit-c.sh +++ b/scripts/build-switch2kit-c.sh @@ -60,6 +60,9 @@ lipo "$WORK/consumer" -verify_arch arm64 x86_64 "$WORK/consumer" xcodebuild -create-xcframework -library "$LIB" \ -headers "$ROOT/Sources/Switch2KitCABI/include" -output "$WORK/Switch2KitC.xcframework" +mkdir -p "$WORK/Switch2KitC.xcframework/Notices" +cp "$ROOT/CREDITS.md" "$WORK/Switch2KitC.xcframework/Notices/" +cp -R "$ROOT/LICENSES" "$WORK/Switch2KitC.xcframework/Notices/" plutil -lint "$WORK/Switch2KitC.xcframework/Info.plist" python3 - "$WORK/Switch2KitC.xcframework/Info.plist" <<'PY' import plistlib,sys diff --git a/scripts/build-switch2kit-emulator.sh b/scripts/build-switch2kit-emulator.sh index 10e4603..8b0c176 100755 --- a/scripts/build-switch2kit-emulator.sh +++ b/scripts/build-switch2kit-emulator.sh @@ -17,3 +17,4 @@ case "$emulator" in esac cmake -S "$source" -B "$build" "${args[@]}" "$@" cmake --build "$build" --target "$target" --parallel "${S2K_BUILD_JOBS:-4}" +python3 "$root/scripts/verify-distribution-notices.py" "$emulator" "$source" "$build" diff --git a/scripts/verify-distribution-notices.py b/scripts/verify-distribution-notices.py new file mode 100644 index 0000000..635ca9c --- /dev/null +++ b/scripts/verify-distribution-notices.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 +"""Check bundled source notices and upstream Finder metadata; no license grant is inferred.""" +import argparse +import hashlib +import json +from pathlib import Path +import plistlib + +ROOT = Path(__file__).resolve().parents[1] +NOTICES = ('CREDITS.md', 'LICENSES/README.md', 'LICENSES/MIT-trevlars.txt', 'LICENSES/SDL-zlib.txt') + + +def verify(app, emulator, root=ROOT): + info = plistlib.loads((app / 'Contents/Info.plist').read_bytes()) + expected_id = {'dolphin': 'org.dolphin-emu.dolphin', 'cemu': 'info.cemu.Cemu'}[emulator] + if info.get('CFBundleIdentifier') != expected_id: + raise ValueError('Unexpected host bundle identifier') + notice = info.get('NSHumanReadableCopyright') + if not isinstance(notice, str) or not notice.strip() or not ( + 'GPL' in notice if emulator == 'dolphin' else 'Cemu' in notice): + raise ValueError('Missing or replaced upstream Finder copyright/license notice') + digests = {} + for name in NOTICES: + source = root / name + bundled = app / 'Contents/Resources/Switch2KitNotices' / name + if not bundled.is_file() or bundled.is_symlink() or bundled.read_bytes() != source.read_bytes(): + raise ValueError('Missing or altered bundled notice: ' + name) + digests[name] = hashlib.sha256(source.read_bytes()).hexdigest() + return {'version': 1, 'emulator': emulator, 'copyright_notice': notice, + 'notices': digests, 'redistribution_permission_verified': False} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('emulator', choices=('dolphin', 'cemu')) + parser.add_argument('source', type=Path) + parser.add_argument('build', type=Path) + options = parser.parse_args() + report = options.build / 'integration-notices.json' + report.unlink(missing_ok=True) + directory = options.build / 'Binaries' if options.emulator == 'dolphin' else options.source / 'bin' + apps = [app for app in directory.glob('*.app') + if (app / 'Contents/Frameworks/libSwitch2KitC.dylib').is_file()] + if len(apps) != 1: + raise ValueError('Expected exactly one integrated application') + result = verify(apps[0], options.emulator) + report.write_text(json.dumps(result, indent=2) + '\n') + print('PASS bundled notices and upstream Finder metadata (not a redistribution permission grant)') + + +if __name__ == '__main__': + main() diff --git a/tests/distribution-notices/run.sh b/tests/distribution-notices/run.sh new file mode 100755 index 0000000..ee98feb --- /dev/null +++ b/tests/distribution-notices/run.sh @@ -0,0 +1,3 @@ +#!/bin/bash +set -euo pipefail +python3 "$(dirname "$0")/test_notices.py" diff --git a/tests/distribution-notices/test_notices.py b/tests/distribution-notices/test_notices.py new file mode 100644 index 0000000..d231c54 --- /dev/null +++ b/tests/distribution-notices/test_notices.py @@ -0,0 +1,88 @@ +import importlib.util +from pathlib import Path +import plistlib +import tempfile +import unittest + +ROOT = Path(__file__).resolve().parents[2] +spec = importlib.util.spec_from_file_location('notices', ROOT / 'scripts/verify-distribution-notices.py') +notices = importlib.util.module_from_spec(spec) +spec.loader.exec_module(notices) + + +class NoticesTests(unittest.TestCase): + def fixture(self, base, emulator): + app = base / 'Host with spaces.app' + for name in notices.NOTICES: + target = app / 'Contents/Resources/Switch2KitNotices' / name + target.parent.mkdir(parents=True, exist_ok=True) + target.write_bytes((ROOT / name).read_bytes()) + info = {'CFBundleIdentifier': 'org.dolphin-emu.dolphin' if emulator == 'dolphin' else 'info.cemu.Cemu', + 'NSHumanReadableCopyright': 'Licensed under GPL version 2 or later (GPLv2+)' if emulator == 'dolphin' + else 'Copyright © 2026 Cemu Project'} + (app / 'Contents/Info.plist').write_bytes(plistlib.dumps(info)) + return app, info + + def test_both_upstream_notices_and_all_source_texts_are_retained(self): + for emulator in ('dolphin', 'cemu'): + with tempfile.TemporaryDirectory() as temporary: + app, info = self.fixture(Path(temporary), emulator) + result = notices.verify(app, emulator) + self.assertEqual(result['copyright_notice'], info['NSHumanReadableCopyright']) + self.assertEqual(set(result['notices']), set(notices.NOTICES)) + self.assertFalse(result['redistribution_permission_verified']) + + def test_missing_empty_or_reassigned_copyright_fails(self): + for emulator in ('dolphin', 'cemu'): + for value in (None, '', ' ', 42, '© Switch2Kit'): + with self.subTest(emulator=emulator, value=value), tempfile.TemporaryDirectory() as temporary: + app, info = self.fixture(Path(temporary), emulator) + if value is None: + del info['NSHumanReadableCopyright'] + else: + info['NSHumanReadableCopyright'] = value + (app / 'Contents/Info.plist').write_bytes(plistlib.dumps(info)) + with self.assertRaises(ValueError): + notices.verify(app, emulator) + + def test_missing_altered_or_symlinked_notice_fails(self): + for name in notices.NOTICES: + for defect in ('missing', 'changed', 'symlink'): + with self.subTest(name=name, defect=defect), tempfile.TemporaryDirectory() as temporary: + app, _ = self.fixture(Path(temporary), 'dolphin') + target = app / 'Contents/Resources/Switch2KitNotices' / name + target.unlink() + if defect == 'changed': + target.write_text('Not the retained notice') + elif defect == 'symlink': + target.symlink_to(ROOT / name) + with self.assertRaises(ValueError): + notices.verify(app, 'dolphin') + + def test_emulator_identity_cannot_be_reassigned(self): + with tempfile.TemporaryDirectory() as temporary: + app, _ = self.fixture(Path(temporary), 'dolphin') + with self.assertRaises(ValueError): + notices.verify(app, 'cemu') + + def test_packagers_copy_notices_before_signing_or_archiving(self): + app = (ROOT / 'scripts/build-app.sh').read_text() + self.assertLess(app.index('cp -R LICENSES'), app.index('codesign --force')) + native = (ROOT / 'scripts/build-switch2kit-c.sh').read_text() + self.assertLess(native.index('cp -R "$ROOT/LICENSES"'), native.index('ditto -c -k')) + bundle = (ROOT / 'Integrations/CMake/Bundle.cmake').read_text() + self.assertIn('LINK_DEPENDS "${_notice_root}/CREDITS.md"', bundle) + self.assertIn('copy_directory "${_notice_root}/LICENSES"', bundle) + self.assertNotIn('COMMAND codesign', bundle) + self.assertIn('verify-distribution-notices.py', (ROOT / 'scripts/build-switch2kit-emulator.sh').read_text()) + + def test_scope_does_not_relicense_inherited_code(self): + text = (ROOT / 'LICENSES/README.md').read_text() + self.assertIn('No project-wide license grant was found', text) + self.assertIn('not Switch2Kit as a whole', text) + self.assertIn('Permission is hereby granted', (ROOT / 'LICENSES/MIT-trevlars.txt').read_text()) + self.assertIn('This notice may not be removed', (ROOT / 'LICENSES/SDL-zlib.txt').read_text()) + + +if __name__ == '__main__': + unittest.main() From ae59442ab04ef03cd6b2ebeafb1c425b1a497ffd Mon Sep 17 00:00:00 2001 From: Johnny D Date: Thu, 17 Sep 2026 13:15:09 -0400 Subject: [PATCH 3/3] Keep distribution notices concise [skip ci] Remove the requested commentary from the notice index, verifier output and corresponding wording assertions. Preserve attribution, complete third-party license texts, bundle metadata checks and notice-integrity validation. Local notice and repository tests pass. Skip additional CI for this cleanup at the repository owner's request. --- CREDITS.md | 2 +- LICENSES/README.md | 12 +++++------- scripts/verify-distribution-notices.py | 6 +++--- tests/distribution-notices/test_notices.py | 14 ++++++++++---- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CREDITS.md b/CREDITS.md index 618d117..cc6c61b 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -6,4 +6,4 @@ - ndeadly, Nadeflore, coffincolors, trevlars, darthcloud, and the controller research community: protocol research. - Sam Lantinga and the SDL contributors: SDL. -License scope and retained notices: [LICENSES/README.md](LICENSES/README.md). +License notices: [LICENSES/README.md](LICENSES/README.md). diff --git a/LICENSES/README.md b/LICENSES/README.md index 97d8078..a55a673 100644 --- a/LICENSES/README.md +++ b/LICENSES/README.md @@ -1,10 +1,8 @@ -# License scope +# Third-party notices -Switch2Kit retains code from [Peterksharma/switch2mac](https://github.com/Peterksharma/switch2mac/tree/ea6719f0a1d6b6986c00aca9ed4169a85c8cc9ae), including its contributed integrations listed in [CREDITS.md](../CREDITS.md). No project-wide license grant was found in that revision. A public fork and attribution are not a substitute for permission; no blanket license for that inherited code is asserted here. Public binary releases need documented permission covering redistribution and the linked emulator's license requirements. +Switch2Kit includes code from [Peterksharma/switch2mac](https://github.com/Peterksharma/switch2mac/tree/ea6719f0a1d6b6986c00aca9ed4169a85c8cc9ae). Contributors are listed in [CREDITS.md](../CREDITS.md). -The following notices cover only their respective third-party material, not Switch2Kit as a whole: +- [MIT-trevlars.txt](MIT-trevlars.txt): controller reference implementation, [trevlars/switch2-controllers-linux](https://github.com/trevlars/switch2-controllers-linux). +- [SDL-zlib.txt](SDL-zlib.txt): SDL-derived patches, [SDL 3.4.14](https://github.com/libsdl-org/SDL/tree/147a8ee32dbf9ac02f3794964490687b6bbda1bc). These are modified, unofficial SDL sources. -- [MIT-trevlars.txt](MIT-trevlars.txt): controller reference implementation cited by the inherited protocol source, from [trevlars/switch2-controllers-linux](https://github.com/trevlars/switch2-controllers-linux). -- [SDL-zlib.txt](SDL-zlib.txt): retained SDL-derived patches, from [SDL 3.4.14](https://github.com/libsdl-org/SDL/tree/147a8ee32dbf9ac02f3794964490687b6bbda1bc). The patches are modified source, not official SDL releases. - -Dolphin and Cemu keep their own copyright notices and licenses. Their source archives and dependency notices must accompany release candidates; this file neither replaces those licenses nor grants rights to their code. +Dolphin and Cemu retain their upstream copyright and license notices. diff --git a/scripts/verify-distribution-notices.py b/scripts/verify-distribution-notices.py index 635ca9c..d909593 100644 --- a/scripts/verify-distribution-notices.py +++ b/scripts/verify-distribution-notices.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Check bundled source notices and upstream Finder metadata; no license grant is inferred.""" +"""Check bundled source notices and upstream Finder metadata.""" import argparse import hashlib import json @@ -27,7 +27,7 @@ def verify(app, emulator, root=ROOT): raise ValueError('Missing or altered bundled notice: ' + name) digests[name] = hashlib.sha256(source.read_bytes()).hexdigest() return {'version': 1, 'emulator': emulator, 'copyright_notice': notice, - 'notices': digests, 'redistribution_permission_verified': False} + 'notices': digests} def main(): @@ -45,7 +45,7 @@ def main(): raise ValueError('Expected exactly one integrated application') result = verify(apps[0], options.emulator) report.write_text(json.dumps(result, indent=2) + '\n') - print('PASS bundled notices and upstream Finder metadata (not a redistribution permission grant)') + print('PASS bundled notices and upstream Finder metadata') if __name__ == '__main__': diff --git a/tests/distribution-notices/test_notices.py b/tests/distribution-notices/test_notices.py index d231c54..ec61187 100644 --- a/tests/distribution-notices/test_notices.py +++ b/tests/distribution-notices/test_notices.py @@ -1,4 +1,5 @@ import importlib.util +import hashlib from pathlib import Path import plistlib import tempfile @@ -30,7 +31,9 @@ def test_both_upstream_notices_and_all_source_texts_are_retained(self): result = notices.verify(app, emulator) self.assertEqual(result['copyright_notice'], info['NSHumanReadableCopyright']) self.assertEqual(set(result['notices']), set(notices.NOTICES)) - self.assertFalse(result['redistribution_permission_verified']) + self.assertEqual(result['emulator'], emulator) + for name, digest in result['notices'].items(): + self.assertEqual(digest, hashlib.sha256((ROOT / name).read_bytes()).hexdigest()) def test_missing_empty_or_reassigned_copyright_fails(self): for emulator in ('dolphin', 'cemu'): @@ -76,10 +79,13 @@ def test_packagers_copy_notices_before_signing_or_archiving(self): self.assertNotIn('COMMAND codesign', bundle) self.assertIn('verify-distribution-notices.py', (ROOT / 'scripts/build-switch2kit-emulator.sh').read_text()) - def test_scope_does_not_relicense_inherited_code(self): + def test_notice_index_links_sources_and_retained_texts(self): text = (ROOT / 'LICENSES/README.md').read_text() - self.assertIn('No project-wide license grant was found', text) - self.assertIn('not Switch2Kit as a whole', text) + self.assertIn('https://github.com/Peterksharma/switch2mac/tree/', text) + self.assertIn('[CREDITS.md](../CREDITS.md)', text) + for name in ('MIT-trevlars.txt', 'SDL-zlib.txt'): + self.assertIn('(' + name + ')', text) + self.assertIn('modified, unofficial SDL sources', text) self.assertIn('Permission is hereby granted', (ROOT / 'LICENSES/MIT-trevlars.txt').read_text()) self.assertIn('This notice may not be removed', (ROOT / 'LICENSES/SDL-zlib.txt').read_text())