Skip to content

Commit 01c72aa

Browse files
committed
Temporary commit
1 parent a284313 commit 01c72aa

File tree

272 files changed

+3335
-3236
lines changed

Some content is hidden

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

272 files changed

+3335
-3236
lines changed

.github/workflows/dist.yml

+38-42
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ jobs:
4242
- uses: actions/checkout@v3
4343
- uses: pre-commit/[email protected]
4444

45-
check-doc:
46-
runs-on: ubuntu-22.04
45+
# check-doc:
46+
# runs-on: ubuntu-22.04
4747

4848
steps:
4949
- uses: actions/checkout@v3
5050
with:
5151
submodules: true
5252

53-
- uses: actions/setup-python@v4
54-
with:
55-
python-version: 3.8
56-
- name: Sphinx
57-
run: |
58-
pip --disable-pip-version-check install -e .
59-
pip --disable-pip-version-check install -r docs/requirements.txt
60-
cd docs && make clean html SPHINXOPTS="-W --keep-going"
53+
# - uses: actions/setup-python@v5
54+
# with:
55+
# python-version: 3.8
56+
# - name: Sphinx
57+
# run: |
58+
# pip --disable-pip-version-check install -e .
59+
# pip --disable-pip-version-check install -r docs/requirements.txt
60+
# cd docs && make clean html SPHINXOPTS="-W --keep-going"
6161

6262
build:
6363
runs-on: ubuntu-22.04
@@ -67,7 +67,7 @@ jobs:
6767
submodules: recursive
6868
fetch-depth: 0
6969

70-
- uses: actions/setup-python@v4
70+
- uses: actions/setup-python@v5
7171
with:
7272
python-version: 3.8
7373

@@ -97,12 +97,12 @@ jobs:
9797
- '3.11'
9898
- '3.12'
9999
- '3.13'
100-
architecture: [x86, x64]
101-
exclude:
102-
- os: macos-13
103-
architecture: x86
104-
- os: ubuntu-22.04
105-
architecture: x86
100+
architecture: [x64]
101+
# exclude:
102+
# - os: macos-13
103+
# architecture: x86
104+
# - os: ubuntu-22.04
105+
# architecture: x86
106106
include:
107107
- os: macos-14
108108
python_version: 3.9
@@ -116,7 +116,7 @@ jobs:
116116
with:
117117
submodules: true
118118

119-
- uses: actions/setup-python@v4
119+
- uses: actions/setup-python@v5
120120
with:
121121
python-version: ${{ matrix.python_version }}
122122
architecture: ${{ matrix.architecture }}
@@ -133,25 +133,32 @@ jobs:
133133
key: ${{ matrix.os }}-${{ matrix.architecture }}-${{ matrix.python_version }}
134134
variant: ccache
135135

136+
- name: Setup MSVC
137+
uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1
138+
with:
139+
architecture: x64
140+
if: runner.os == 'Windows'
141+
142+
- name: Configure ccache for MSVC
143+
shell: bash
144+
# https://github.com/mesonbuild/meson/issues/10423
145+
run: |
146+
echo "CC=ccache.exe cl" >> $GITHUB_ENV
147+
echo "CXX=ccache.exe cl" >> $GITHUB_ENV
148+
if: runner.os == 'Windows'
149+
136150
- name: Install
137151
shell: bash
138152
working-directory: dist
139153
run: python -m pip --disable-pip-version-check install *.whl
140154

141155
- name: Install test dependencies
142-
shell: bash
143156
working-directory: tests
144157
run: python -m pip --disable-pip-version-check install -r requirements.txt
145158

146159
- name: Test wheel
147-
shell: bash
148-
env:
149-
RPYBUILD_PARALLEL: 1
150-
RPYBUILD_STRIP_LIBPYTHON: 1
151-
RPYBUILD_CC_LAUNCHER: ccache
152160
working-directory: tests
153-
run: |
154-
python run_tests.py
161+
run: python run_tests.py
155162

156163
cross-build:
157164
runs-on: ubuntu-latest
@@ -160,9 +167,8 @@ jobs:
160167
max-parallel: ${{ fromJSON(needs.setup_concurrency.outputs.max-parallel).v }}
161168
matrix:
162169
container:
163-
- wpilib/roborio-cross-ubuntu:2024-22.04-py312
164-
- wpilib/raspbian-cross-ubuntu:bullseye-22.04-py312
165-
- wpilib/aarch64-cross-ubuntu:bullseye-22.04-py312
170+
- wpilib/roborio-cross-ubuntu:2025-22.04-py313
171+
- wpilib/raspbian-cross-ubuntu:2025-bookworm-22.04-py313
166172

167173
container:
168174
image: "${{ matrix.container }}"
@@ -184,33 +190,23 @@ jobs:
184190
name: dist
185191
path: dist
186192

