jiahuili430 commented on code in PR #4835:
URL: https://github.com/apache/couchdb/pull/4835#discussion_r1396039018
##########
dev/run:
##########
@@ -505,6 +517,119 @@ def boot_nouveau(ctx):
)
+CLOUSEAU_DIR = "clouseau"
+JAVA_VERSION_RE = re.compile('"(\d+\.\d+).*"')
+
+
+def get_java_version(java):
+ output = sp.check_output([java, "-version"],
stderr=sp.STDOUT).decode("utf-8")
+ if output:
+ matches = JAVA_VERSION_RE.search(output)
+ if matches:
+ return float(matches.groups()[0])
+
+
+class ClouseauError(Exception):
+ def __init__(self, message):
+ self.message = message
+ super().__init__(self.message)
+
+
+@log("Start Clouseau node clouseau{idx}")
+def boot_clouseau(ctx, idx):
+ if not os.path.isdir(CLOUSEAU_DIR):
+ raise ClouseauError(
+ "Clouseau deployment cannot be found, please run `./configure with
--enable-clouseau`"
+ )
+
+ clouseau_jdk_home = os.environ.get("CLOUSEAU_JAVA_HOME") or os.environ.get(
+ "JAVA_HOME"
+ )
+ java = clouseau_jdk_home + "/bin/java" if clouseau_jdk_home else "java"
+ java_version = get_java_version(java)
+
+ if not java_version:
+ print(
+ "Warning: Java version could not be determined, Clouseau may not
be able to run"
+ )
Review Comment:
No `TypeError` on my end, +1, and thanks for the improvement!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]