forked from weecology/retriever-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.py
28 lines (19 loc) · 761 Bytes
/
version.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
"""Generates a configuration file containing the version number."""
from __future__ import absolute_import
import os
from recipes.lib.utils import get_script_version
def write_version_file(scripts):
"""The function creates / updates version.txt with the script version numbers."""
if os.path.isfile("version.txt"):
os.remove("version.txt")
with open("version.txt", "w") as version_file:
version_file.write("Retriever Scripts Versions")
for script in scripts:
version_file.write('\n' + script)
def update_version_file():
"""Update version.txt."""
scripts = get_script_version()
write_version_file(scripts)
print("Version.txt updated.")
if __name__ == '__main__':
update_version_file()