From d750ba5e3728d3d8fd2d29a5c70993f9db058784 Mon Sep 17 00:00:00 2001 From: yrrad8 <74175908+yrrad8@users.noreply.github.com> Date: Sun, 19 May 2024 17:10:49 +0300 Subject: [PATCH] Added setup file --- setup.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..204d4e8 --- /dev/null +++ b/setup.py @@ -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()