File: clang-tidy.py

package info (click to toggle)
aws-crt-python 0.16.8%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,328 kB
  • sloc: ansic: 330,743; python: 18,949; makefile: 6,271; sh: 3,712; asm: 754; cpp: 699; ruby: 208; java: 77; perl: 73; javascript: 46; xml: 11
file content (39 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39


import Builder
import glob
import os
import sys


def run_clang_tidy(env):
    sh = env.shell
    toolchain = env.toolchain
    clang_tidy = Builder.Util.where('clang-tidy')
    if not clang_tidy:
        clang_tidy = toolchain.find_llvm_tool('clang-tidy')[0]
    if not clang_tidy:
        print("No clang-tidy executable could be found")
        sys.exit(1)

    sources = [os.path.join(env.source_dir, file)
               for file in glob.glob('source/**/*.c') + glob.glob('source/*.c')
               if not ('windows' in file or 'android' in file)]

    return Builder.Script([
        [clang_tidy, '-p',
            os.path.join(env.build_dir, env.project.name)] + sources
    ])


class ClangTidy(Builder.Action):
    def is_main(self):
        return True

    def run(self, env):
        return Builder.Script([
            Builder.InstallPackages(['clang-tidy']),
            Builder.DownloadDependencies(),
            Builder.CMakeBuild(env.project),
            run_clang_tidy,
        ])