From 3241e5f234d27e1eb355c71b261a7dd8a954e646 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 16 Jan 2024 13:31:30 +0800 Subject: [PATCH] ccmlib/common: extract scylla modes into a list restructure isScylla() by extracting the scylla modes into a list, to prepare for the changes for working with CMake generated scylla executable, which is located under paths like build/Debug/scylla instead of build/debug/scylla. Signed-off-by: Kefu Chai --- ccmlib/common.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ccmlib/common.py b/ccmlib/common.py index 075eb4b8..67dee249 100644 --- a/ccmlib/common.py +++ b/ccmlib/common.py @@ -591,11 +591,15 @@ def isScylla(install_dir): raise ArgumentError('Undefined installation directory') - return (os.path.exists(os.path.join(install_dir, 'scylla')) or - os.path.exists(os.path.join(install_dir, 'build', 'debug', 'scylla')) or - os.path.exists(os.path.join(install_dir, 'build', 'dev', 'scylla')) or - os.path.exists(os.path.join(install_dir, 'build', 'release', 'scylla')) or - os.path.exists(os.path.join(install_dir, 'bin', 'scylla'))) + if os.path.exists(os.path.join(install_dir, 'scylla')): + return True + + scylla_build_modes = ['debug', 'dev', 'release'] + for mode in scylla_build_modes: + if os.path.exists(os.path.join(install_dir, 'build', mode, 'scylla')): + return True + + return os.path.exists(os.path.join(install_dir, 'bin', 'scylla')) def isOpscenter(install_dir):