Skip to content

Commit c8ebb44

Browse files
committed
Migrate to semiwrap
1 parent 96c5878 commit c8ebb44

File tree

13 files changed

+93
-247
lines changed

13 files changed

+93
-247
lines changed

.gitignore

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*.py[cod]
1+
*.py[codi]
22
*.egg-info
33
__pycache__
44

@@ -7,12 +7,15 @@ __pycache__
77
*.dll
88

99
/navx/include
10-
/navx/rpy-include
11-
/navx/_init_navx.py
12-
/navx/pkgcfg.py
10+
/navx/trampolines
11+
/navx/_init__navx.py
12+
/navx/_init_studica_api.py
13+
/navx/navx.pc
14+
/navx/studica_api.pc
1315
/navx/version.py
1416

1517
.cache
1618
.coverage
1719
build
1820
dist
21+
/lib

gen/ITimestampedDataSubscriber.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

meson.build

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
project('robotpy-navx', ['cpp'],
2+
default_options: ['warning_level=1', 'cpp_std=c++20',
3+
'b_colorout=auto', 'optimization=2', 'b_pie=true'])
4+
5+
subdir('semiwrap')
6+
7+
navx_sources += files(
8+
'navx/src/rpy/navx.cpp',
9+
)
10+
11+
#
12+
# Static link
13+
#
14+
15+
cpp = meson.get_compiler('cpp')
16+
libs_path = meson.current_source_dir() + '/lib/lib'
17+
18+
navx_deps += [
19+
cpp.find_library('StudicaDriver', dirs: libs_path),
20+
cpp.find_library('Studica', dirs: libs_path),
21+
]
22+
23+
subdir('semiwrap/modules')

navx/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
from . import _init_navx
1+
from . import _init__navx
22

3-
# autogenerated by 'robotpy-build create-imports navx navx._navx'
3+
# autogenerated by 'semiwrap create-imports navx navx._navx'
44
from ._navx import AHRS
55

66
__all__ = ["AHRS"]

navx/py.typed

Whitespace-only changes.

navx/src/ahrs.h.patch

Lines changed: 0 additions & 11 deletions
This file was deleted.

navx/src/rpy/navx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#include <rpygen_wrapper.hpp>
1+
#include <semiwrap_init.navx._navx.hpp>
22

3-
RPYBUILD_PYBIND11_MODULE(m) { initWrapper(m); }
3+
SEMIWRAP_PYBIND11_MODULE(m) { initWrapper(m); }

navx/src/sources.patch

Lines changed: 0 additions & 162 deletions
This file was deleted.

pyproject.toml

Lines changed: 54 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,77 @@
11
[build-system]
2+
build-backend = "hatchling.build"
23
requires = [
3-
"robotpy-build~=2025.1.0",
4-
"wpilib<2026,>=2025.3.2",
4+
"hatchling",
5+
"hatch-vcs",
6+
"semiwrap~=0.1",
7+
"hatch-meson~=0.1.0b2",
8+
"hatch-robotpy~=0.2.0",
9+
"wpilib~=2025.3.2.2",
510
]
611

7-
[tool.robotpy-build]
8-
base_package = "navx"
912

10-
[tool.robotpy-build.metadata]
13+
[project]
1114
name = "robotpy-navx"
12-
description = "Python wrapper for KauaiLabs NavX sensor"
13-
author = "RobotPy Development Team"
14-
author_email = "robotpy@googlegroups.com"
15-
url = "https://github.com/robotpy/robotpy-navx"
15+
dynamic = ["version"]
16+
description = "Python wrapper for Studica NavX sensor"
1617
license = "BSD-3-Clause"
17-
install_requires = [
18-
"wpilib<2026,>=2025.3.2",
18+
dependencies = [
19+
"wpilib~=2025.3.2.2",
1920
]
2021

21-
[tool.robotpy-build.static_libs."studica_driver".maven_lib_download]
22-
artifact_id = "Studica-driver"
22+
[[project.authors]]
23+
name = "RobotPy Development Team"
24+
email = "robotpy@googlegroups.com"
25+
26+
[project.urls]
27+
"Source code" = "https://github.com/robotpy/robotpy-navx"
28+
29+
30+
[tool.hatch.version]
31+
source = "vcs"
32+
33+
[tool.hatch.build.hooks.vcs]
34+
version-file = "navx/version.py"
35+
36+
[tool.hatch.build.targets.wheel]
37+
packages = ["navx"]
38+
39+
40+
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
41+
artifact_id = "Studica-cpp"
2342
group_id = "com.studica.frc"
2443
repo_url = "https://dev.studica.com/maven/release/2025"
2544
version = "2025.0.1"
26-
libs = ["StudicaDriver"]
45+
staticlibs = ["Studica"]
46+
extract_to = "lib"
2747

28-
[tool.robotpy-build.static_libs."studica_lib".maven_lib_download]
29-
artifact_id = "Studica-cpp"
48+
[[tool.hatch.build.hooks.robotpy.maven_lib_download]]
49+
artifact_id = "Studica-driver"
3050
group_id = "com.studica.frc"
3151
repo_url = "https://dev.studica.com/maven/release/2025"
3252
version = "2025.0.1"
33-
libs = ["Studica"]
53+
staticlibs = ["StudicaDriver"]
54+
extract_to = "lib"
55+
56+
57+
[tool.hatch.build.hooks.semiwrap]
58+
59+
[tool.hatch.build.hooks.meson]
3460

35-
[tool.robotpy-build.wrappers."navx"]
61+
62+
[tool.semiwrap]
63+
update_init = ["navx"]
64+
65+
[tool.semiwrap.extension_modules."navx._navx"]
3666
name = "navx"
67+
3768
depends = [
38-
"wpilib_core",
39-
"wpimath_cpp",
40-
"wpimath_geometry",
41-
"wpiHal",
42-
"wpilibc",
43-
"wpilib_core",
44-
"wpimath_cpp",
45-
"wpimath_geometry",
46-
"wpiHal",
47-
"ntcore",
48-
"wpiutil",
49-
"studica_driver",
50-
"studica_lib",
69+
"wpilib",
5170
]
5271

53-
sources = [
54-
"navx/src/rpy/navx.cpp"
72+
includes = [
73+
"lib/include"
5574
]
5675

57-
generate = [
58-
{ AHRS = "studica/AHRS.h" },
59-
]
60-
generation_data = "gen"
76+
[tool.semiwrap.extension_modules."navx._navx".headers]
77+
AHRS = "studica/AHRS.h"

semiwrap/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/meson.build
2+
/modules/meson.build
3+
/trampolines/meson.build

0 commit comments

Comments
 (0)