MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / get_binary_path_versions

Function get_binary_path_versions

web/pgadmin/utils/__init__.py:371–400  ·  view source on GitHub ↗
(binary_path: str)

Source from the content-addressed store, hash-verified

369
370
371def get_binary_path_versions(binary_path: str) -> dict:
372 ret = {}
373 binary_path = os.path.abspath(
374 replace_binary_path(binary_path)
375 )
376
377 for utility in UTILITIES_ARRAY:
378 ret[utility] = None
379 full_path = os.path.join(binary_path,
380 (utility if os.name != 'nt' else
381 (utility + '.exe')))
382
383 try:
384 # if path doesn't exist raise exception
385 if not os.path.isdir(binary_path):
386 current_app.logger.warning('Invalid binary path.')
387 raise FileNotFoundError()
388 # Get the output of the '--version' command
389 cmd = subprocess.run(
390 [full_path, '--version'],
391 shell=False,
392 capture_output=True,
393 text=True
394 )
395 if cmd.returncode == 0:
396 ret[utility] = cmd.stdout.split(") ", 1)[1].strip()
397 except Exception as _:
398 continue
399
400 return ret
401
402
403def set_binary_path(binary_path, bin_paths, server_type,

Callers 2

validate_binary_pathFunction · 0.90
set_binary_pathFunction · 0.85

Calls 4

replace_binary_pathFunction · 0.85
joinMethod · 0.80
warningMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected