Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: test/actions/src/subdir1/counter.py

Issue 13869005: Dropping the scons generator. (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/actions-none/gyptest-none.py ('k') | test/additional-targets/gyptest-additional.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2010 Google Inc. All rights reserved. 3 # Copyright (c) 2010 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import sys 7 import sys
8 import time 8 import time
9 9
10 output = sys.argv[1] 10 output = sys.argv[1]
(...skipping 11 matching lines...) Expand all
22 if count > max_count: 22 if count > max_count:
23 count = max_count 23 count = max_count
24 24
25 oldcount = 0 25 oldcount = 0
26 try: 26 try:
27 oldcount = open(output, 'r').read() 27 oldcount = open(output, 'r').read()
28 except: 28 except:
29 pass 29 pass
30 30
31 # Save the count in a file that is undeclared, and thus hidden, to gyp. We need 31 # Save the count in a file that is undeclared, and thus hidden, to gyp. We need
32 # to do this because, prior to running commands, scons deletes any declared 32 # to do this because, prior to running commands, some build systems deletes
33 # outputs, so we would lose our count if we just wrote to the given output file. 33 # any declared outputs, so we would lose our count if we just wrote to the
34 # (The other option is to use Precious() in the scons generator, but that seems 34 # given output file.
35 # too heavy-handed just to support this somewhat unrealistic test case, and
36 # might lead to unintended side-effects).
37 open(persistoutput, 'w').write('%d' % (count)) 35 open(persistoutput, 'w').write('%d' % (count))
38 36
39 # Only write the given output file if the count has changed. 37 # Only write the given output file if the count has changed.
40 if int(oldcount) != count: 38 if int(oldcount) != count:
41 open(output, 'w').write('%d' % (count)) 39 open(output, 'w').write('%d' % (count))
42 # Sleep so the next run changes the file time sufficiently to make the build 40 # Sleep so the next run changes the file time sufficiently to make the build
43 # detect the file as changed. 41 # detect the file as changed.
44 time.sleep(1) 42 time.sleep(1)
45 43
46 sys.exit(0) 44 sys.exit(0)
OLDNEW
« no previous file with comments | « test/actions-none/gyptest-none.py ('k') | test/additional-targets/gyptest-additional.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698