Skip to content

Commit 08bb94f

Browse files
committed
Disabled debugger for Python 3.13
1 parent 3a3d0cd commit 08bb94f

File tree

3 files changed

+47
-37
lines changed

3 files changed

+47
-37
lines changed

CMakeLists.txt

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,41 +27,6 @@ set(${PROJECT_NAME}_VERSION
2727
${XPYT_VERSION_MAJOR}.${XPYT_VERSION_MINOR}.${XPYT_VERSION_PATCH})
2828
message(STATUS "Building xeus-python v${${PROJECT_NAME}_VERSION}")
2929

30-
# Configuration
31-
# =============
32-
33-
include(GNUInstallDirs)
34-
35-
if (NOT DEFINED XPYTHON_KERNELSPEC_PATH)
36-
set(XPYTHON_KERNELSPEC_PATH "${CMAKE_INSTALL_FULL_BINDIR}/")
37-
endif ()
38-
39-
if(EMSCRIPTEN)
40-
# the variables PYTHON_VERSION_MAJOR and PYTHON_VERSION_MINOR
41-
# might be wrong for the EMSCRIPTEN case since it may contains
42-
# the versions of build-python and not the one of the host.
43-
FILE(GLOB WASM_PYTHON_LIBRARY $ENV{PREFIX}/lib/libpython*.a)
44-
STRING(REGEX MATCH "python[0-9]+[.][0-9]+" PYTHON_VERSION_STRING ${WASM_PYTHON_LIBRARY})
45-
STRING(REGEX MATCH "[0-9]+" PYTHON_VERSION_MAJOR ${PYTHON_VERSION_STRING})
46-
STRING(REGEX MATCH "[0-9]+$" PYTHON_VERSION_MINOR ${PYTHON_VERSION_STRING})
47-
48-
configure_file (
49-
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython/wasm_kernel.json.in"
50-
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython/kernel.json"
51-
)
52-
else()
53-
configure_file (
54-
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython/kernel.json.in"
55-
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython/kernel.json"
56-
)
57-
configure_file (
58-
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython-raw/kernel.json.in"
59-
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython-raw/kernel.json"
60-
)
61-
endif()
62-
63-
64-
6530
# Build options
6631
# =============
6732

@@ -142,6 +107,51 @@ else ()
142107
endif ()
143108
endif()
144109

110+
# Configuration
111+
# =============
112+
113+
include(GNUInstallDirs)
114+
115+
if (NOT DEFINED XPYTHON_KERNELSPEC_PATH)
116+
set(XPYTHON_KERNELSPEC_PATH "${CMAKE_INSTALL_FULL_BINDIR}/")
117+
endif ()
118+
119+
if (NOT DEFINED XPYTHON_DEBUGGER_AVAILABLE)
120+
message(STATUS "PYTHON_VERSION = ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
121+
if ((PYTHON_VERSION_MAJOR EQUAL 3) AND (PYTHON_VERSION_MINOR EQUAL 13))
122+
set(XPYTHON_DEBUGGER_AVAILABLE "false")
123+
else ()
124+
set(XPYTHON_DEBUGGER_AVAILABLE "true")
125+
endif ()
126+
message(STATUS "XPYTHON_DEBUGGER_AVAILABLE=${XPYTHON_DEBUGGER_AVAILABLE}")
127+
endif ()
128+
129+
if(EMSCRIPTEN)
130+
# the variables PYTHON_VERSION_MAJOR and PYTHON_VERSION_MINOR
131+
# might be wrong for the EMSCRIPTEN case since it may contains
132+
# the versions of build-python and not the one of the host.
133+
FILE(GLOB WASM_PYTHON_LIBRARY $ENV{PREFIX}/lib/libpython*.a)
134+
STRING(REGEX MATCH "python[0-9]+[.][0-9]+" PYTHON_VERSION_STRING ${WASM_PYTHON_LIBRARY})
135+
STRING(REGEX MATCH "[0-9]+" PYTHON_VERSION_MAJOR ${PYTHON_VERSION_STRING})
136+
STRING(REGEX MATCH "[0-9]+$" PYTHON_VERSION_MINOR ${PYTHON_VERSION_STRING})
137+
138+
configure_file (
139+
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython/wasm_kernel.json.in"
140+
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython/kernel.json"
141+
)
142+
else()
143+
configure_file (
144+
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython/kernel.json.in"
145+
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython/kernel.json"
146+
)
147+
configure_file (
148+
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython-raw/kernel.json.in"
149+
"${CMAKE_CURRENT_SOURCE_DIR}/share/jupyter/kernels/xpython-raw/kernel.json"
150+
)
151+
endif()
152+
153+
154+
145155
# Source files
146156
# ============
147157

share/jupyter/kernels/xpython/kernel.json.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"{connection_file}"
77
],
88
"language": "python",
9-
"metadata": { "debugger": true}
9+
"metadata": { "debugger": @XPYTHON_DEBUGGER_AVAILABLE@}
1010
}

src/xinterpreter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ namespace xpyt
310310
"\n");
311311
#endif
312312
result["banner"] = banner;
313-
result["debugger"] = true;
313+
result["debugger"] = (PY_MAJOR_VERSION != 3) || (PY_MAJOR_VERSION != 13);
314314

315315
result["language_info"]["name"] = "python";
316316
result["language_info"]["version"] = PY_VERSION;

0 commit comments

Comments
 (0)