#!/usr/bin/env python3 """Assign installed files once, keeping QML/plugin directories together.""" import json,shutil from pathlib import Path def development(path, policy): p=Path(path).relative_to('opt/plasma') if p.parts[0]=='bin':return p.name not in policy.get('runtime_tools',[]) return (p.parts[0] in ('include','libexec','mkspecs','doc','modules') or str(p).startswith(('lib/cmake/','lib/pkgconfig/','lib/metatypes/','lib/objects','share/qt6/modules/')) or (p.parent==Path('lib') and p.suffix in ('.so','.a','.prl'))) if __name__=='__main__': policy=json.loads(Path('debian/package-policy.json').read_text()) root=Path('debian/tmp');shutil.rmtree(root/'opt/plasma/doc',ignore_errors=True) groups={name:[] for name in policy['packages']} base='plasma-next-'+policy['module'] for p in sorted(root.rglob('*')): if not p.is_symlink() and not p.is_file():continue path=str(p.relative_to(root)) key=base+'-dev' if development(path,policy) else base if key not in groups:raise ValueError('Unexpected package category for '+path) groups[key].append(path) for key,files in groups.items(): Path('debian/'+key+'.install').write_text('\n'.join(files)+'\n') print('Package files:',{key:len(value) for key,value in groups.items()})