Files
cutdex/tool/check.py
T
lingjhf 27e77fff39 feat: initial Cutdex application
Add the Flutter video editing application with project management, media
import, timeline editing, preview, AI assistance, diagnostics and settings.

Include shared UI and native host packages, platform runners, application
tests and release tooling.

Provide usage and contribution guides, the MIT license and third-party
notices. Exclude local credentials, build outputs and validation data.
2026-10-05 23:36:23 +08:00

54 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Check repository tooling without building, signing, or publishing an app."""
import argparse
import ast
import os
from pathlib import Path
import shutil
import subprocess
import sys
ROOT = Path(__file__).resolve().parent.parent
def run(command):
print('+ ' + ' '.join(map(str, command)), flush=True)
subprocess.run(command, cwd=ROOT, check=True)
def main():
argparse.ArgumentParser(description=__doc__).parse_args()
if sys.version_info < (3, 11):
raise SystemExit('Python 3.11 or newer is required for repository tooling.')
tool_roots = [ROOT / 'tool', *(ROOT / 'packages').glob('*/tool')]
for path in sorted(path for directory in tool_roots for path in directory.rglob('*.py')):
ast.parse(path.read_text(encoding='utf-8'), filename=str(path))
print('Python syntax: passed', flush=True)
bash = shutil.which('bash')
if bash:
for path in sorted(path for directory in tool_roots for path in directory.rglob('*.sh')):
run([bash, '-n', str(path)])
else:
print('Shell syntax: skipped (bash unavailable)', flush=True)
python = sys.executable
run([python, 'tool/check_public_repository.py'])
run([python, 'tool/check_package_boundaries.py'])
for directory, pattern in [
('tool/macos', '*_unit.py'),
('tool/tests', '*_test.py'),
('tool/windows', 'test_check_windows_release.py'),
('tool/windows', '*_unit.py'),
]:
run([python, '-m', 'unittest', 'discover', '-s', directory, '-p', pattern])
flutter = os.environ.get('FLUTTER') or shutil.which('flutter')
if not flutter:
raise SystemExit('Flutter is required; set FLUTTER to its executable path.')
run([flutter, 'analyze', 'lib', 'test', 'integration_test', 'test_driver', 'tool', 'packages'])
package_tests = sorted(str(path.relative_to(ROOT)) for path in (ROOT / 'packages').glob('*/test'))
if package_tests:
run([flutter, 'test', *package_tests])
if __name__ == '__main__':
main()