1) Binary path set to the default location in which we install the binaries.

2) Validate path not working if there is a space in the binary path.
3) Handle the case when the path contains '$DIR'. 

refs #5370
This commit is contained in:
Akshay Joshi
2021-06-10 22:49:05 +05:30
parent b2042f48cd
commit c86a2b643a
6 changed files with 144 additions and 29 deletions

View File

@@ -12,7 +12,7 @@
import pgadmin.utils.driver as driver
from flask import url_for, render_template, Response, request
from flask_babelex import gettext
from pgadmin.utils import PgAdminModule
from pgadmin.utils import PgAdminModule, replace_binary_path
from pgadmin.utils.csrf import pgCSRFProtect
from pgadmin.utils.session import cleanup_session_files
from pgadmin.misc.themes import get_all_themes
@@ -191,11 +191,18 @@ def validate_binary_path():
version_str = ''
if 'utility_path' in data and data['utility_path'] is not None:
# Check if "$DIR" present in binary path
binary_path = replace_binary_path(data['utility_path'])
for utility in UTILITIES_ARRAY:
full_path = os.path.abspath(
os.path.join(data['utility_path'],
os.path.join(binary_path,
(utility if os.name != 'nt' else
(utility + '.exe'))))
# Replace the spaces with '\'
full_path = full_path.replace(" ", "\\ ")
try:
# Get the output of the '--version' command
version_string = subprocess.getoutput(full_path + ' --version')