Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
DAP-2146: Addig Python3.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
paveu committed Mar 3, 2024
1 parent fc2f930 commit 2758112
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
six >=1.6
futures <=2.2.0
pyasyncore == 1.0.4
# Futures is not required for Python 3, but it works up through 2.2.0 (after which it introduced breaking syntax).
# This is left here to make sure install -r works with any runtime. When installing via setup.py, futures is omitted
# for Python 3, in favor of the standard library implementation.
Expand Down
34 changes: 23 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2016 DataStax, Inc.
# Copyright DataStax, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,8 +37,6 @@
DistutilsExecError)
from distutils.cmd import Command

PY3 = sys.version_info[0] == 3

try:
import subprocess
has_subprocess = True
Expand Down Expand Up @@ -146,7 +144,7 @@ def __init__(self, ext):

libev_ext = Extension('cassandra.io.libevwrapper',
sources=['cassandra/io/libevwrapper.c'],
include_dirs=['/usr/include/libev', '/usr/local/include', '/opt/local/include'],
include_dirs=['/usr/include/libev', '/usr/local/include', '/opt/local/include', '/opt/homebrew/include', os.path.expanduser('~/homebrew/include')],
libraries=['ev'],
library_dirs=['/usr/local/lib', '/opt/local/lib'])

Expand Down Expand Up @@ -348,6 +346,13 @@ def pre_build_check():
compiler = new_compiler(compiler=be.compiler)
customize_compiler(compiler)

try:
# We must be able to initialize the compiler if it has that method
if hasattr(compiler, "initialize"):
compiler.initialize()
except:
return False

executables = []
if compiler.compiler_type in ('unix', 'cygwin'):
executables = [compiler.executables[exe][0] for exe in ('compiler_so', 'linker_so')]
Expand Down Expand Up @@ -389,14 +394,19 @@ def run_setup(extensions):
# 2.) there could be a case where the python environment has cython installed but the system doesn't have build tools
if pre_build_check():
cython_dep = 'Cython>=0.20,!=0.25,<0.30'
user_specified_cython_version = os.environ.get('CASS_DRIVER_ALLOWED_CYTHON_VERSION')
if user_specified_cython_version is not None:
cython_dep = 'Cython==%s' % (user_specified_cython_version,)
kw['setup_requires'] = [cython_dep]
else:
sys.stderr.write("Bypassing Cython setup requirement\n")

dependencies = ['six >=1.6']
dependencies = ['six >=1.6', 'pyasyncore == 1.0.4']

if not PY3:
dependencies.append('futures')
_EXTRAS_REQUIRE = {
'graph': ['gremlinpython==3.4.6'],
'cle': ['cryptography>=35.0']
}

setup(
name='cassandra-driver',
Expand All @@ -410,6 +420,7 @@ def run_setup(extensions):
keywords='cassandra,cql,orm',
include_package_data=True,
install_requires=dependencies,
extras_require=_EXTRAS_REQUIRE,
tests_require=['nose', 'mock<=1.0.1', 'PyYAML', 'pytz', 'sure'],
classifiers=[
'Development Status :: 5 - Production/Stable',
Expand All @@ -418,10 +429,11 @@ def run_setup(extensions):
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development :: Libraries :: Python Modules'
Expand Down

0 comments on commit 2758112

Please sign in to comment.