Skip to content

Commit e89cfc1

Browse files
committed
Merge branch 'vnext'
2 parents 733419a + 241bcf2 commit e89cfc1

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

.github/workflows/test.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,35 @@ jobs:
209209
shell: bash
210210
run: cmake --build out --config ${{env.BUILD_TYPE}} --target run-test
211211

212+
pythons:
213+
runs-on: ubuntu-latest
214+
strategy:
215+
fail-fast: false
216+
matrix:
217+
python-version: [
218+
"3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t",
219+
"pypy-3.9", "pypy-3.10", "pypy-3.11"
220+
]
221+
steps:
222+
- name: Checkout
223+
uses: actions/checkout@v4
224+
225+
- name: Set up Python
226+
uses: actions/setup-python@v5
227+
id: setup-python
228+
with:
229+
python-version: ${{matrix.python-version}}
212230

231+
- name: Configure
232+
shell: bash
233+
run: |
234+
cmake -S . -B out -DCMAKE_BUILD_TYPE=$BUILD_TYPE
235+
236+
- name: Build and Test
237+
shell: bash
238+
run: |
239+
cmake --build out --config $BUILD_TYPE --target test-20python test-23python
240+
echo Running test-20python
241+
out/test/test-20python -ni -fc
242+
echo Running test-23python
243+
out/test/test-23python -ni -fc

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ endif()
3030

3131
add_subdirectory(lib)
3232

33-
if(${Python3_Interpreter_FOUND})
33+
if(${Python3_Interpreter_FOUND} AND ${Python3_VERSION} VERSION_GREATER_EQUAL "3.9")
3434

3535
file(GLOB UNICODE_DATA ${CMAKE_CURRENT_LIST_DIR}/unicode/data/*.txt)
3636
file(GLOB UNICODE_SCRIPTS ${CMAKE_CURRENT_LIST_DIR}/unicode/scripts/*.py)

test/test_main.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ JNIEnv * g_env;
7373

7474
#endif
7575

76+
#if defined(SYS_STRING_USE_PYTHON) && defined(PYPY_VERSION)
77+
78+
extern "C" {
79+
void rpython_startup_code(void);
80+
int pypy_setup_home(char *home, int verbose);
81+
}
82+
83+
#endif
84+
7685
int main(int argc, char** argv)
7786
{
7887
#if defined(__ANDROID__)
@@ -86,8 +95,15 @@ int main(int argc, char** argv)
8695
#endif
8796

8897
#if defined(SYS_STRING_USE_PYTHON)
89-
Py_Initialize();
98+
#if !defined(PYPY_VERSION)
99+
Py_Initialize();
100+
#else
101+
rpython_startup_code();
102+
pypy_setup_home(nullptr, 1);
103+
#endif
90104
#endif
105+
106+
91107

92108
return doctest::Context(argc, argv).run();
93109
}

0 commit comments

Comments
 (0)