aboutsummaryrefslogtreecommitdiffstats
path: root/build/plugins/credits.py
blob: 0ce16593265e57098f5d89e5c31fab07bdfee79a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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"])