-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathincrementer.py
64 lines (47 loc) · 1.45 KB
/
incrementer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/python
# coding: utf8
#************************************************************
#
# PolyOp
#
# Increment the build number
#
# École Centrale Nantes, France
# Université Paris 13, LIPN, CNRS, France
#
# Author : Étienne André
#
# Created : 2013/05/22
# Last modified: 2013/09/25
# Copied from IMITATOR: 2016/02/29
# Last modified: 2022/10/03
#************************************************************
import os
from time import gmtime, strftime
#************************************************************
# CONSTANTS
#************************************************************
build_number_file_name = "build_number.txt"
print("Incrementing build number…")
#************************************************************
# GET CURRENT BUILD NUMBER
#************************************************************
# Open file in read mode
file_handler = open(build_number_file_name)
# Read content
content = file_handler.read()
# Close file
file_handler.close()
# Convert to int
current_build = int(content)
#************************************************************
# INCREMENTS BUILD NUMBER FOR NEXT TIME
#************************************************************
# Open file in write mode
file_handler = open(build_number_file_name, "w")
# Add + 1
file_handler.write(str(current_build + 1))
# Close file
file_handler.close()
print("Current build number: " + (str) (current_build))
exit(0)