1 ###############################################################################
2 # Copyright (c) 2000-2015 Ericsson Telecom AB
3 # All rights reserved. This program and the accompanying materials
4 # are made available under the terms of the Eclipse Public License v1.0
5 # which accompanies this distribution, and is available at
6 # http://www.eclipse.org/legal/epl-v10.html
7 ###############################################################################
10 from tempfile
import mkstemp
11 from shutil
import move
12 from os
import remove
, close
14 from subprocess
import call
17 def getnumberfromfileline(line
):
18 lineasstring
= str(line
);
19 numberfromfile
= lineasstring
[-3:];
20 number
= int(numberfromfile
) + 1;
23 print 'Number is over the limit: >=99. File is not modified!'
28 def replace(file_path
):
30 fh
, abs_path
= mkstemp()
31 new_file
= open(abs_path
,'w')
32 old_file
= open(file_path
)
34 if '#define TTCN3_PATCHLEVEL' in line
:
35 newline
= str('#define TTCN3_PATCHLEVEL ') + str(getnumberfromfileline(line
)) + str('\n');
36 new_file
.write(newline
);
37 elif '#define TTCN3_VERSION 30' in line
:
38 number
= getnumberfromfileline(line
);
40 newline
= str('#define TTCN3_VERSION 302') +'0' + str(number
) + str('\n');
42 newline
= str('#define TTCN3_VERSION 302') + str(number
) + str('\n');
43 new_file
.write(newline
);
53 move(abs_path
, file_path
)
55 #( d.isoweekday() in range(1, 6)
56 #d = datetime.datetime.now();
57 #if d.isoweekday() == 2 or d.isoweekday() == 4 :
58 replace ("version.h");
59 #call(["git", "commit", "-m 'TTCN3_PATCHLEVEL update'" ,"version.h"]);
60 # call(["git", "push"]);
This page took 0.044296 seconds and 5 git commands to generate.