Skip to content

Commit

Permalink
Merge pull request #9 from ZihengSun/main
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
ZihengSun authored Jun 5, 2023
2 parents 71befb6 + 8b84946 commit e2ed319
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 19 additions & 0 deletions pygeoweaver/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(['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(['source', '~/.bashrc', '&&', '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
Expand All @@ -52,6 +67,10 @@ 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


Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]" },
]
Expand All @@ -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 <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit e2ed319

Please sign in to comment.