Skip to content

Commit

Permalink
Merge pull request #11 from ZihengSun/main
Browse files Browse the repository at this point in the history
pdf
  • Loading branch information
ZihengSun authored Jun 5, 2023
2 parents ed383d8 + 497dba2 commit 9efb33b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
19 changes: 14 additions & 5 deletions pygeoweaver/jdk_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,21 @@ def extract_zip_archive(archive_path, destination_dir):

def set_jdk_env_vars(jdk_install_dir):
print(f'Setting JDK environment variables...')
java_line = f'\nexport JAVA_HOME="{jdk_install_dir}"\n'

check_java = False
with open(os.path.expanduser("~/.bashrc"), 'r') as file:
for line in file:
if line.strip() == java_line:
check_java = True
break

if not check_java:
with open(os.path.expanduser("~/.bashrc"), "a") as bashrc:
bashrc.write(f'\nexport JAVA_HOME="{jdk_install_dir}"\n')
bashrc.write(f'export PATH="$JAVA_HOME/bin:$PATH"\n')
print('JDK environment variables set.')

with open(os.path.expanduser("~/.bashrc"), "a") as bashrc:
bashrc.write(f'\nexport JAVA_HOME="{jdk_install_dir}"\n')
bashrc.write(f'export PATH="$JAVA_HOME/bin:$PATH"\n')

print('JDK environment variables set.')
subprocess.run(['bash', '-c', 'source ~/.bashrc'])


Expand Down
6 changes: 5 additions & 1 deletion pygeoweaver/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ def get_java_bin_from_which():

try:

print("Executing: ", f'{get_root_dir()}/java_bin.sh')

output = subprocess.check_output([f'{get_root_dir()}/java_bin.sh'], encoding='utf-8')

java_bin_path = output.strip()

except subprocess.CalledProcessError:
except subprocess.CalledProcessError as e:

print(f"Command execution failed: {e.output}")

return None

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.12"
version = "0.6.13"
authors = [
{ name="Geoweaver team", email="geoweaver.app@gmail.com" },
]
Expand All @@ -22,7 +22,7 @@ classifiers = [

[tool.poetry]
name = "pygeoweaver"
version = "0.6.12"
version = "0.6.13"
description = "This is a wrapper package of the Geoweaver app."
authors = ["Geoweaver team <geoweaver.app@gmail.com>"]
readme = "README.md"
Expand Down

0 comments on commit 9efb33b

Please sign in to comment.