Added setup file

This commit is contained in:
yrrad8 2024-05-19 17:10:49 +03:00 committed by GitHub
parent 1a27e11a2d
commit d750ba5e37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

32
setup.py Normal file
View File

@ -0,0 +1,32 @@
import subprocess
import sys
def newer_python():
return sys.version_info >= (3, 11)
def install_requirements():
try:
if newer_python():
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements-3_11.txt"])
else:
subprocess.check_call([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"])
print("All requirements have been installed successfully.")
except subprocess.CalledProcessError as e:
print(f"Error occurred while installing requirements: {e}")
def main():
install_requirements()
try:
import db_creation.create_db
import db_access
except ImportError as e:
print(f"Error occurred while importing the module: {e}")
except AttributeError as e:
print(f"Error occurred while calling the function: {e}")
if __name__ == '__main__':
main()