187-
- name: Install setuptools
188-
run: |
189-
/build/venv/bin/build-pip --disable-pip-version-check install setuptools
190-
/build/venv/bin/cross-pip --disable-pip-version-check install setuptools
193+
- name: Setup cross environment
194+
uses: robotpy/build-actions/setup-cross-meson@semiwrap
191195

192196
- name: Install
193197
working-directory: dist
194198
run: |
195-
# install to both cross and build in case things get mixed up
196199
/build/venv/bin/build-pip --disable-pip-version-check install *.whl
197-
/build/venv/bin/cross-pip --disable-pip-version-check install *.whl
198200
199201
- name: Install test dependencies
200202
shell: bash
201203
working-directory: tests
202204
run: |
203-
# install to both cross and build in case things get mixed up
204205
/build/venv/bin/build-pip --disable-pip-version-check install -r requirements.txt
205-
/build/venv/bin/cross-pip --disable-pip-version-check install -r requirements.txt
206206
207207
- name: Build cross wheel
208-
env:
209-
RPYBUILD_PARALLEL: 1
210-
RPYBUILD_STRIP_LIBPYTHON: 1
211-
RPYBUILD_CC_LAUNCHER: ccache
212208
working-directory: tests/cpp
213-
run: /build/venv/bin/cross-python run_install.py wheel
209+
run: /build/venv/bin/cross-python run_install.py --config-settings=setup-args=--cross-file=cross.txt
214210

215211
publish:
216212
runs-on: ubuntu-latest

examples/demo/gen/.gitkeep

Whitespace-only changes.

examples/demo/meson.build

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
project('demo', ['cpp'],
2+
default_options: ['warning_level=1', 'cpp_std=c++20',
3+
'b_colorout=auto', 'optimization=2', 'b_pie=true'])
4+
5+
# Include autogenerated wrapcfg/meson.build
6+
subdir('wrapcfg')
7+
8+
# Add additional source files to predefined variable in wrapcfg/meson.build
9+
demo_sources += files(
10+
'swdemo/src/demo.cpp',
11+
'swdemo/src/main.cpp',
12+
)
13+
14+
# You can add extra compilation arguments by adding a dependency to predefined
15+
# variable
16+
demo_deps += [
17+
declare_dependency(include_directories: ['swdemo/include'])
18+
]
19+
20+
# Include autogenerated wrapcfg/modules/meson.build
21+
# - Builds the extension modules
22+
# - Generates the pyi file for the extension modules
23+
subdir('wrapcfg/modules')

examples/demo/pyproject.toml

+36-39
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,38 @@
11

2-
# This section tells pip to install robotpy-build before starting a build
2+
# This section tells pip to install semiwrap before starting a build
33
[build-system]
4-
requires = ["robotpy-build"]
5-
6-
# Tells robotpy-build where to place autogenerated metadata
7-
[tool.robotpy-build]
8-
base_package = "rpydemo"
9-
10-
# This section configures the 'rpydemo' python package. Multiple
11-
# sections are possible to build multiple packages
12-
[tool.robotpy-build.wrappers."rpydemo"]
13-
name = "rpydemo"
14-
15-
# C++ source files to compile, path is relative to the root of the project
16-
sources = [
17-
"rpydemo/src/demo.cpp",
18-
"rpydemo/src/main.cpp"
19-
]
20-
21-
# This is a directory that can be used to customize the autogenerated
22-
# C++ code
23-
# -> autogenerate those files via `robotpy-build create-gen`
24-
generation_data = "gen"
25-
26-
# This tells robotpy-build to parse include/demo.h and autogenerate pybind11
27-
# wrappers for the contents of the header.
28-
# -> autogenerate this via `robotpy-build scan-headers`
29-
[tool.robotpy-build.wrappers."rpydemo".autogen_headers]
30-
demo = "demo.h"
31-
32-
33-
# Standard python package metadata
34-
[tool.robotpy-build.metadata]
35-
name = "robotpy-build-demo"
36-
description = "robotpy-build demo program"
37-
author = "RobotPy Development Team"
38-
author_email = "[email protected]"
39-
url = "https://github.com/robotpy/robotpy-build"
40-
license = "BSD-3-Clause"
41-
install_requires = []
4+
build-backend = "hatchling.build"
5+
requires = ["semiwrap", "hatch-meson", "hatchling"]
6+
7+
[project]
8+
name = "swdemo"
9+
description = "Demo program"
10+
version = "0.0.1"
11+
12+
#
13+
# hatch-semiwrap configuration
14+
# .. this generates meson.build to perform autogen
15+
#
16+
17+
[tool.hatch.build.hooks.semiwrap]
18+
# autogen_build_path = "autogen"
19+
20+
#
21+
# hatch-meson configuration
22+
# .. this executes meson to build python extension modules
23+
#
24+
25+
[tool.hatch.build.hooks.meson]
26+
27+
28+
#
29+
# semiwrap code generation configuration
30+
#
31+
32+
[tool.semiwrap]
33+
34+
[tool.semiwrap.extension_modules."swdemo._demo"]
35+
name = "demo"
36+
37+
[tool.semiwrap.extension_modules."swdemo._demo".headers]
38+
demo = "include/demo.h"

