Skip to content

Commit 0c13433

Browse files
committed
Upgrade robotpy-wpiutil to semiwrap
1 parent d00f70e commit 0c13433

21 files changed

+133
-180
lines changed

subprojects/robotpy-wpiutil/.gitignore

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
.vscode
99

1010
__pycache__
11-
/wpiutil/include
12-
/wpiutil/lib
13-
/wpiutil/_init_wpiutil.py
14-
/wpiutil/pkgcfg.py
11+
/wpiutil/trampolines
12+
/wpiutil/_init__wpiutil.py
1513
/wpiutil/version.py
1614
/dist
1715
/build
1816

17+
*.pc
18+
*.pybind11.json
19+
1920
/tests/cpp/build
2021
/tests/cpp/wpiutil_test/_initmodule.py
2122
/tests/cpp/wpiutil_test/pkgcfg.py

subprojects/robotpy-wpiutil/gen/RawFrame.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
project('robotpy-wpiutil', ['cpp'],
2+
default_options: ['warning_level=1', 'cpp_std=c++20',
3+
'b_colorout=auto', 'optimization=2', 'b_pie=true'])
4+
5+
subdir('wrapcfg')
6+
7+
wpiutil_sources += files(
8+
'wpiutil/src/main.cpp',
9+
'wpiutil/src/safethread_gil.cpp',
10+
'wpiutil/src/stacktracehook.cpp',
11+
'wpiutil/src/wpistruct/wpystruct_fns.cpp',
12+
)
13+
14+
subdir('wrapcfg/modules')
Lines changed: 67 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,66 @@
1-
[tool.robotpy-build.metadata]
1+
[build-system]
2+
build-backend = "hatchling.build"
3+
requires = [
4+
"semiwrap", "hatch-meson", "hatch-vcs", "hatchling",
5+
"native.wpiutil==2025.3.2"
6+
]
7+
8+
[project]
29
name = "robotpy-wpiutil"
10+
dynamic = ["version"]
311
description = "Binary wrapper for FRC WPIUtil library"
4-
author = "RobotPy Development Team"
5-
author_email = "[email protected]"
6-
url = "https://github.com/robotpy/robotpy-wpiutil"
12+
authors = [
13+
{name = "RobotPy Development Team", email = "[email protected]"},
14+
]
715
license = "BSD-3-Clause"
816
install_requires = [
17+
"native.wpiutil==2025.3.2",
918
"msvc-runtime>=14.42.34433; platform_system == 'Windows'"
1019
]
1120

12-
[build-system]
13-
requires = [
14-
"robotpy-build~=2025.1.0",
15-
]
21+
[project.urls]
22+
"Source code" = "https://github.com/robotpy/robotpy-wpiutil"
1623

17-
[tool.robotpy-build]
18-
base_package = "wpiutil"
19-
update_init = [
20-
"wpiutil",
21-
"wpiutil.log wpiutil._wpiutil.log",
22-
"wpiutil.sync wpiutil._wpiutil.sync",
23-
"wpiutil.wpistruct wpiutil._wpiutil.wpistruct",
24-
]
25-
scan_headers_ignore = [
26-
"fmt/*",
27-
"google/*",
28-
"wpi/*",
29-
"wpystruct_fns.h",
30-
"pb.h",
31-
"pb_common.h",
32-
"pb_decode.h",
33-
"pb_encode.h",
34-
]
24+
[tool.hatch.version]
25+
source = "vcs"
26+
raw-options.root = "../.."
27+
28+
[tool.hatch.build.hooks.vcs]
29+
version-file = "wpiutil/version.py"
3530

36-
[tool.robotpy-build.wrappers."wpiutil"]
37-
name = "wpiutil"
38-
sources = [
39-
"wpiutil/src/main.cpp",
40-
"wpiutil/src/safethread_gil.cpp",
41-
"wpiutil/src/stacktracehook.cpp",
42-
"wpiutil/src/wpistruct/wpystruct_fns.cpp",
43-
]
44-
extra_includes = [
45-
"wpiutil/src/wpistruct",
46-
"wpiutil/src/type_casters",
47-
]
4831

49-
generation_data = "gen"
5032

