CH-J Tools Mobile透過 SSH 管理伺服器
選單
已發布的原始碼

CH-J Tools Mobile

瀏覽特定應用程式版本的目錄與檔案。

下載原始碼 ZIP
CH-J / CH-J Tools Mobile 175 個檔案
sm-mobile-20261016T185235Z-8e93ecc1b59a 新增時間: · 建置時間:
notices.py 新增時間: 未記錄日期 2.1 KB · 32 行
程式碼 下載檔案
1#!/usr/bin/env python3
2"""Bundle exact resolved package licenses; no network or parent-project dependency."""
3import json,pathlib,urllib.parse
4root=pathlib.Path(__file__).resolve().parents[1]
5config=root/'.dart_tool/package_config.json'
6packages=json.loads(config.read_text())['packages']
7sections=[]; index=[]
8for package in sorted(packages,key=lambda p:p['name']):
9 if package['name']=='sm_mobile': continue
10 uri=urllib.parse.urljoin(config.as_uri(),package['rootUri'])
11 path=pathlib.Path(urllib.parse.unquote(urllib.parse.urlparse(uri).path))
12 texts=[]
13 for file in sorted(path.iterdir()):
14 if file.is_file() and file.name.upper().split('.')[0] in ['LICENSE','LICENCE','COPYING','NOTICE']:
15 texts.append(file.name+'\n'+file.read_text(errors='replace'))
16 if not texts and package['name'] in ['flutter_driver','flutter_test','integration_test','flutter_localizations','flutter_web_plugins','flutter','fuchsia_remote_debug_protocol']:
17 for parent in path.parents:
18 license_file=parent/'LICENSE'
19 if license_file.is_file():
20 texts.append('Flutter SDK LICENSE\n'+license_file.read_text());break
21 if not texts: raise SystemExit('Missing license: '+package['name'])
22 version='SDK'
23 pubspec=path/'pubspec.yaml'
24 if pubspec.exists():
25 import re
26 m=re.search(r'^version:\s*([^\n]+)',pubspec.read_text(),re.M)
27 if m: version=m.group(1)
28 index.append(f"| {package['name']} | {version} |")
29 sections.append('\n'+'='*72+'\n'+package['name']+' '+version+'\n'+'\n'.join(texts))
30(root/'assets/legal/third_party_notices.txt').write_text('SM Mobile — licenses of resolved Dart/Flutter components\n'+''.join(sections))
31(root/'docs/RESOLVED_COMPONENTS.md').write_text('# Resolved Dart and Flutter components\n\nGenerated from package_config.json and the exact package license files.\nFull texts: `assets/legal/third_party_notices.txt`. Flutter also embeds NOTICES.Z in each build.\n\n| Component | Version |\n| --- | --- |\n'+'\n'.join(index)+'\n')
32print(f'Collected {len(sections)} component license notices.')
SHA-25689c6a6aad51e46a4fdf3eece5149e823bfe1569094de7d30811a7570b8678b98

CH-J Proprietary Software License 1.14 · 原始碼依 CH-J Proprietary Software License 1.14 提供。公開原始碼不會改變授權條款,也不會授予額外的權利。

壓縮檔 SHA-25646e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655
檔案