Skip to content

Commit fa56ca7

Browse files
committed
Test programs build, most tests pass, incremental build works
- pyi generation is broken, need to think about it
1 parent a679066 commit fa56ca7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+267
-210
lines changed

examples/demo/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ version = "0.0.1"
3535
name = "demo"
3636

3737
[tool.semiwrap.extension_modules."swdemo._demo".headers]
38-
demo = "swdemo/include/demo.h"
38+
demo = "include/demo.h"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/meson.build

src/semiwrap/autowrap/render_cls_prologue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ def render_class_prologue(r: RenderBuffer, hctx: HeaderContext):
3838
r.writeln(
3939
f"#define RPYGEN_ENABLE_{cls.full_cpp_name_identifier}_PROTECTED_CONSTRUCTORS"
4040
)
41-
r.writeln(f"#include <rpygen/{cls.full_cpp_name_identifier}.hpp>")
41+
r.writeln(f"#include <trampolines/{cls.full_cpp_name_identifier}.hpp>")

src/semiwrap/autowrap/render_cls_rpy_include.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ def render_cls_rpy_include_hpp(ctx: HeaderContext, cls: ClassContext) -> str:
4040
)
4141

4242
if ctx.extra_includes_first:
43-
r.writeln()
43+
r.writeln("\n// from extra_includes_first")
4444
for inc in ctx.extra_includes_first:
4545
r.writeln(f"#include <{inc}>")
4646

47-
r.writeln(f"\n#include <{ctx.rel_fname}>")
47+
r.writeln("\n// wrapped header")
48+
r.writeln(f"#include <{ctx.rel_fname}>")
4849

4950
if ctx.extra_includes:
50-
r.writeln()
51+
r.writeln("\n// from extra_includes")
5152
for inc in ctx.extra_includes:
5253
r.writeln(f"#include <{inc}>")
5354

@@ -104,7 +105,7 @@ def _render_cls_trampoline(
104105
if cls.bases:
105106
r.writeln()
106107
for base in cls.bases:
107-
r.writeln(f"#include <rpygen/{ base.full_cpp_name_identifier }.hpp>")
108+
r.writeln(f"#include <trampolines/{ base.full_cpp_name_identifier }.hpp>")
108109

109110
if cls.namespace:
110111
r.writeln(f"\nnamespace {cls.namespace.strip('::')} {{")

src/semiwrap/autowrap/render_tmpl_inst.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def render_template_inst_cpp(
1414

1515
r.write_trim(
1616
f"""
17-
#include <rpygen/{ tmpl_data.header_name }>
17+
#include <trampolines/{ tmpl_data.header_name }>
1818
#include "{ hctx.hname }_tmpl.hpp"
1919
2020
namespace rpygen {{

src/semiwrap/casters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import typing as T
55

66
from .config.util import parse_input
7-
from .util import maybe_write_file
87

98
PKGCONF_CASTER_EXT = ".pybind11.json"
109

@@ -28,7 +27,8 @@ def load_typecaster_data(fname) -> TypeCasterData:
2827

2928

3029
def save_typecaster_data(fname: pathlib.Path, data: TypeCasterData):
31-
maybe_write_file(fname, json.dumps(dataclasses.asdict(data)))
30+
with open(fname, "w") as fp:
31+
json.dump(dataclasses.asdict(data), fp)
3232

3333

3434
#: content of pickle file

src/semiwrap/cmd_dat2cpp.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from .autowrap.context import HeaderContext
1111
from .autowrap.render_wrapped import render_wrapped_cpp
12-
from .util import maybe_write_file
1312

1413

1514
def _write_wrapper_cpp(input_dat: pathlib.Path, output_cpp: pathlib.Path):
@@ -19,8 +18,7 @@ def _write_wrapper_cpp(input_dat: pathlib.Path, output_cpp: pathlib.Path):
1918
assert isinstance(hctx, HeaderContext)
2019

2120
content = render_wrapped_cpp(hctx)
22-
maybe_write_file(output_cpp, content)
23-
21+
output_cpp.write_text(content)
2422

2523
def main():
2624
try:

src/semiwrap/cmd_dat2tmplcpp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from .autowrap.context import HeaderContext
1111
from .autowrap.render_tmpl_inst import render_template_inst_cpp
12-
from .util import maybe_write_file
1312

1413

1514
def _write_wrapper_cpp(
@@ -27,7 +26,7 @@ def _write_wrapper_cpp(
2726
raise ValueError(f"internal error: cannot find {py_name}")
2827

2928
content = render_template_inst_cpp(hctx, tmpl)
30-
maybe_write_file(output_cpp, content)
29+
output_cpp.write_text(content)
3130

3231

3332
def main():

src/semiwrap/cmd_dat2tmplhpp.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from .autowrap.context import HeaderContext
99
from .autowrap.render_tmpl_inst import render_template_inst_hpp
10-
from .util import maybe_write_file
1110

1211

1312
def _write_tmpl_hpp(input_dat: pathlib.Path, output_hpp: pathlib.Path):
@@ -17,7 +16,7 @@ def _write_tmpl_hpp(input_dat: pathlib.Path, output_hpp: pathlib.Path):
1716
assert isinstance(hctx, HeaderContext)
1817

1918
content = render_template_inst_hpp(hctx)
20-
maybe_write_file(output_hpp, content)
19+
output_hpp.write_text(content)
2120

2221

2322
def main():

src/semiwrap/cmd_dat2trampoline.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from .autowrap.context import HeaderContext, ClassContext
1111
from .autowrap.render_cls_rpy_include import render_cls_rpy_include_hpp
12-
from .util import maybe_write_file
1312

1413

1514
def _get_classes(hctx: HeaderContext):
@@ -41,7 +40,7 @@ def _write_wrapper_cpp(
4140
raise ValueError(f"internal error: cannot find {yml_id} (found {avail})")
4241

4342
content = render_cls_rpy_include_hpp(hctx, cls)
44-
maybe_write_file(output_hpp, content)
43+
output_hpp.write_text(content)
4544

4645

4746
def main():

0 commit comments

Comments
 (0)