diff --git a/.build/build-resolver.xml b/.build/build-resolver.xml
index 039bed7f0f08..b912c7975500 100644
--- a/.build/build-resolver.xml
+++ b/.build/build-resolver.xml
@@ -202,6 +202,7 @@
+
@@ -233,10 +234,10 @@
-
+
diff --git a/bin/cqlsh b/bin/cqlsh
index a962e1181de8..31cdc93d36e7 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -62,8 +62,8 @@ is_supported_version() {
version=$1
major_version="${version%.*}"
minor_version="${version#*.}"
- # python3.6+ is supported. python2.7 is deprecated but still compatible.
- if [ "$major_version" = 3 ] && [ "$minor_version" -ge 6 ] || [ "$version" = "2.7" ]; then
+ # python 3.8-3.11 are supported
+ if [ "$major_version" = 3 ] && [ "$minor_version" -ge 8 ] && [ "$minor_version" -le 13 ]; then
echo "supported"
else
echo "unsupported"
@@ -79,6 +79,8 @@ run_if_supported_version() {
if [ "$(is_supported_version "$version")" = "supported" ]; then
exec "$interpreter" "$($interpreter -c "import os; print(os.path.dirname(os.path.realpath('$0')))")/cqlsh.py" "$@"
exit
+ else
+ echo "Warning: unsupported version of Python, required 3.6-3.13 but found" "$version" >&2
fi
fi
}
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 8fd604d4dac1..285f5420db3e 100755
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -34,8 +34,8 @@
from glob import glob
from uuid import UUID
-if sys.version_info < (3, 6) and sys.version_info[0:2] != (2, 7):
- sys.exit("\ncqlsh requires Python 3.6+ or Python 2.7 (deprecated)\n")
+if sys.version_info < (3, 6) or sys.version_info >= (3, 14):
+ sys.exit("\ncqlsh requires Python 3.6-3.13\n")
# see CASSANDRA-10428
if platform.python_implementation().startswith('Jython'):
@@ -117,19 +117,15 @@ def find_zip(libprefix):
sys.path.insert(0, os.path.join(cql_zip, 'cassandra-driver-' + ver))
# the driver needs dependencies
-third_parties = ('futures-', 'six-', 'geomet-', 'pure_sasl-', 'datastax_db_*-')
+third_parties = ('geomet-', 'pure_sasl-', 'datastax_db_*-', 'pyasyncore-')
for lib in third_parties:
lib_zip = find_zip(lib)
if lib_zip:
sys.path.insert(0, lib_zip)
-# We cannot import six until we add its location to sys.path so the Python
-# interpreter can find it. Do not move this to the top.
-import six
-
-from six.moves import configparser, input
-from six import StringIO, ensure_text, ensure_str
+import configparser
+from io import StringIO
warnings.filterwarnings("ignore", r".*blist.*")
try:
@@ -369,7 +365,7 @@ def __repr__(self):
def maybe_ensure_text(val):
- return ensure_text(val) if val else val
+ return str(val) if val else val
class FormatError(DecodeError):
@@ -434,7 +430,7 @@ def deserialize_date_fallback_int(byts, protocol_version):
class Shell(cmd.Cmd):
- custom_prompt = ensure_text(os.getenv('CQLSH_PROMPT', ''))
+ custom_prompt = os.getenv('CQLSH_PROMPT', '')
if custom_prompt != '':
custom_prompt += "\n"
default_prompt = custom_prompt + "cqlsh> "
@@ -915,15 +911,14 @@ def prepare_loop(self):
def get_input_line(self, prompt=''):
if self.tty:
- self.lastcmd = input(ensure_str(prompt))
- line = ensure_text(self.lastcmd) + '\n'
+ self.lastcmd = input(str(prompt))
+ line = self.lastcmd + '\n'
else:
- self.lastcmd = ensure_text(self.stdin.readline())
+ self.lastcmd = self.stdin.readline()
line = self.lastcmd
if not len(line):
raise EOFError
self.lineno += 1
- line = ensure_text(line)
return line
def use_stdin_reader(self, until='', prompt=''):
@@ -984,7 +979,6 @@ def onecmd(self, statementtext):
Returns true if the statement is complete and was handled (meaning it
can be reset).
"""
- statementtext = ensure_text(statementtext)
statementtext = self.strip_comment_blocks(statementtext)
try:
statements, endtoken_escaped = cqlruleset.cql_split_statements(statementtext)
@@ -1030,7 +1024,7 @@ def handle_statement(self, tokens, srcstr):
if readline is not None:
nl_count = srcstr.count("\n")
- new_hist = ensure_str(srcstr.replace("\n", " ").rstrip())
+ new_hist = srcstr.replace("\n", " ").rstrip()
if nl_count > 1 and self.last_hist != new_hist:
readline.add_history(new_hist)
@@ -1081,7 +1075,6 @@ def do_select(self, parsed):
self.tracing_style = tracing_was_enabled
def perform_statement(self, statement):
- statement = ensure_text(statement)
stmt = SimpleStatement(statement, consistency_level=self.consistency_level, serial_consistency_level=self.serial_consistency_level, fetch_size=self.page_size if self.use_paging else None)
success, future = self.perform_simple_statement(stmt)
@@ -1133,7 +1126,7 @@ def perform_simple_statement(self, statement):
return False, None
def print_cql_error(err):
- err_msg = ensure_text(err.message if hasattr(err, 'message') else str(err))
+ err_msg = err.message if hasattr(err, 'message') else str(err)
self.printerr(str(err.__class__.__name__) + ": " + err_msg)
future = self.session.execute_async(statement, trace=self.tracing_style in ["full", "compact"])
@@ -1482,7 +1475,7 @@ def describe_keyspaces(self, rows):
"""
Print the output for a DESCRIBE KEYSPACES query
"""
- names = [ensure_str(r['name']) for r in rows]
+ names = [r['name'] for r in rows]
print('')
cmd.Cmd.columnize(self, names)
@@ -1502,7 +1495,7 @@ def describe_list(self, rows):
keyspace = row['keyspace_name']
names = list()
- names.append(ensure_str(row['name']))
+ names.append(str(row['name']))
if keyspace is not None:
self.print_keyspace_element_names(keyspace, names)
@@ -1644,7 +1637,7 @@ def do_copy(self, parsed):
if fname is not None:
fname = self.cql_unprotect_value(fname)
- copyoptnames = list(map(six.text_type.lower, parsed.get_binding('optnames', ())))
+ copyoptnames = list(map(str.lower, parsed.get_binding('optnames', ())))
copyoptvals = list(map(self.cql_unprotect_value, parsed.get_binding('optvals', ())))
opts = dict(list(zip(copyoptnames, copyoptvals)))
@@ -2105,11 +2098,10 @@ def writeresult(self, text, color=None, newline=True, out=None):
out = self.query_out
# convert Exceptions, etc to text
- if not isinstance(text, six.text_type):
- text = "{}".format(text)
+ if not isinstance(text, str):
+ text = str(text)
to_write = self.applycolor(text, color) + ('\n' if newline else '')
- to_write = ensure_str(to_write)
out.write(to_write)
def flush_output(self):
@@ -2227,7 +2219,7 @@ def should_use_color():
def read_options(cmdlineargs, environment):
- configs = configparser.SafeConfigParser() if sys.version_info < (3, 2) else configparser.ConfigParser()
+ configs = configparser.ConfigParser()
configs.read(CONFIG_FILE)
rawconfigs = configparser.RawConfigParser()
diff --git a/lib/cassandra-driver-internal-only-3.26.0-df103d3a.zip b/lib/cassandra-driver-internal-only-3.26.0-df103d3a.zip
deleted file mode 100644
index ddb70e77f1c8..000000000000
Binary files a/lib/cassandra-driver-internal-only-3.26.0-df103d3a.zip and /dev/null differ
diff --git a/lib/cassandra-driver-internal-only-3.30.0.zip b/lib/cassandra-driver-internal-only-3.30.0.zip
new file mode 100644
index 000000000000..284cf1ec3eb4
Binary files /dev/null and b/lib/cassandra-driver-internal-only-3.30.0.zip differ
diff --git a/pylib/cassandra-cqlsh-tests.sh b/pylib/cassandra-cqlsh-tests.sh
index ccc3aff42774..cd2f67d2835b 100755
--- a/pylib/cassandra-cqlsh-tests.sh
+++ b/pylib/cassandra-cqlsh-tests.sh
@@ -75,9 +75,8 @@ else
cython_suffix="no-cython"
fi
-# re-use when possible the pre-installed virtualenv found in the cassandra-ubuntu2004_test docker image
+# re-use when possible the pre-installed virtualenv found in the cassandra-ubuntu-test docker image
virtualenv-clone ${BUILD_HOME}/${cython_suffix}/python${python_version} ${BUILD_DIR}/venv || virtualenv --python=python${python_version} ${BUILD_DIR}/venv
-source ${BUILD_DIR}/venv/bin/activate
if [ "$cython" = "yes" ]; then
pip install "Cython>=0.29.15,<3.0"
diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
index 557033615865..3a224a617118 100644
--- a/pylib/cqlshlib/copyutil.py
+++ b/pylib/cqlshlib/copyutil.py
@@ -27,7 +27,6 @@
import random
import re
import signal
-import six
import struct
import sys
import threading
@@ -40,14 +39,13 @@
from collections import defaultdict, namedtuple
from decimal import Decimal
from random import randint
-from io import BytesIO, StringIO
+from io import StringIO
from select import select
+from typing import Literal
from uuid import UUID
-from six import ensure_str, ensure_text
-from six.moves import configparser
-from six.moves import range
-from six.moves.queue import Queue
+import configparser
+from queue import Queue
from cassandra import OperationTimedOut
from cassandra.cluster import DefaultConnection
@@ -63,7 +61,6 @@
from cqlshlib.driver import cluster_factory
from cqlshlib.formatting import format_value_default, CqlType, DateTimeFormat, EMPTY, get_formatter, BlobType
from cqlshlib.sslhandling import ssl_settings
-from cqlshlib.util import profile_on, profile_off
PROFILE_ON = False
@@ -337,9 +334,9 @@ def parse_options(self, opts, direction):
opts = self.clean_options(self.maybe_read_config_file(opts, direction))
dialect_options = dict()
- dialect_options['quotechar'] = ensure_str(opts.pop('quote', '"'))
- dialect_options['escapechar'] = ensure_str(opts.pop('escape', '\\'))
- dialect_options['delimiter'] = ensure_str(opts.pop('delimiter', ','))
+ dialect_options['quotechar'] = opts.pop('quote', '"')
+ dialect_options['escapechar'] = opts.pop('escape', '\\')
+ dialect_options['delimiter'] = opts.pop('delimiter', ',')
if dialect_options['quotechar'] == dialect_options['escapechar']:
dialect_options['doublequote'] = True
del dialect_options['escapechar']
@@ -347,7 +344,7 @@ def parse_options(self, opts, direction):
dialect_options['doublequote'] = False
copy_options = dict()
- copy_options['nullval'] = ensure_str(opts.pop('null', ''))
+ copy_options['nullval'] = opts.pop('null', '')
copy_options['header'] = bool(opts.pop('header', '').lower() == 'true')
copy_options['encoding'] = opts.pop('encoding', 'utf8')
copy_options['maxrequests'] = int(opts.pop('maxrequests', 6))
@@ -369,7 +366,7 @@ def parse_options(self, opts, direction):
copy_options['consistencylevel'] = shell.consistency_level
copy_options['decimalsep'] = opts.pop('decimalsep', '.')
copy_options['thousandssep'] = opts.pop('thousandssep', '')
- copy_options['boolstyle'] = [ensure_str(s.strip()) for s in opts.pop('boolstyle', 'True, False').split(',')]
+ copy_options['boolstyle'] = [s.strip() for s in opts.pop('boolstyle', 'True, False').split(',')]
copy_options['numprocesses'] = int(opts.pop('numprocesses', self.get_num_processes(16)))
copy_options['begintoken'] = opts.pop('begintoken', '')
copy_options['endtoken'] = opts.pop('endtoken', '')
@@ -573,7 +570,7 @@ def open(self):
if self.header:
writer = csv.writer(self.current_dest.output, **self.options.dialect)
- writer.writerow([ensure_str(c) for c in self.columns])
+ writer.writerow([str(c) for c in self.columns])
return True
@@ -1746,7 +1743,7 @@ def write_rows_to_csv(self, token_range, rows, cql_types):
return # no rows in this range
try:
- output = StringIO() if six.PY3 else BytesIO()
+ output = StringIO()
writer = csv.writer(output, **self.options.dialect)
for row in rows:
@@ -1776,7 +1773,7 @@ def format_value(self, val, cqltype):
float_precision=cqltype.precision, nullval=self.nullval, quote=False,
decimal_sep=self.decimal_sep, thousands_sep=self.thousands_sep,
boolean_styles=self.boolean_styles)
- return formatted if six.PY3 else formatted.encode('utf8')
+ return formatted
def close(self):
ChildProcess.close(self)
@@ -1916,7 +1913,7 @@ def _get_primary_key_statement(parent, table_meta):
select_query = 'SELECT * FROM %s.%s WHERE %s' % (protect_name(parent.ks),
protect_name(parent.table),
where_clause)
- return parent.session.prepare(ensure_str(select_query))
+ return parent.session.prepare(select_query)
@staticmethod
def unprotect(v):
@@ -1952,20 +1949,20 @@ def convert_blob(v, **_):
return BlobType(v[2:].decode("hex"))
def convert_text(v, **_):
- return ensure_str(v)
+ return str(v)
def convert_uuid(v, **_):
return UUID(v)
def convert_bool(v, **_):
- return True if v.lower() == ensure_str(self.boolean_styles[0]).lower() else False
+ return True if v.lower() == str(self.boolean_styles[0]).lower() else False
def get_convert_integer_fcn(adapter=int):
"""
Return a slow and a fast integer conversion function depending on self.thousands_sep
"""
if self.thousands_sep:
- return lambda v, ct=cql_type: adapter(v.replace(self.thousands_sep, ensure_str('')))
+ return lambda v, ct=cql_type: adapter(v.replace(self.thousands_sep, ''))
else:
return lambda v, ct=cql_type: adapter(v)
@@ -1973,8 +1970,8 @@ def get_convert_decimal_fcn(adapter=float):
"""
Return a slow and a fast decimal conversion function depending on self.thousands_sep and self.decimal_sep
"""
- empty_str = ensure_str('')
- dot_str = ensure_str('.')
+ empty_str = ''
+ dot_str = '.'
if self.thousands_sep and self.decimal_sep:
return lambda v, ct=cql_type: adapter(v.replace(self.thousands_sep, empty_str).replace(self.decimal_sep, dot_str))
elif self.thousands_sep:
@@ -2038,14 +2035,8 @@ def paren_match(c1, c2):
def convert_datetime(val, **_):
try:
- if six.PY2:
- # Python 2 implementation
- tval = time.strptime(val, self.date_time_format)
- return timegm(tval) * 1e3 # scale seconds to millis for the raw value
- else:
- # Python 3 implementation
- dtval = datetime.datetime.strptime(val, self.date_time_format)
- return dtval.timestamp() * 1000
+ dtval = datetime.datetime.strptime(val, self.date_time_format)
+ return dtval.timestamp() * 1000
except ValueError:
pass # if it's not in the default format we try CQL formats
@@ -2096,8 +2087,8 @@ def convert_map(val, ct=cql_type):
"""
See ImmutableDict above for a discussion of why a special object is needed here.
"""
- split_format_str = ensure_str('{%s}')
- sep = ensure_str(':')
+ split_format_str = '{%s}'
+ sep = ':'
return ImmutableDict(frozenset((convert_mandatory(ct.subtypes[0], v[0]), convert(ct.subtypes[1], v[1]))
for v in [split(split_format_str % vv, sep=sep) for vv in split(val)]))
@@ -2116,8 +2107,8 @@ def convert_user_type(val, ct=cql_type):
Also note that it is possible that the subfield names in the csv are in the
wrong order, so we must sort them according to ct.fieldnames, see CASSANDRA-12959.
"""
- split_format_str = ensure_str('{%s}')
- sep = ensure_str(':')
+ split_format_str = '{%s}'
+ sep = ':'
vals = [v for v in [split(split_format_str % vv, sep=sep) for vv in split(val)]]
dict_vals = dict((unprotect(v[0]), v[1]) for v in vals)
sorted_converted_vals = [(n, convert(t, dict_vals[n]) if n in dict_vals else self.get_null_val())
@@ -2176,7 +2167,7 @@ def get_null_val(self):
or "NULL" otherwise. Note that for counters we never use prepared statements, so we
only check is_counter when use_prepared_statements is false.
"""
- return None if self.use_prepared_statements else (ensure_str("0") if self.is_counter else ensure_str("NULL"))
+ return None if self.use_prepared_statements else ("0" if self.is_counter else "NULL")
def convert_row(self, row):
"""
@@ -2463,7 +2454,6 @@ def make_params(self):
if self.ttl >= 0:
query += 'USING TTL %s' % (self.ttl,)
make_statement = self.wrap_make_statement(self.make_non_prepared_batch_statement)
- query = ensure_str(query)
conv = ImportConversion(self, table_meta, prepared_statement)
tm = TokenMap(self.ks, self.hostname, self.local_dc, self.session)
@@ -2531,12 +2521,12 @@ def make_counter_batch_statement(self, query, conv, batch, replicas):
set_clause = []
for i, value in enumerate(row):
if i in conv.primary_key_indexes:
- where_clause.append(ensure_text("{}={}").format(self.valid_columns[i], ensure_text(value)))
+ where_clause.append("{}={}".format(self.valid_columns[i], str(value)))
else:
- set_clause.append(ensure_text("{}={}+{}").format(self.valid_columns[i], self.valid_columns[i], ensure_text(value)))
+ set_clause.append("{}={}+{}".format(self.valid_columns[i], self.valid_columns[i], str(value)))
- full_query_text = query % (ensure_text(',').join(set_clause), ensure_text(' AND ').join(where_clause))
- statement.add(ensure_str(full_query_text))
+ full_query_text = query % (','.join(set_clause), ' AND '.join(where_clause))
+ statement.add(full_query_text)
return statement
def make_prepared_batch_statement(self, query, _, batch, replicas):
@@ -2560,7 +2550,7 @@ def make_non_prepared_batch_statement(self, query, _, batch, replicas):
statement = BatchStatement(batch_type=BatchType.UNLOGGED, consistency_level=self.consistency_level)
statement.replicas = replicas
statement.keyspace = self.ks
- field_sep = b',' if six.PY2 else ','
+ field_sep = ','
statement._statements_and_parameters = [(False, query % (field_sep.join(r),), ()) for r in batch['rows']]
return statement
diff --git a/pylib/cqlshlib/displaying.py b/pylib/cqlshlib/displaying.py
index ef076f76a9b3..9e57eeb9246c 100644
--- a/pylib/cqlshlib/displaying.py
+++ b/pylib/cqlshlib/displaying.py
@@ -43,7 +43,7 @@ def get_str(val):
return val
-class FormattedValue(object):
+class FormattedValue:
def __init__(self, strval, coloredval=None, displaywidth=None):
self.strval = strval
diff --git a/pylib/cqlshlib/driver.py b/pylib/cqlshlib/driver.py
index e0bc7cef951f..d6ca4a7183ee 100644
--- a/pylib/cqlshlib/driver.py
+++ b/pylib/cqlshlib/driver.py
@@ -14,7 +14,6 @@
import os
import random
-import six
import stat
from cassandra.cluster import Cluster
from cassandra.connection import UnixSocketEndPoint
@@ -114,7 +113,7 @@ def cluster_factory(host, whitelist_lbp=True, **kwargs):
def is_unix_socket(hostname):
- if isinstance(hostname, six.string_types) and os.path.exists(hostname):
+ if isinstance(hostname, str) and os.path.exists(hostname):
mode = os.stat(hostname).st_mode
return stat.S_ISSOCK(mode)
return False
diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py
index 7dbd9869361a..f19fa9d4aee9 100644
--- a/pylib/cqlshlib/formatting.py
+++ b/pylib/cqlshlib/formatting.py
@@ -16,7 +16,6 @@
from __future__ import unicode_literals
-import binascii
import calendar
import datetime
import math
@@ -25,7 +24,6 @@
import sys
import platform
-from six import ensure_text
from collections import defaultdict
@@ -126,7 +124,7 @@ def __init__(self, timestamp_format=DEFAULT_TIMESTAMP_FORMAT, date_format=DEFAUL
self.milliseconds_only = milliseconds_only # the microseconds part, .NNNNNN, wil be rounded to .NNN
-class CqlType(object):
+class CqlType:
"""
A class for converting a string into a cql type name that can match a formatter
and a list of its sub-types, if any.
@@ -213,7 +211,7 @@ def parse_sub_types(val, ksmeta):
def format_value_default(val, colormap, **_):
- val = ensure_text(str(val))
+ val = str(val)
escapedval = val.replace('\\', '\\\\')
bval = controlchars_re.sub(_show_control_chars, escapedval)
return bval if colormap is NO_COLOR_MAP else color_text(bval, colormap)
@@ -245,7 +243,7 @@ def registrator(f):
return registrator
-class BlobType(object):
+class BlobType:
def __init__(self, val):
self.val = val
@@ -255,7 +253,7 @@ def __str__(self):
@formatter_for('BlobType')
def format_value_blob(val, colormap, **_):
- bval = ensure_text('0x') + ensure_text(binascii.hexlify(val))
+ bval = '0x' + val.hex()
return colorme(bval, colormap, 'blob')
@@ -265,7 +263,7 @@ def format_value_blob(val, colormap, **_):
def format_python_formatted_type(val, colormap, color, quote=False):
- bval = ensure_text(str(val))
+ bval = str(val)
if quote:
bval = "'%s'" % bval
return colorme(bval, colormap, color)
@@ -335,7 +333,7 @@ def format_floating_point_type(val, colormap, float_precision, decimal_sep=None,
def format_integer_type(val, colormap, thousands_sep=None, **_):
# base-10 only for now; support others?
bval = format_integer_with_thousands_sep(val, thousands_sep) if thousands_sep else str(val)
- bval = ensure_text(bval)
+ bval = str(bval)
return colorme(bval, colormap, 'int')
@@ -370,7 +368,7 @@ def format_value_timestamp(val, colormap, date_time_format, quote=False, **_):
if date_time_format.milliseconds_only:
bval = round_microseconds(bval)
else:
- bval = ensure_text(str(val))
+ bval = str(val)
if quote:
bval = "'%s'" % bval
diff --git a/pylib/cqlshlib/helptopics.py b/pylib/cqlshlib/helptopics.py
index 46cd1561e639..9be56b9f2ec7 100644
--- a/pylib/cqlshlib/helptopics.py
+++ b/pylib/cqlshlib/helptopics.py
@@ -15,7 +15,7 @@
# limitations under the License.
-class CQL3HelpTopics(object):
+class CQL3HelpTopics:
def get_help_topics(self):
return [t[5:] for t in dir(self) if t.startswith('help_')]
diff --git a/pylib/cqlshlib/saferscanner.py b/pylib/cqlshlib/saferscanner.py
index 6d7ba571afde..7cdfa3ca62ea 100644
--- a/pylib/cqlshlib/saferscanner.py
+++ b/pylib/cqlshlib/saferscanner.py
@@ -19,7 +19,6 @@
# regex in-pattern flags. Any of those can break correct operation of Scanner.
import re
-import six
try:
from sre_constants import BRANCH, SUBPATTERN, GROUPREF, GROUPREF_IGNORE, GROUPREF_EXISTS
except ImportError:
@@ -118,7 +117,7 @@ def __init__(self, lexicon, flags=0):
self.scanner = re._compiler.compile(p)
-SaferScanner = Py36SaferScanner if six.PY3 else Py2SaferScanner
+SaferScanner = Py36SaferScanner
if version_info >= (3, 11):
SaferScanner = Py311SaferScanner
elif version_info >= (3, 8):
diff --git a/pylib/cqlshlib/sslhandling.py b/pylib/cqlshlib/sslhandling.py
index 8a7592c117dc..3422ed739e82 100644
--- a/pylib/cqlshlib/sslhandling.py
+++ b/pylib/cqlshlib/sslhandling.py
@@ -18,7 +18,7 @@
import sys
import ssl
-from six.moves import configparser
+import configparser
def ssl_settings(host, config_file, env=os.environ):
diff --git a/pylib/cqlshlib/test/ansi_colors.py b/pylib/cqlshlib/test/ansi_colors.py
index 9fc341154c5f..e8f6f35bdcbe 100644
--- a/pylib/cqlshlib/test/ansi_colors.py
+++ b/pylib/cqlshlib/test/ansi_colors.py
@@ -17,7 +17,6 @@
from __future__ import unicode_literals
import re
-import six
LIGHT = 0o10
@@ -106,7 +105,7 @@ def colortag(self):
class ColoredText(object):
def __init__(self, source=''):
- if isinstance(source, six.text_type):
+ if isinstance(source, str):
plain, colors = self.parse_ansi_colors(source)
self.chars = list(map(ColoredChar, plain, colors))
else:
diff --git a/pylib/cqlshlib/test/run_cqlsh.py b/pylib/cqlshlib/test/run_cqlsh.py
index f592cc078f28..d79a22f9848e 100644
--- a/pylib/cqlshlib/test/run_cqlsh.py
+++ b/pylib/cqlshlib/test/run_cqlsh.py
@@ -40,7 +40,7 @@ def is_win():
import pty
DEFAULT_PREFIX = os.linesep
-DEFAULT_CQLSH_PROMPT = DEFAULT_PREFIX + '(\S+@)?cqlsh(:\S+)?> '
+DEFAULT_CQLSH_PROMPT = DEFAULT_PREFIX + r'(\S+@)?cqlsh(:\S+)?> '
DEFAULT_CQLSH_TERM = 'xterm'
try:
diff --git a/pylib/cqlshlib/test/winpty.py b/pylib/cqlshlib/test/winpty.py
index f197aa5b4533..593b76d755e8 100644
--- a/pylib/cqlshlib/test/winpty.py
+++ b/pylib/cqlshlib/test/winpty.py
@@ -15,8 +15,8 @@
# limitations under the License.
from threading import Thread
-from six import StringIO
-from six.moves.queue import Queue, Empty
+from io import StringIO
+from queue import Queue, Empty
class WinPty(object):
diff --git a/pylib/cqlshlib/tracing.py b/pylib/cqlshlib/tracing.py
index 17ca964dd75a..985c43e21534 100644
--- a/pylib/cqlshlib/tracing.py
+++ b/pylib/cqlshlib/tracing.py
@@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from datetime import datetime, timedelta
+from datetime import datetime
import time
from cassandra.query import QueryTrace, TraceUnavailable
@@ -128,8 +128,6 @@ def make_trace_rows(trace, tracing_mode):
if trace.duration:
finished_at = (datetime_from_utc_to_local(trace.started_at) + trace.duration)
rows.append(['Request complete', str(finished_at), trace.coordinator, total_micro_seconds(trace.duration), trace.client])
- else:
- finished_at = trace.duration = "--"
return rows
diff --git a/pylib/cqlshlib/util.py b/pylib/cqlshlib/util.py
index 5df7edef62af..144586aae051 100644
--- a/pylib/cqlshlib/util.py
+++ b/pylib/cqlshlib/util.py
@@ -23,7 +23,7 @@
import stat
from datetime import timedelta, tzinfo
-from six import StringIO
+from io import StringIO
try:
from line_profiler import LineProfiler
diff --git a/pylib/requirements.txt b/pylib/requirements.txt
index 3c2e41b85c03..ea66632c2ef0 100644
--- a/pylib/requirements.txt
+++ b/pylib/requirements.txt
@@ -1,17 +1,6 @@
-# See python driver docs: six have to be installed before
-# cythonizing the driver, perhaps only on old pips.
-# http://datastax.github.io/python-driver/installation.html#cython-based-extensions
-six>=1.12.0
--e git+https://github.com/datastax/python-driver.git@cassandra-test#egg=cassandra-driver
+-e git+https://github.com/apache/cassandra-python-driver.git@3.30.0#egg=cassandra-driver
# Used ccm version is tracked by cassandra-test branch in ccm repo. Please create a PR there for fixes or upgrades to new releases.
-e git+https://github.com/datastax/cassandra-ccm.git@converged-cassandra#egg=ccm
coverage
-decorator
-docopt
-enum34
-flaky
-mock
pytest
-parse
-pycodestyle
-psutil
+wcwidth
diff --git a/pylib/setup.py b/pylib/setup.py
index a9f654a67700..f5fd1841b3e7 100755
--- a/pylib/setup.py
+++ b/pylib/setup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
diff --git a/redhat/cassandra.spec b/redhat/cassandra.spec
index 47852624521e..bead23da83d8 100644
--- a/redhat/cassandra.spec
+++ b/redhat/cassandra.spec
@@ -17,8 +17,8 @@
#
%define __jar_repack %{nil}
-# Turn off the brp-python-bytecompile script
-%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
+# Turn off the brp-python-bytecompile script and mangling shebangs for Python scripts
+%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g' -e 's!/usr/lib[^[:space:]]*/brp-mangle-shebangs[[:space:]].*$!!g')
# rpmbuild should not barf when it spots we ship
# binary executable files in our 'noarch' package
diff --git a/redhat/noboolean/cassandra.spec b/redhat/noboolean/cassandra.spec
index c1ff71259417..4ba59d0b6f88 100644
--- a/redhat/noboolean/cassandra.spec
+++ b/redhat/noboolean/cassandra.spec
@@ -17,8 +17,8 @@
#
%define __jar_repack %{nil}
-# Turn off the brp-python-bytecompile script
-%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
+# Turn off the brp-python-bytecompile script and mangling shebangs for Python scripts
+%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g' -e 's!/usr/lib[^[:space:]]*/brp-mangle-shebangs[[:space:]].*$!!g')
# rpmbuild should not barf when it spots we ship
# binary executable files in our 'noarch' package