1 ##############################################################################
2 # Copyright (c) 2000-2016 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
12 ##############################################################################
15 from tempfile
import mkstemp
16 from shutil
import move
17 from os
import remove
, close
19 from subprocess
import call
22 def getnumberfromfileline(line
):
23 lineasstring
= str(line
);
24 numberfromfile
= lineasstring
[-3:];
25 number
= int(numberfromfile
) + 1;
28 print 'Number is over the limit: >=99. File is not modified!'
33 def replace(file_path
):
35 fh
, abs_path
= mkstemp()
36 new_file
= open(abs_path
,'w')
37 old_file
= open(file_path
)
39 if '#define TTCN3_PATCHLEVEL' in line
:
40 newline
= str('#define TTCN3_PATCHLEVEL ') + str(getnumberfromfileline(line
)) + str('\n');
41 new_file
.write(newline
);
42 elif '#define TTCN3_VERSION 30' in line
:
43 number
= getnumberfromfileline(line
);
45 newline
= str('#define TTCN3_VERSION 302') +'0' + str(number
) + str('\n');
47 newline
= str('#define TTCN3_VERSION 302') + str(number
) + str('\n');
48 new_file
.write(newline
);
58 move(abs_path
, file_path
)
60 #( d.isoweekday() in range(1, 6)
61 #d = datetime.datetime.now();
62 #if d.isoweekday() == 2 or d.isoweekday() == 4 :
63 replace ("version.h");
64 #call(["git", "commit", "-m 'TTCN3_PATCHLEVEL update'" ,"version.h"]);
65 # call(["git", "push"]);
This page took 0.031783 seconds and 5 git commands to generate.