Author: jbellis Date: Fri Dec 2 03:01:05 2011 New Revision: 1209343 URL: http://svn.apache.org/viewvc?rev=1209343&view=rev Log: update cqlsh to find a python >= 2.5, if possible patch by Paul Cannon; reviewed by jbellis for CASSANDRA-3457
Modified: cassandra/branches/cassandra-1.0/bin/cqlsh Modified: cassandra/branches/cassandra-1.0/bin/cqlsh URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-1.0/bin/cqlsh?rev=1209343&r1=1209342&r2=1209343&view=diff ============================================================================== --- cassandra/branches/cassandra-1.0/bin/cqlsh (original) +++ cassandra/branches/cassandra-1.0/bin/cqlsh Fri Dec 2 03:01:05 2011 @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/bin/bash +# -*- mode: Python -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file @@ -16,6 +17,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +""":" +# bash code here; finds a suitable python interpreter and execs this file. +# prefer unqualified "python" if suitable: +python -c 'import sys; sys.exit(sys.hexversion < 0x020500b0)' 2>/dev/null \ + && exec python "$0" "$@" +for pyver in 2.6 2.7 2.5; do + which python$pyver > /dev/null 2>&1 && exec python$pyver "$0" "$@" +done +echo "No appropriate python interpreter found." >&2 +exit 1 +":""" + description = "CQL Shell for Apache Cassandra" version = "2.0.0" @@ -50,9 +63,11 @@ except ImportError: try: import cql except ImportError, e: - sys.stderr.write("\nPython CQL driver not installed, or not on PYTHONPATH.\n") - sys.stderr.write('You might try "easy_install cql".\n\n') - sys.exit(str(e)) + sys.exit("\nPython CQL driver not installed, or not on PYTHONPATH.\n" + 'You might try "easy_install cql".\n\n' + 'Python: %s\n' + 'Module load path: %r\n\n' + 'Error: %s\n' % (sys.executable, sys.path, e)) import cql.decoders from cql.cursor import _COUNT_DESCRIPTION, _VOID_DESCRIPTION @@ -1520,3 +1535,5 @@ def main(options, hostname, port): if __name__ == '__main__': main(*read_options(sys.argv[1:], os.environ)) + +# vim: set ft=python et ts=4 sw=4 :