~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to src/msw/wince/clean_vcp.py

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

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