License FileBow under GPL-3.0-or-later and audit bundled notices
This commit is contained in:
1 parent
b8e37b88dd
commit
3f9541c1b9
36 files changed
+11599
-2003
No files matched your search
@@ -5,19 +5,29 @@ import json
|
||||
import shutil
|
||||
import sys
|
||||
root=Path(__file__).resolve().parents[1];out=root/'licenses';out.mkdir(exist_ok=True)
|
||||
packages=['pillow','pillow-heif','pypdf','cryptography','cffi','pycparser','python-docx','lxml','fpdf2','fonttools','defusedxml','typing-extensions','python-pptx','xlsxwriter','openpyxl','et-xmlfile','xlrd','striprtf','beautifulsoup4','soupsieve','packaging']
|
||||
packages=['pillow','pillow-heif','pypdf','cryptography','cffi','pycparser','python-docx','lxml','fpdf2','fonttools','defusedxml','typing-extensions','python-pptx','xlsxwriter','openpyxl','et-xmlfile','xlrd','striprtf','beautifulsoup4','soupsieve','packaging','charset-normalizer','pyreadline3','pyinstaller','pyinstaller-hooks-contrib']
|
||||
records=[]
|
||||
for package in packages:
|
||||
try: dist=metadata.distribution(package)
|
||||
except metadata.PackageNotFoundError: continue
|
||||
except metadata.PackageNotFoundError:
|
||||
raise SystemExit(f'Missing license dependency: {package}. Install engine/requirements.lock.txt first.')
|
||||
folder=out/'python'/package;folder.mkdir(parents=True,exist_ok=True)
|
||||
files=[]
|
||||
for entry in dist.files or []:
|
||||
if any(word in str(entry).lower() for word in ['license','copying','copyright','notice']) and dist.locate_file(entry).is_file():
|
||||
# Match the filename, not a directory such as packaging/licenses/*.py.
|
||||
# Some upstream projects use the British spelling LICENCE.
|
||||
if any(word in entry.name.lower() for word in ['license','licence','copying','copyright','notice','authors','contributors']) and dist.locate_file(entry).is_file():
|
||||
source=dist.locate_file(entry)
|
||||
# Keep wheel-provided notices, including bundled codec licenses.
|
||||
name=str(entry).replace('/','__').replace('\\','__')
|
||||
shutil.copy2(source,folder/name);files.append(str((folder/name).relative_to(out)))
|
||||
if not files:
|
||||
raise SystemExit(f'No license text found for {package} {dist.version}.')
|
||||
# Only remove stale generated files in this distribution's notice folder.
|
||||
expected={Path(name).name for name in files}
|
||||
for stale in folder.iterdir():
|
||||
if stale.is_file() and stale.name not in expected:
|
||||
stale.unlink()
|
||||
records.append({'name':dist.metadata['Name'],'version':dist.version,'license':dist.metadata.get('License-Expression') or dist.metadata.get('License') or '', 'files':files})
|
||||
shutil.copy2(Path(sys.base_prefix)/'LICENSE.txt',out/'Python.txt')
|
||||
shutil.copy2(root/'vendor/ffmpeg/LICENSE.txt',out/'FFmpeg-LGPL-3.0.txt')
|
||||
@@ -25,8 +35,10 @@ electron=root/'node_modules/electron/dist'
|
||||
for name in ['LICENSE','LICENSES.chromium.html']:
|
||||
if (electron/name).exists():shutil.copy2(electron/name,out/('Electron-'+name))
|
||||
(out/'components.json').write_text(json.dumps(records,indent=2,ensure_ascii=False),encoding='utf-8')
|
||||
(out/'FileBow-LICENSE.txt').write_text((root/'COPYRIGHT.md').read_text(encoding='utf-8')+'\n\n'+(root/'LICENSE').read_text(encoding='utf-8'),encoding='utf-8')
|
||||
parts=['<!doctype html><html lang="en"><meta charset="utf-8"><title>FileBow – License notices</title><style>body{font:15px system-ui;max-width:960px;margin:40px auto;padding:24px;line-height:1.6;color:#20232a}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:12px monospace}summary{cursor:pointer}a{color:#9a4518}</style><h1>FileBow – Third-party components</h1><p>The following components are distributed under their respective licenses. These notices do not change any rights granted by those licenses.</p><h2>FFmpeg</h2><p>FileBow uses FFmpeg libraries under the GNU LGPL version 3. FFmpeg runs as a separate process. The shared libraries are included unmodified. Version: n9.0.2-36-g6882969ce9, BtbN LGPL shared x64. Source archives and build scripts are in <code>licenses/sources</code>.</p>']
|
||||
for file in sorted(out.glob('*.txt')):
|
||||
parts.append('<h2>FileBow</h2><p>Copyright (C) 2026 Nordik.dev. Licensed under GPL-3.0-or-later. You may redistribute and modify FileBow under the GNU GPL; there is no warranty. <a href="https://git.nordik.dev/nordik/FileBow">Source code</a>.</p><h2>HEIF codecs</h2><p>The pillow-heif wheel contains GPL-covered x265, as well as LGPL-covered libheif and libde265. Its BSD wrapper license does not cover the whole binary wheel. See the preserved upstream notices below.</p><p>Source archives currently cover FFmpeg itself and its build recipes, not every bundled dependency. See <a href="sources/README.md">source availability</a> before redistributing a binary build.</p>')
|
||||
for file in sorted(out.glob('*.txt')) + sorted((out/'upstream').glob('*.txt')):
|
||||
parts.append(f'<details><summary>{html.escape(file.name)}</summary><pre>{html.escape(file.read_text(encoding="utf-8",errors="replace"))}</pre></details>')
|
||||
parts.append('<h2>Electron / Chromium</h2><p><a href="Electron-LICENSES.chromium.html">Chromium-License notices</a></p>')
|
||||
for record in records:
|
||||
|
||||
Reference in new issue
Block a user