From cb507cb6d3412489a99c81a86aa692e7badaf079 Mon Sep 17 00:00:00 2001 From: Ziheng Sun Date: Sun, 4 Jun 2023 22:25:41 -0400 Subject: [PATCH 1/3] what is the java bin --- pygeoweaver/utils.py | 1 + pyproject.toml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 7a9f48d..914b864 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -52,6 +52,7 @@ def get_java_bin_path(): java_bin_path = bin_path break + print("java_bin_path: ", java_bin_path) return java_bin_path diff --git a/pyproject.toml b/pyproject.toml index 853e74b..f154c6b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "pygeoweaver" -version = "0.6.10" +version = "0.6.11" authors = [ { name="Geoweaver team", email="geoweaver.app@gmail.com" }, ] @@ -22,7 +22,7 @@ classifiers = [ [tool.poetry] name = "pygeoweaver" -version = "0.6.10" +version = "0.6.11" description = "This is a wrapper package of the Geoweaver app." authors = ["Geoweaver team "] readme = "README.md" From 5645c89d302af4ab5f9af5ea0a769d9bb487ec76 Mon Sep 17 00:00:00 2001 From: Ziheng Sun Date: Sun, 4 Jun 2023 22:29:17 -0400 Subject: [PATCH 2/3] Update utils.py --- pygeoweaver/utils.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 914b864..975ddf6 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -36,6 +36,21 @@ def get_root_dir(): head, tail = os.path.split(__file__) return head +def get_java_bin_from_which(): + # Check if 'which' command is available + try: + subprocess.check_output(['which', 'java']) + except (subprocess.CalledProcessError, FileNotFoundError): + return None + + # Run 'which java' command to get the Java binary path + try: + output = subprocess.check_output(['which', 'java'], encoding='utf-8') + java_bin_path = output.strip() + except subprocess.CalledProcessError: + return None + + return java_bin_path def get_java_bin_path(): # Check if the 'java' command is available in the system path @@ -52,6 +67,9 @@ def get_java_bin_path(): java_bin_path = bin_path break + if java_bin_path is None: + java_bin_path = get_java_bin_from_which() + print("java_bin_path: ", java_bin_path) return java_bin_path From 8b849466ee9a4864a6134a01f186f43132108158 Mon Sep 17 00:00:00 2001 From: Ziheng Sun Date: Sun, 4 Jun 2023 22:31:29 -0400 Subject: [PATCH 3/3] Update utils.py --- pygeoweaver/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 975ddf6..4b864d6 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -39,13 +39,13 @@ def get_root_dir(): def get_java_bin_from_which(): # Check if 'which' command is available try: - subprocess.check_output(['which', 'java']) + subprocess.check_output(['source', '~/.bashrc', '&&', 'which', 'java']) except (subprocess.CalledProcessError, FileNotFoundError): return None # Run 'which java' command to get the Java binary path try: - output = subprocess.check_output(['which', 'java'], encoding='utf-8') + output = subprocess.check_output(['source', '~/.bashrc', '&&', 'which', 'java'], encoding='utf-8') java_bin_path = output.strip() except subprocess.CalledProcessError: return None