]>
Commit | Line | Data |
---|---|---|
83e96c90 JS |
1 | ''' |
2 | This script will delete dependences from *.vcp files. | |
3 | After using this script, next time when you will try to save project, | |
070d6391 | 4 | you will have wait until 'Visual Tools' will rebuild all dependencies |
83e96c90 JS |
5 | and this process might take HUGE amount of time |
6 | ||
7 | Author : Viktor Voroshylo | |
83e96c90 JS |
8 | ''' |
9 | __version__='$Revision$'[11:-2] | |
10 | ||
11 | import sys | |
12 | ||
13 | if len(sys.argv) != 2 : | |
14 | print "Usage: %s project_file.vcp" % sys.argv[0] | |
15 | sys.exit(0) | |
16 | ||
17 | vsp_filename = sys.argv[1] | |
18 | exclude_line = 0 | |
19 | resultLines = [] | |
20 | ||
21 | vsp_file = open(vsp_filename, "r") | |
22 | empty_if_start = -1 | |
23 | ||
24 | line = vsp_file.readline() | |
25 | while line : | |
26 | skip_line = 0 | |
27 | if exclude_line : | |
28 | if not line.endswith("\\\n") : exclude_line = 0 | |
29 | skip_line = 1 | |
30 | elif line.startswith("DEP_CPP_") or line.startswith("NODEP_CPP_") : | |
31 | exclude_line = 1 | |
32 | skip_line = 1 | |
33 | elif empty_if_start != -1 : | |
34 | if line == "!ENDIF \n" : | |
35 | resultLines = resultLines[:empty_if_start] | |
36 | empty_if_start = -1 | |
37 | skip_line = 1 | |
38 | elif line != "\n" and not line.startswith("!ELSEIF ") : | |
39 | empty_if_start = -1 | |
40 | elif line.startswith("!IF ") : | |
41 | empty_if_start = len(resultLines) | |
42 | ||
43 | if not skip_line : | |
44 | resultLines.append(line) | |
45 | ||
46 | line = vsp_file.readline() | |
47 | ||
48 | open(vsp_filename, "w").write("".join(resultLines)) |