examples/demo/rpydemo/src/main.cpp

-3
This file was deleted.

examples/demo/setup.py

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# autogenerated by 'robotpy-build create-imports rpydemo rpydemo._rpydemo'
2-
from ._rpydemo import DemoClass, add2
2+
from ._demo import DemoClass, add2
33

44
__all__ = ["DemoClass", "add2"]

examples/demo/rpydemo/include/demo.h renamed to examples/demo/swdemo/include/demo.h

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
/** Adds 2 to the first parameter and returns it */
55
int add2(int x);
66

7+
namespace demo {
8+
79
/**
810
Doxygen documentation is automatically added to your python objects
911
when the bindings are autogenerated.
@@ -20,3 +22,5 @@ class DemoClass {
2022
private:
2123
int m_x = 0;
2224
};
25+
26+
} // namespace demo

examples/demo/rpydemo/src/demo.cpp renamed to examples/demo/swdemo/src/demo.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ int add2(int x) {
55
return x + 2;
66
}
77

8+
namespace demo {
9+
810
void DemoClass::setX(int x) {
911
m_x = x;
1012
}
1113

1214
int DemoClass::getX() const {
1315
return m_x;
14-
}
16+
}
17+
18+
} // namespace demo

examples/demo/swdemo/src/main.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <semiwrap_init.swdemo._demo.hpp>
2+
3+
SEMIWRAP_PYBIND11_MODULE(m) {
4+
initWrapper(m);
5+
}

examples/demo/wrapcfg/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/meson.build

examples/demo/gen/demo.yml renamed to examples/demo/wrapcfg/demo.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
functions:
44
add2:
55
classes:
6-
DemoClass:
6+
demo::DemoClass:
77
methods:
88
setX:
99
getX:
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/meson.build
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/meson.build

pyproject.toml

+10-16
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,30 @@ classifiers = [
1818
"Intended Audience :: Developers",
1919
"License :: OSI Approved :: BSD License",
2020
"Programming Language :: Python :: 3 :: Only",
21-
"Programming Language :: Python :: 3.8",
22-
"Programming Language :: Python :: 3.9",
23-
"Programming Language :: Python :: 3.10",
24-
"Programming Language :: Python :: 3.11",
2521
"Topic :: Software Development",
2622
]
2723
dependencies = [
28-
"setuptools >= 45",
29-
"setuptools_scm >= 6.2, < 8",
24+
"pkgconf",
3025
"sphinxify >= 0.7.3",
3126
"validobj ~= 1.2",
32-
"cxxheaderparser[pcpp] ~= 1.4.1",
27+
"cxxheaderparser[pcpp] ~= 1.5",
3328
"tomli",
3429
"tomli_w",
3530
"toposort",
3631
"typing-extensions",
32+
"validobj",
3733
"pyyaml >= 5.1",
38-
"patch == 1.*",
3934
"pybind11-stubgen ~= 2.5.1",
4035
"delocate; platform_system == 'Darwin'",
4136
"distro; platform_system == 'Linux'",
4237
]
4338

39+
[project.entry-points.hatch]
40+
semiwrap = "semiwrap.hooks"
41+
42+
[project.entry-points.pkg_config]
43+
semiwrap = "semiwrap"
44+
4445
[project.scripts]
4546
semiwrap = "semiwrap.tool:main"
4647

@@ -50,7 +51,7 @@ semiwrap = "semiwrap.tool:main"
5051
[tool.hatch.version]
5152
source = "vcs"
5253

53-
[tool.hatch.build.hooks.vcs]
54+
[tool.hatch.build.targets.sdist.hooks.vcs]
5455
version-file = "src/semiwrap/version.py"
5556

5657
[tool.hatch.build.targets.sdist]
@@ -61,13 +62,6 @@ exclude = [
6162
[tool.hatch.build.targets.sdist.force-include]
6263
"./src/semiwrap/pybind11/include" = "./semiwrap/pybind11/include"
6364

64-
[tool.hatch.build.targets.wheel]
65-
packages = ["semiwrap"]
66-
include = [
67-
"/semiwrap/pybind11/include",
68-
"/semiwrap/include",
69-
]
70-
7165

7266
[tool.black]
7367
target-version = ["py38"]

0 commit comments

Comments
 (0)