aboutsummaryrefslogtreecommitdiffstats
path: root/build/plugins/credits.py
blob: 4b3151869715ab6554ab81ff6752cfb9e57f0ae4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from _common import rootrel_arc_src


def oncredits_disclaimer(unit, *args):
    if unit.get('WITH_CREDITS'):
        unit.message(["warn", "CREDITS WARNING: {}".format(' '.join(args))])


def oncheck_contrib_credits(unit, *args):
    module_path = rootrel_arc_src(unit.path(), unit)
    excepts = set()
    if 'EXCEPT' in args:
        args = list(args)
        except_pos = args.index('EXCEPT')
        excepts = set(args[except_pos + 1 :])
        args = args[:except_pos]
    for arg in args:
        if module_path.startswith(arg) and not unit.get('CREDITS_TEXTS_FILE') and not unit.get('NO_CREDITS_TEXTS_FILE'):
            for ex in excepts:
                if module_path.startswith(ex):
                    break
            else:
                unit.message(["error", "License texts not found. See https://st.yandex-team.ru/DTCC-324"])