credits.py 847 B

1234567891011121314151617181920212223
  1. from _common import rootrel_arc_src
  2. def oncredits_disclaimer(unit, *args):
  3. if unit.get('WITH_CREDITS'):
  4. unit.message(["warn", "CREDITS WARNING: {}".format(' '.join(args))])
  5. def oncheck_contrib_credits(unit, *args):
  6. module_path = rootrel_arc_src(unit.path(), unit)
  7. excepts = set()
  8. if 'EXCEPT' in args:
  9. args = list(args)
  10. except_pos = args.index('EXCEPT')
  11. excepts = set(args[except_pos + 1 :])
  12. args = args[:except_pos]
  13. for arg in args:
  14. if module_path.startswith(arg) and not unit.get('CREDITS_TEXTS_FILE') and not unit.get('NO_CREDITS_TEXTS_FILE'):
  15. for ex in excepts:
  16. if module_path.startswith(ex):
  17. break
  18. else:
  19. unit.message(["error", "License texts not found. See https://st.yandex-team.ru/DTCC-324"])