Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19524#discussion_r145593044
  
    --- Diff: dev/run-tests ---
    @@ -20,4 +20,10 @@
     FWDIR="$(cd "`dirname $0`"/..; pwd)"
     cd "$FWDIR"
     
    +PYTHON_VERSION_CHECK=$(python -c 'import sys; print(sys.version_info < (2, 
7, 0))')
    --- End diff --
    
    @holdenk and @shaneknapp, looks I can't just check this within Python 
scripts.
    
    As we know from the previous issue, `dev/run-tests.py` is not compatible 
with Python 2.6.x due to dictionary comprehension syntax:
    
    ```
    python2.6 dev/run-tests.py
    ```
    
    ```
      File "dev/run-tests.py", line 128
        {m: set(m.dependencies).intersection(modules_to_test) for m in 
modules_to_test}, sort=True)
                                                                ^
    SyntaxError: invalid syntax
    ```
    
    I tried to change this as below:
    
    ```
    git diff dev/run-tests.py
    ```
    
    ```diff
    diff --git a/dev/run-tests.py b/dev/run-tests.py
    index 72d148d7ea0..dcec912ae23 100755
    --- a/dev/run-tests.py
    +++ b/dev/run-tests.py
    @@ -27,6 +27,10 @@ import sys
     import subprocess
     from collections import namedtuple
    
    +if sys.version_info < (2, 7):
    +    print("[error] Python versions prior to 2.7 are not supported.")
    +    sys.exit(-1)
    +
     from sparktestsupport import SPARK_HOME, USER_HOME, ERROR_CODES
     from sparktestsupport.shellutils import exit_from_command_with_retcode, 
run_cmd, rm_r, which
     from sparktestsupport.toposort import toposort_flatten, toposort
    ```
    
    but it still gives syntax error ahead:
    
    ```
    python2.6 dev/run-tests.py
    ```
    
    ```
      File "dev/run-tests.py", line 128
        {m: set(m.dependencies).intersection(modules_to_test) for m in 
modules_to_test}, sort=True)
                                                                ^
    SyntaxError: invalid syntax
    ```
    
    I think we should not force to workaround for Python 2.6 syntax error as it 
was dropped. So, I just tried to fix both `dev/run-tests` and 
`dev/run-tests-jenkins` as proposed currently.



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to