51-
[tool.robotpy-build.wrappers."wpiutil".maven_lib_download]
52-
artifact_id = "wpiutil-cpp"
53-
group_id = "edu.wpi.first.wpiutil"
54-
repo_url = "https://frcmaven.wpi.edu/artifactory/release"
55-
# repo_url = "https://frcmaven.wpi.edu/artifactory/development"
56-
version = "2025.3.2"
33+
[tool.hatch.build.hooks.semiwrap]
34+
# update_init = [
35+
# "wpiutil",
36+
# "wpiutil.log wpiutil._wpiutil.log",
37+
# "wpiutil.sync wpiutil._wpiutil.sync",
38+
# "wpiutil.wpistruct wpiutil._wpiutil.wpistruct",
39+
# ]
40+
# scan_headers_ignore = [
41+
# "fmt/*",
42+
# "google/*",
43+
# "wpi/*",
44+
# "wpystruct_fns.h",
45+
# "pb.h",
46+
# "pb_common.h",
47+
# "pb_decode.h",
48+
# "pb_encode.h",
49+
# ]
5750

58-
libs = ["wpiutil"]
51+
[tool.hatch.build.hooks.meson]
52+
53+
54+
[tool.semiwrap]
55+
[tool.semiwrap.extension_modules."wpiutil._wpiutil"]
56+
name = "wpiutil"
57+
includes = [
58+
"wpiutil/src/wpistruct",
59+
]
60+
wraps = ["native.wpiutil"]
61+
depends = ["wpiutil-pybind11"]
5962

60-
[tool.robotpy-build.wrappers."wpiutil".autogen_headers]
63+
[tool.semiwrap.extension_modules."wpiutil._wpiutil".headers]
6164
# wpi
6265
DataLog = "wpi/DataLog.h"
6366
DataLogReader = "wpi/DataLogReader.h"
@@ -75,38 +78,45 @@ SendableRegistry = "wpi/sendable/SendableRegistry.h"
7578

7679
WPyStruct = "src/wpistruct/wpystruct_fns.h"
7780

78-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
81+
[tool.semiwrap.export_type_casters.wpiutil-pybind11]
82+
pypackage = "wpiutil"
83+
includedir = [
84+
"wpiutil/src/type_casters",
85+
"wpiutil/src/wpistruct",
86+
]
87+
88+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
7989
header = "wpi_array_type_caster.h"
8090
types = ["wpi::array"]
8191

82-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
92+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
8393
header = "wpi_json_type_caster.h"
8494
types = ["wpi::json"]
8595

86-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
96+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
8797
header = "wpi_span_type_caster.h"
8898
types = ["std::span"]
8999

90-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
100+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
91101
header = "wpi_smallset_type_caster.h"
92102
types = ["wpi::SmallSet"]
93103

94-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
104+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
95105
header = "wpi_smallvector_type_caster.h"
96106
types = ["wpi::SmallVector"]
97107

98-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
108+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
99109
header = "wpi_smallvectorimpl_type_caster.h"
100110
types = ["wpi::SmallVectorImpl"]
101111

102-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
112+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
103113
header = "wpi_string_map_caster.h"
104114
types = ["wpi::StringMap"]
105115

106-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
116+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
107117
header = "wpi_ct_string_type_caster.h"
108118
types = ["wpi::ct_string"]
109119

110-
[[tool.robotpy-build.wrappers."wpiutil".type_casters]]
120+
[[tool.semiwrap.export_type_casters.wpiutil-pybind11.headers]]
111121
header = "wpystruct.h"
112-
types = ["WPyStruct"]
122+
types = ["WPyStruct"]

subprojects/robotpy-wpiutil/wpiutil/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from . import _init_wpiutil
1+
from . import _init__wpiutil
22

33
# autogenerated by 'robotpy-build create-imports wpiutil wpiutil._wpiutil'
44
from ._wpiutil import (

subprojects/robotpy-wpiutil/wpiutil/src/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
#include <rpygen_wrapper.hpp>
2+
#include <autogen_module_init.hpp>
33

44
void setup_stack_trace_hook(py::object fn);
55
void cleanup_stack_trace_hook();
@@ -24,7 +24,7 @@ void cleanup_sendable_registry() {}
2424

2525
#endif
2626

27-
RPYBUILD_PYBIND11_MODULE(m) {
27+
SEMIWRAP_PYBIND11_MODULE(m) {
2828
initWrapper(m);
2929

3030
static int unused;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/meson.build

0 commit comments

Comments
 (0)