xkrogen commented on a change in pull request #34395:
URL: https://github.com/apache/spark/pull/34395#discussion_r736960313



##########
File path: core/src/main/scala/org/apache/spark/TestUtils.scala
##########
@@ -278,16 +279,15 @@ private[spark] object TestUtils {
   }
 
   def isPythonVersionAtLeast38(): Boolean = {
-    val attempt = if (Utils.isWindows) {
-      Try(Process(Seq("cmd.exe", "/C", "python3 --version"))
-        .run(ProcessLogger(s => s.startsWith("Python 3.8") || 
s.startsWith("Python 3.9")))
-        .exitValue())
-    } else {
-      Try(Process(Seq("sh", "-c", "python3 --version"))
-        .run(ProcessLogger(s => s.startsWith("Python 3.8") || 
s.startsWith("Python 3.9")))
-        .exitValue())
+    val cmdSeq = if (Utils.isWindows) Seq("cmd.exe", "/C") else Seq("sh", "-c")
+    val versionPattern = """Python (\d+)\.(\d+)\.\d+""".r
+    try {
+      Process(cmdSeq :+ "python3 --version").!!.trim match {
+        case versionPattern(v1, v2) => v1.toInt > 3 || (v1.toInt == 3 && 
v2.toInt >= 8)

Review comment:
       Heh, not that I know of. I'm also realizing now that the executable is 
called `python3` so it probably does not make sense to check for versions which 
are not 3.x. Let me update it.




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to