mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 17:27:39 +02:00
DRYer
This commit is contained in:
@@ -119,7 +119,8 @@ init_simd(void *x) {
|
|||||||
PyObject *module = (PyObject*)x;
|
PyObject *module = (PyObject*)x;
|
||||||
if (PyModule_AddFunctions(module, module_methods) != 0) return false;
|
if (PyModule_AddFunctions(module, module_methods) != 0) return false;
|
||||||
#define A(x, val) { Py_INCREF(Py_##val); if (0 != PyModule_AddObject(module, #x, Py_##val)) return false; }
|
#define A(x, val) { Py_INCREF(Py_##val); if (0 != PyModule_AddObject(module, #x, Py_##val)) return false; }
|
||||||
#define do_check() has_sse4_2 = __builtin_cpu_supports("sse4.2") != 0; has_avx2 = __builtin_cpu_supports("avx2") != 0;
|
#define do_check() { has_sse4_2 = __builtin_cpu_supports("sse4.2") != 0; has_avx2 = __builtin_cpu_supports("avx2") != 0; }
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#ifdef __arm64__
|
#ifdef __arm64__
|
||||||
// simde takes care of NEON on Apple Silicon
|
// simde takes care of NEON on Apple Silicon
|
||||||
@@ -136,6 +137,7 @@ init_simd(void *x) {
|
|||||||
do_check();
|
do_check();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef do_check
|
#undef do_check
|
||||||
if (has_avx2) {
|
if (has_avx2) {
|
||||||
A(has_avx2, True);
|
A(has_avx2, True);
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ from typing import (
|
|||||||
Tuple,
|
Tuple,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from . import BaseTest
|
||||||
|
|
||||||
|
|
||||||
def contents(package: str) -> Iterator[str]:
|
def contents(package: str) -> Iterator[str]:
|
||||||
try:
|
try:
|
||||||
@@ -269,6 +271,7 @@ def run_tests(report_env: bool = False) -> None:
|
|||||||
else:
|
else:
|
||||||
go_proc = None
|
go_proc = None
|
||||||
with env_for_python_tests(report_env):
|
with env_for_python_tests(report_env):
|
||||||
|
sys.stdout.flush()
|
||||||
run_python_tests(args, go_proc)
|
run_python_tests(args, go_proc)
|
||||||
|
|
||||||
|
|
||||||
@@ -295,7 +298,8 @@ def env_for_python_tests(report_env: bool = False) -> Iterator[None]:
|
|||||||
launcher_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kitty', 'launcher')
|
launcher_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'kitty', 'launcher')
|
||||||
path = f'{launcher_dir}{os.pathsep}{path}'
|
path = f'{launcher_dir}{os.pathsep}{path}'
|
||||||
python_for_type_check()
|
python_for_type_check()
|
||||||
if os.environ.get('CI') == 'true' or report_env:
|
print('Running under CI:', BaseTest.is_ci)
|
||||||
|
if BaseTest.is_ci or report_env:
|
||||||
print('Using PATH in test environment:', path)
|
print('Using PATH in test environment:', path)
|
||||||
print('Python:', python_for_type_check())
|
print('Python:', python_for_type_check())
|
||||||
from kitty.fast_data_types import has_avx2, has_sse4_2
|
from kitty.fast_data_types import has_avx2, has_sse4_2
|
||||||
|
|||||||
Reference in New Issue
Block a user