~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to build_files/cmake/cmake_static_check_clang_array.py

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python3
 
2
 
 
3
# ***** BEGIN GPL LICENSE BLOCK *****
 
4
#
 
5
# This program is free software; you can redistribute it and/or
 
6
# modify it under the terms of the GNU General Public License
 
7
# as published by the Free Software Foundation; either version 2
 
8
# of the License, or (at your option) any later version.
 
9
#
 
10
# This program is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
# GNU General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU General Public License
 
16
# along with this program; if not, write to the Free Software Foundation,
 
17
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
18
#
 
19
# Contributor(s): Campbell Barton
 
20
#
 
21
# ***** END GPL LICENSE BLOCK *****
 
22
 
 
23
# <pep8 compliant>
 
24
 
 
25
import project_source_info
 
26
import subprocess
 
27
import sys
 
28
import os
 
29
 
 
30
USE_QUIET = (os.environ.get("QUIET", None) is not None)
 
31
 
 
32
CHECKER_IGNORE_PREFIX = [
 
33
    "extern",
 
34
    "intern/moto",
 
35
    "blender/intern/opennl",
 
36
    ]
 
37
 
 
38
CHECKER_BIN = "python2"
 
39
 
 
40
CHECKER_ARGS = [
 
41
    os.path.join(os.path.dirname(__file__), "clang_array_check.py"),
 
42
    # not sure why this is needed, but it is.
 
43
    "-I" + os.path.join(project_source_info.SOURCE_DIR, "extern", "glew", "include"),
 
44
    ]
 
45
 
 
46
 
 
47
def main():
 
48
    source_info = project_source_info.build_info(ignore_prefix_list=CHECKER_IGNORE_PREFIX)
 
49
 
 
50
    check_commands = []
 
51
    for c, inc_dirs, defs in source_info:
 
52
        cmd = ([CHECKER_BIN] +
 
53
               CHECKER_ARGS +
 
54
               [c] +
 
55
               [("-I%s" % i) for i in inc_dirs] +
 
56
               [("-D%s" % d) for d in defs]
 
57
               )
 
58
 
 
59
        check_commands.append((c, cmd))
 
60
 
 
61
    process_functions = []
 
62
 
 
63
    def my_process(i, c, cmd):
 
64
        if not USE_QUIET:
 
65
            percent = 100.0 * (i / (len(check_commands) - 1))
 
66
            percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
 
67
 
 
68
            sys.stdout.flush()
 
69
            sys.stdout.write("%s " % percent_str)
 
70
 
 
71
        return subprocess.Popen(cmd)
 
72
 
 
73
    for i, (c, cmd) in enumerate(check_commands):
 
74
        process_functions.append((my_process, (i, c, cmd)))
 
75
 
 
76
    project_source_info.queue_processes(process_functions)
 
77
 
 
78
 
 
79
if __name__ == "__main__":
 
80
    main()