-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (23 loc) · 1.11 KB
/
main.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
from src import bot
import sys
from src import runBot
def check_version() -> None:
import pkg_resources
# Read the requirements.txt file and add each line to a list
with open('requirements.txt') as f:
required = f.read().splitlines()
# For each library listed in requirements.txt, check if the corresponding version is installed
for package in required:
# Use the pkg_resources library to get information about the installed version of the library
package_name, package_verion = package.split('==')
installed = pkg_resources.get_distribution(package_name)
# Extract the library name and version number
name, version = installed.project_name, installed.version
# Compare the version number to see if it matches the one in requirements.txt
if package != f'{name}=={version}':
print(f'{name} version {version} is installed but does not match the requirements')
sys.exit();
if __name__ == '__main__':
check_version()
interviewBot = bot.Bot()
runBot.run_tele_bot(interviewBot)