From 56db255245f3ec856d3403b44c6c78f66af6473a Mon Sep 17 00:00:00 2001 From: HanslettTheDev Date: Mon, 27 Mar 2023 15:14:33 +0100 Subject: [PATCH] feat: get all required dependencies in setup.py from issue #105 Signed-off-by: HanslettTheDev fix: improved the get_dependencies function to grab all dependency modules Signed-off-by: HanslettTheDev fix: improved the get_dependencies function to grab all dependency modules; commit signed Signed-off-by: HanslettTheDev fix: fixed the issue with pip not detecting links Signed-off-by: HanslettTheDev fix: removed the python version number in the requirements.txt file fix: fixed the error when replacing the links with the module name The overall errors fixed was to prevent the setup.py build from failing Signed-off-by: HanslettTheDev feat: get all dependencies from the requirements.txt file to be used by the setup.py build process --- .gitignore | 3 +++ get_dep.py | 29 +++++++++++++++++++++++------ requirements.txt | 2 +- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index d2d6f360b..35f46c3c8 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ nosetests.xml .mr.developer.cfg .project .pydevproject + +# vscode settings +.vscode \ No newline at end of file diff --git a/get_dep.py b/get_dep.py index 7f802654c..b107b9149 100644 --- a/get_dep.py +++ b/get_dep.py @@ -1,7 +1,24 @@ -import subprocess +import os -def get_dependecies() -> list: - freeze = subprocess.Popen("pip freeze", shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() - g = freeze[0].decode("utf-8").split("\r\n") - dependencies = [">=".join(x.split("==")) for x in g] - return dependencies \ No newline at end of file + +def get_dependecies(): + blob = "git+https://github.com" + requirements_path = os.path.join( + os.path.abspath(os.getcwd()), + "requirements.txt" + ) + if os.path.isfile(requirements_path): + with open(requirements_path) as f: + dependencies = [ + ">=".join(x.split("==")) for x in f.read().splitlines() + ] + for x in dependencies: + if x.startswith(blob): + # split the text and join them with the @ command + # index 3 holds the name of the module + chunks = x.split("/") + dependencies[dependencies.index(x)] = x.replace( + blob, chunks[3] + " @ " + blob + ) + break + return dependencies diff --git a/requirements.txt b/requirements.txt index 58c97dbc4..2430d4185 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ httplib2==0.9.2; python_version <= '2.7' httplib2==0.20.4; python_version > '3' pysimplesoap==1.08.14; python_version <= '2.7' -git+https://github.com/pysimplesoap/pysimplesoap.git@py311#pysimplesoap; python_version > '3' +git+https://github.com/pysimplesoap/pysimplesoap.git@py311#pysimplesoap; cryptography==3.3.2; python_version <= '2.7' cryptography==3.4.7; python_version > '3' fpdf>=1.7.2