_verify_pkg.py 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. import zipfile, json, sys
  2. z = zipfile.ZipFile(r'E:/cfc/docs/参考资料/publish/_pkg-socratic-coach.zip')
  3. names = z.namelist()
  4. for n in names:
  5. print(n)
  6. print('--- total', len(names), 'entries ---')
  7. bad = [n for n in names if '.bak' in n or n.endswith('.pyc') or '__pycache__' in n]
  8. print('DIRTY:', bad) if bad else print('CLEAN')
  9. kb_name = [n for n in names if n.endswith('统一知识库.json')][0]
  10. d = json.loads(z.read(kb_name).decode('utf-8'))
  11. print('KB version:', d.get('version'), '| estrogen:', '雌激素水平' in json.dumps(d, ensure_ascii=False))
  12. md_name = [n for n in names if n.endswith('socratic-coach.md')][0]
  13. md = z.read(md_name).decode('utf-8')
  14. print('MD has 2.0 gate:', '2.0 归因硬门槛' in md)
  15. print('MD refs question-template:', '菌群问诊清单模板' in md)
  16. print('MD refs delivery-template:', '交付模板' in md)
  17. print('MD has fingerprint-check:', '路由自检' in md)
  18. print('MD has rubric-6.2.1:', '6.2.1' in md)
  19. tpl = [n for n in names if '问诊清单模板' in n or '交付模板' in n]
  20. print('new templates in pkg:', tpl)
  21. pj_name = [n for n in names if n.endswith('plugin.json')][0]
  22. pj = json.loads(z.read(pj_name).decode('utf-8'))
  23. print('plugin version:', pj.get('version'))
  24. import os
  25. print('size KB:', round(os.path.getsize(r'E:/cfc/docs/参考资料/publish/_pkg-socratic-coach.zip') / 1024, 1))