diff --git a/pygeoweaver/jdk_utils.py b/pygeoweaver/jdk_utils.py index fcf1c8f..a4f8c36 100644 --- a/pygeoweaver/jdk_utils.py +++ b/pygeoweaver/jdk_utils.py @@ -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']) diff --git a/pygeoweaver/utils.py b/pygeoweaver/utils.py index 29c660c..0933d72 100644 --- a/pygeoweaver/utils.py +++ b/pygeoweaver/utils.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index dd5f55e..9717659 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" }, ] @@ -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 "] readme = "README.md"