[ 
https://issues.apache.org/jira/browse/CASSANDRA-10190?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17030316#comment-17030316
 ] 

David Capwell commented on CASSANDRA-10190:
-------------------------------------------

Starting review now; looking at the bash script since I know that better

https://github.com/apache/cassandra/compare/trunk...dineshjoshi:10190-trunk-review#diff-6469b081699ab92c53e0513a499ca5ebL18

{code}
$ shellcheck cqlsh

In cqlsh line 53:
        version=$(which $interpreter > /dev/null 2>&1 && $interpreter -c 
"import os; print('{}.{}'.format(os.sys.version_info.major, 
os.sys.version_info.minor))")
                  ^---^ SC2230: which is non-standard. Use builtin 'command -v' 
instead.
                        ^----------^ SC2086: Double quote to prevent globbing 
and word splitting.

Did you mean:
        version=$(which "$interpreter" > /dev/null 2>&1 && $interpreter -c 
"import os; print('{}.{}'.format(os.sys.version_info.major, 
os.sys.version_info.minor))")


In cqlsh line 60:
        if [ "$version" = "3.6" -o "$version" = "2.7" ]; then
                                ^-- SC2166: Prefer [ p ] || [ q ] as [ p -o q ] 
is not well defined.


In cqlsh line 70:
        version=$(get_python_version $interpreter)
                                     ^----------^ SC2086: Double quote to 
prevent globbing and word splitting.

Did you mean:
        version=$(get_python_version "$interpreter")


In cqlsh line 72:
                if [ "$(is_supported_version $version)" = "supported" ]; then
                                             ^------^ SC2086: Double quote to 
prevent globbing and word splitting.

Did you mean:
                if [ "$(is_supported_version "$version")" = "supported" ]; then


In cqlsh line 73:
                        exec $interpreter "`$interpreter -c "import os; 
print(os.path.dirname(os.path.realpath('$0')))"`/cqlsh.py" $params
                             ^----------^ SC2086: Double quote to prevent 
globbing and word splitting.
                                           ^-- SC2006: Use $(...) notation 
instead of legacy backticked `...`.
                                                                                
                                                   ^-----^ SC2086: Double quote 
to prevent globbing and word splitting.

Did you mean:
                        exec "$interpreter" "$($interpreter -c "import os; 
print(os.path.dirname(os.path.realpath('$0')))")/cqlsh.py" "$params"

For more information:
  https://www.shellcheck.net/wiki/SC2166 -- Prefer [ p ] || [ q ] as [ p -o q...
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
  https://www.shellcheck.net/wiki/SC2230 -- which is non-standard. Use builti...
{code}

> Python 3 support for cqlsh
> --------------------------
>
>                 Key: CASSANDRA-10190
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10190
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Legacy/Tools
>            Reporter: Andrew Pennebaker
>            Assignee: Patrick Bannister
>            Priority: Normal
>              Labels: cqlsh
>             Fix For: 4.0, 4.0-alpha
>
>         Attachments: 
> 0001-Fix-issues-from-version-specific-logic-commit.patch, 
> 0001-Update-six-to-1.12.0.patch, 
> 0002-Simplify-version-specific-logic-by-using-six.moves-a.patch, 
> coverage_notes.txt
>
>
> Users who operate in a Python 3 environment may have trouble launching cqlsh. 
> Could we please update cqlsh's syntax to run in Python 3?
> As a workaround, users can setup pyenv, and cd to a directory with a 
> .python-version containing "2.7". But it would be nice if cqlsh supported 
> modern Python versions out of the box.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to