This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
updatenotice.py
43 lines (38 loc) · 1.41 KB
/
updatenotice.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
# This file is part of CovidPy v0.1.4
#
# The project has been distributed in the hope it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# You can use it and/or modify it under the terms of the GNU General Public License v3.0 or later.
# You should have received a copy of the GNU General Public License along with the project.
import os
oldversion = "0.1.3"
version = "0.1.4"
notice = """
# Copyright (c) 2022, CovidPyLib
# This file is part of CovidPy v{}.
#
# The project has been distributed in the hope it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# You can use it and/or modify it under the terms of the GNU General Public License v3.0 or later.
# You should have received a copy of the GNU General Public License along with the project.
"""
for root, dirs, files in os.walk("covidpy"):
for file in files:
try:
f = open(f"covidpy\\{file}", "r+")
f.seek(0)
cont = f.read()
if notice.format(oldversion) in cont:
cont = cont.replace(notice.format(oldversion), notice.format(version))
f.seek(0)
f.write(cont)
f.truncate()
f.close()
else:
f.close()
except:
pass