Skip to content

Commit c6f7075

Browse files
linesightclaude
andcommitted
Add Python 3.12/3.13/3.14 support and fix Python 3.12 SyntaxWarnings
- cefpython_public_api.h: add PY_MINOR_VERSION cases for 3.12, 3.13, 3.14 - build.py: fix invalid escape sequences in regex strings (SyntaxWarning on 3.12+) - cefpython3.__init__.py: add import branches for 3.12, 3.13, 3.14 - cefpython3.setup.py: add PyPI classifiers for 3.12, 3.13, 3.14 - make_installer.py: add .pyd checks and update comments for 3.12, 3.13, 3.14 - build_distrib.py: add (3,12)/(3,13)/(3,14) to version lists Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 4db1564 commit c6f7075

6 files changed

Lines changed: 36 additions & 15 deletions

File tree

src/common/cefpython_public_api.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@
5454
#include "../../build/build_cefpython/cefpython_py310_fixed.h"
5555
#elif PY_MINOR_VERSION == 11
5656
#include "../../build/build_cefpython/cefpython_py311_fixed.h"
57+
#elif PY_MINOR_VERSION == 12
58+
#include "../../build/build_cefpython/cefpython_py312_fixed.h"
59+
#elif PY_MINOR_VERSION == 13
60+
#include "../../build/build_cefpython/cefpython_py313_fixed.h"
61+
#elif PY_MINOR_VERSION == 14
62+
#include "../../build/build_cefpython/cefpython_py314_fixed.h"
5763
#endif // PY_MINOR_VERSION
5864
#endif // PY_MAJOR_VERSION
5965

tools/build.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -644,23 +644,23 @@ def except_all_missing(content):
644644
patterns = list()
645645
patterns.append(
646646
r"\bcp?def\s+"
647-
"((int|short|long|double|char|unsigned|float|double|cpp_bool"
648-
"|cpp_string|cpp_wstring|uintptr_t|void"
649-
"|int32|uint32|int64|uint64"
650-
"|int32_t|uint32_t|int64_t|uint64_t"
651-
"|CefString)\s+)+"
652-
"\w+\([^)]*\)\s*(with\s+(gil|nogil))?\s*:")
647+
r"((int|short|long|double|char|unsigned|float|double|cpp_bool"
648+
r"|cpp_string|cpp_wstring|uintptr_t|void"
649+
r"|int32|uint32|int64|uint64"
650+
r"|int32_t|uint32_t|int64_t|uint64_t"
651+
r"|CefString)\s+)+"
652+
r"\w+\([^)]*\)\s*(with\s+(gil|nogil))?\s*:")
653653
patterns.append(
654654
r"\bcp?def\s+"
655655
# A template ends with bracket: CefRefPtr[CefBrowser]
656656
# or a pointer ends with asterisk: CefBrowser*
657-
"[^\s]+[\]*]\s+"
658-
"\w+\([^)]*\)\s*(with\s+(gil|nogil))?\s*:")
657+
r"[^\s]+[\]*]\s+"
658+
r"\w+\([^)]*\)\s*(with\s+(gil|nogil))?\s*:")
659659
patterns.append(
660660
r"\bcp?def\s+"
661661
# A reference, eg. CefString&
662-
"[^\s]+&\s+"
663-
"\w+\([^)]*\)\s*(with\s+(gil|nogil))?\s*:")
662+
r"[^\s]+&\s+"
663+
r"\w+\([^)]*\)\s*(with\s+(gil|nogil))?\s*:")
664664

665665
match = None
666666
for pattern in patterns:

tools/build_distrib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
ALLOW_PARTIAL = False
8181

8282
# Python versions
83-
SUPPORTED_PYTHON_VERSIONS = [(2, 7), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11)]
83+
SUPPORTED_PYTHON_VERSIONS = [(2, 7), (3, 4), (3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11), (3, 12), (3, 13), (3, 14)]
8484

