author | Sebastian Brannstrom <sebastianb@symbian.org> |
Mon, 25 Oct 2010 14:04:32 +0100 | |
branch | RCL_3 |
changeset 292 | 655dbce90b70 |
parent 218 | 2fd795b1e1b1 |
child 355 | 075b3a49cb55 |
permissions | -rw-r--r-- |
218
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
1 |
import os; |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
2 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
3 |
BUILDNO_FILE = 'buildno.txt' |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
4 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
5 |
PKG_FILE_UDEB_TEMPLATE = 'podcatcher_udeb_template.pkg' |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
6 |
PKG_FILE_UDEB = 'podcatcher_udeb.pkg' |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
7 |
PKG_FILE_UREL_TEMPLATE = 'podcatcher_urel_template.pkg' |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
8 |
PKG_FILE_UREL = 'podcatcher_urel.pkg' |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
9 |
HEADER_FILE = '..\\inc\\buildno.h' |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
10 |
BUILDNO_TAG = 'BUILDNO' |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
11 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
12 |
def update_buildno(buildno_file): |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
13 |
#read previous build number |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
14 |
f = open(buildno_file, 'r') |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
15 |
buildno = int(f.read()) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
16 |
f.close() |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
17 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
18 |
# increment build number and write it back to the file |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
19 |
buildno = buildno + 1 |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
20 |
buildno_str = '%d' % buildno |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
21 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
22 |
print 'New build number is %d' % buildno |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
23 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
24 |
f = open(buildno_file, 'w') |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
25 |
f.write(buildno_str) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
26 |
f.close() |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
27 |
return buildno |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
28 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
29 |
def update_pkg(pkg_template, pkg_file, buildno): |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
30 |
print 'Writing %s' % pkg_file |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
31 |
#update 'build' number in PKG file |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
32 |
f = open (pkg_template, 'r') |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
33 |
g = open (pkg_file, 'w') |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
34 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
35 |
buildno_str = '%d' % buildno |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
36 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
37 |
for line in f: |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
38 |
line = line.replace(BUILDNO_TAG, buildno_str) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
39 |
g.write(line) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
40 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
41 |
def update_header(header_file, buildno): |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
42 |
print 'Writing %s' % header_file |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
43 |
buildno_str = '// Build number generated by increment_buildno.py, do not edit manually\r\n#define BUILD_NO %d' % buildno |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
44 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
45 |
f = open(header_file, 'w') |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
46 |
f.write(buildno_str) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
47 |
f.close() |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
48 |
return buildno |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
49 |
|
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
50 |
new_buildno = update_buildno(BUILDNO_FILE) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
51 |
update_pkg(PKG_FILE_UDEB_TEMPLATE, PKG_FILE_UDEB, new_buildno) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
52 |
update_pkg(PKG_FILE_UREL_TEMPLATE, PKG_FILE_UREL, new_buildno) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
53 |
update_header(HEADER_FILE, new_buildno) |
2fd795b1e1b1
Added build number management from 5th edition version; Added binary S^3 version for online download
Sebastian Brannstrom <sebastianb@symbian.org>
parents:
diff
changeset
|
54 |
print 'Remember to rebuild to get the build number into the about dialog!' |