File tree Expand file tree Collapse file tree 3 files changed +51
-25
lines changed Expand file tree Collapse file tree 3 files changed +51
-25
lines changed Original file line number Diff line number Diff line change @@ -544,6 +544,7 @@ def mypycify(
544544 mypyc_trace.txt (derived from executed operations). This is
545545 useful for performance analysis, such as analyzing which
546546 primitive ops are used the most and on which lines.
547+ depends_on_native_internal: This is True only for mypy itself.
547548 install_native_libs: If True, also build the native extension modules. Normally,
548549 those are build and published on PyPI separately, but during
549550 tests, we want to use their development versions (i.e. from
Original file line number Diff line number Diff line change @@ -44,28 +44,52 @@ def run(self):
4444 return build_ext .run (self )
4545
4646
47- setup (
48- name = "test_capi" ,
49- version = "0.1" ,
50- ext_modules = [
51- Extension (
52- "test_capi" ,
53- [
54- "test_capi.cc" ,
55- "init.c" ,
56- "int_ops.c" ,
57- "float_ops.c" ,
58- "list_ops.c" ,
59- "exc_ops.c" ,
60- "generic_ops.c" ,
61- "pythonsupport.c" ,
62- ],
63- depends = ["CPy.h" , "mypyc_util.h" , "pythonsupport.h" ],
64- extra_compile_args = ["-Wno-unused-function" , "-Wno-sign-compare" ] + compile_args ,
65- libraries = ["gtest" ],
66- include_dirs = ["../external/googletest" , "../external/googletest/include" ],
67- ** kwargs ,
68- )
69- ],
70- cmdclass = {"build_ext" : build_ext_custom },
71- )
47+ if "--run-capi-tests" in sys .argv :
48+ sys .argv .pop ()
49+ setup (
50+ name = "test_capi" ,
51+ version = "0.1" ,
52+ ext_modules = [
53+ Extension (
54+ "test_capi" ,
55+ [
56+ "test_capi.cc" ,
57+ "init.c" ,
58+ "int_ops.c" ,
59+ "float_ops.c" ,
60+ "list_ops.c" ,
61+ "exc_ops.c" ,
62+ "generic_ops.c" ,
63+ "pythonsupport.c" ,
64+ ],
65+ depends = ["CPy.h" , "mypyc_util.h" , "pythonsupport.h" ],
66+ extra_compile_args = ["-Wno-unused-function" , "-Wno-sign-compare" ] + compile_args ,
67+ libraries = ["gtest" ],
68+ include_dirs = ["../external/googletest" , "../external/googletest/include" ],
69+ ** kwargs ,
70+ )
71+ ],
72+ cmdclass = {"build_ext" : build_ext_custom },
73+ )
74+ else :
75+ # TODO: this is a stub, we need a way to share common build logic with
76+ # mypyc/build.py without code duplication.
77+ setup (
78+ name = "mypy-native" ,
79+ version = "0.0.1" ,
80+ ext_modules = [
81+ Extension (
82+ "native_internal" ,
83+ [
84+ "native_internal.c" ,
85+ "init.c" ,
86+ "int_ops.c" ,
87+ "exc_ops.c" ,
88+ "pythonsupport.c" ,
89+ ],
90+ include_dirs = ["." ],
91+ ** kwargs ,
92+ )
93+ ],
94+ cmdclass = {"build_ext" : build_ext_custom },
95+ )
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ def test_c_unit_test(self) -> None:
3434 "build_ext" ,
3535 f"--build-lib={ tmpdir } " ,
3636 f"--build-temp={ tmpdir } " ,
37+ "--run-capi-tests" ,
3738 ],
3839 env = env ,
3940 cwd = os .path .join (base_dir , "mypyc" , "lib-rt" ),
You can’t perform that action at this time.
0 commit comments