8585
# Python search paths. It will use first Python found for specific version.
8686
# Supports replacement of one environment variable in path eg.: %ENV_KEY%.
@@ -623,7 +623,7 @@ def check_cpp_extension_dependencies_issue359(setup_dir, all_pythons):
623623
return
624624
checked_any = False
625625
for python in all_pythons:
626-
if python["version2"] in ((3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11)):
626+
if python["version2"] in ((3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11), (3, 12), (3, 13), (3, 14)):
627627
checked_any = True
628628
if not os.path.exists(os.path.join(setup_dir, "cefpython3",
629629
"msvcp140.dll")):

tools/installer/cefpython3.__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,14 @@
7676
elif sys.version_info[:2] == (3, 11):
7777
# noinspection PyUnresolvedReferences
7878
from . import cefpython_py311 as cefpython
79+
elif sys.version_info[:2] == (3, 12):
80+
# noinspection PyUnresolvedReferences
81+
from . import cefpython_py312 as cefpython
82+
elif sys.version_info[:2] == (3, 13):
83+
# noinspection PyUnresolvedReferences
84+
from . import cefpython_py313 as cefpython
85+
elif sys.version_info[:2] == (3, 14):
86+
# noinspection PyUnresolvedReferences
87+
from . import cefpython_py314 as cefpython
7988
else:
8089
raise Exception("Python version not supported: " + sys.version)

tools/installer/cefpython3.setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ def main():
152152
"Programming Language :: Python :: 3.9",
153153
"Programming Language :: Python :: 3.10",
154154
"Programming Language :: Python :: 3.11",
155+
"Programming Language :: Python :: 3.12",
156+
"Programming Language :: Python :: 3.13",
157+
"Programming Language :: Python :: 3.14",
155158
"Topic :: Desktop Environment",
156159
"Topic :: Internet",
157160
"Topic :: Internet :: WWW/HTTP",

tools/make_installer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def create_empty_log_file(log_file):
338338

339339
def copy_cpp_extension_dependencies_issue359(pkg_dir):
340340
"""CEF Python module is written in Cython and is a Python C++
341-
extension and depends on msvcpXX.dll. For Python 3.5 / 3.6 / 3.7 / 3.8 / 3.9 / 3.10 / 3.11
341+
extension and depends on msvcpXX.dll. For Python 3.5 / 3.6 / 3.7 / 3.8 / 3.9 / 3.10 / 3.11 / 3.12 / 3.13 / 3.14
342342
msvcp140.dll is required. See Issue #359. For Python 2.7
343343
msvcp90.dll is required. Etc. These dependencies are not included
344344
with Python binaries from Python.org."""
@@ -365,14 +365,17 @@ def copy_cpp_extension_dependencies_issue359(pkg_dir):
365365
# in the package. Thus if included, msvcpxx.dll dependency is
366366
# required as well.
367367

368-
# Python 3.5 / 3.6 / 3.7 / 3.8 / 3.9 / 3.10 / 3.11
368+
# Python 3.5 / 3.6 / 3.7 / 3.8 / 3.9 / 3.10 / 3.11 / 3.12 / 3.13 / 3.14
369369
if os.path.exists(os.path.join(pkg_dir, "cefpython_py35.pyd")) \
370370
or os.path.exists(os.path.join(pkg_dir, "cefpython_py36.pyd")) \
371371
or os.path.exists(os.path.join(pkg_dir, "cefpython_py37.pyd")) \
372372
or os.path.exists(os.path.join(pkg_dir, "cefpython_py38.pyd")) \
373373
or os.path.exists(os.path.join(pkg_dir, "cefpython_py39.pyd")) \
374374
or os.path.exists(os.path.join(pkg_dir, "cefpython_py310.pyd")) \
375-
or os.path.exists(os.path.join(pkg_dir, "cefpython_py311.pyd")):
375+
or os.path.exists(os.path.join(pkg_dir, "cefpython_py311.pyd")) \
376+
or os.path.exists(os.path.join(pkg_dir, "cefpython_py312.pyd")) \
377+
or os.path.exists(os.path.join(pkg_dir, "cefpython_py313.pyd")) \
378+
or os.path.exists(os.path.join(pkg_dir, "cefpython_py314.pyd")):
376379
search_paths = [
377380
# This is where Microsoft Visual C++ 2015 Update 3 installs
378381
# (14.00.24212).

0 commit comments

Comments
 (0)