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



##########
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 3\.(\d+)\.\d+""".r

Review comment:
       This string can actually be dependent on the implementation of Python. 
e.g.) `pypy`. Since this is a test only path, I guess it's fine for now but 
while we're here, can we change the logic such as:
   
   ```python
   python3 -c 'import sys; print(sys.version_info >= (3, 8, 0))'
   ```
   
   and see if the return value is `True`?




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