Skip to content

Commit 6c0b329

Browse files
committed
rdev
1 parent 8a0476f commit 6c0b329

File tree

5 files changed

+92
-72
lines changed

5 files changed

+92
-72
lines changed

devtools/config.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,26 @@
77

88
@dataclasses.dataclass
99
class SubprojectConfig:
10+
#: The key in `py_versions` to set the project version from
11+
py_version: str
1012

1113
#: Whether this should be built on roborio or not
1214
roborio: bool
1315

14-
#: If any managed project has one of these as a dependency, the
15-
#: minimum version should be this
16-
min_version: T.Optional[str] = None
17-
1816

1917
@dataclasses.dataclass
2018
class Parameters:
2119
wpilib_bin_version: str
2220
wpilib_bin_url: str
2321

24-
robotpy_build_req: str
25-
2622
exclude_artifacts: T.Set[str]
2723

2824
requirements: T.Dict[str, str]
2925

3026

3127
@dataclasses.dataclass
3228
class UpdateConfig:
29+
py_versions: T.Dict[str, str]
3330
params: Parameters
3431
subprojects: T.Dict[str, SubprojectConfig]
3532

devtools/subproject.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ def build_wheel(
140140
# Install the wheel
141141
self._run_pip(
142142
"install",
143-
"--force-reinstall",
144143
"--find-links",
145144
str(wheel_path),
146145
"--find-links",

devtools/update_pyproject.py

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
from packaging.version import Version
99
import tomlkit
1010

11+
from .config import SubprojectConfig
1112
from .ctx import Context
1213

1314

1415
@dataclasses.dataclass
1516
class ProjectInfo:
1617
pyproject_toml: pathlib.Path
18+
cfg: SubprojectConfig
1719
data: tomlkit.TOMLDocument
1820
changed: bool = False
1921

@@ -32,15 +34,8 @@ def __init__(self, ctx: Context) -> None:
3234
# The required versions for everything
3335
# - in theory projects could have different requirements, but in
3436
# practice this is simpler and we haven't had issues
35-
# - .. and to make life easier, we only use this for build-system.requires,
36-
# which we happen to override in CI anyways
3737
self.version_specs: typing.Dict[str, SpecifierSet] = {}
3838

39-
# robotpy-build is special
40-
self.version_specs["robotpy-build"] = SpecifierSet(
41-
self.cfg.params.robotpy_build_req
42-
)
43-
4439
# load all the pyproject.toml using tomlkit so we can make changes
4540
# and retain all the comments
4641
self.subprojects: typing.Dict[str, ProjectInfo] = {}
@@ -49,12 +44,17 @@ def __init__(self, ctx: Context) -> None:
4944
data = tomlkit.load(fp)
5045

5146
self.subprojects[name] = ProjectInfo(
52-
pyproject_toml=project.pyproject_path, data=data
47+
pyproject_toml=project.pyproject_path,
48+
data=data,
49+
cfg=self.cfg.subprojects[name],
5350
)
5451

55-
self.version_specs[project.pyproject_name] = SpecifierSet(
56-
f"~={project.cfg.min_version}"
57-
)
52+
version = self.cfg.py_versions[project.cfg.py_version]
53+
54+
self.version_specs[project.pyproject_name] = SpecifierSet(f"=={version}")
55+
56+
for name, spec in self.cfg.params.requirements.items():
57+
self.version_specs[name] = SpecifierSet(spec)
5858

5959
@property
6060
def changed(self) -> bool:
@@ -105,7 +105,10 @@ def _update_requirements(
105105
def update_requirements(self):
106106
for info in self.subprojects.values():
107107
data = info.data
108-
pypi_name = data["tool"]["robotpy-build"]["metadata"]["name"]
108+
pypi_name = data["project"]["name"]
109+
110+
# update project.version
111+
self._update_pyversion(info)
109112

110113
# update build-system
111114
self._update_requirements(
@@ -115,57 +118,69 @@ def update_requirements(self):
115118
data["build-system"]["requires"],
116119
)
117120

118-
# update tool.robotpy-build.metadata: install_requires
121+
# project.dependencies
119122
self._update_requirements(
120123
info,
121124
pypi_name,
122-
"metadata.install_requires",
123-
data["tool"]["robotpy-build"]["metadata"]["install_requires"],
125+
"project.dependencies",
126+
data["project"]["dependencies"],
124127
)
125128

126129
def _update_maven(self, info: ProjectInfo):
127130
data = info.data
128-
iter = list(data["tool"]["robotpy-build"]["wrappers"].items())
129-
if "static_libs" in data["tool"]["robotpy-build"]:
130-
iter += list(data["tool"]["robotpy-build"]["static_libs"].items())
131-
for pkg, wrapper in iter:
132-
if (
133-
"maven_lib_download" not in wrapper
134-
or wrapper["maven_lib_download"]["artifact_id"]
135-
in self.cfg.params.exclude_artifacts
136-
):
131+
iter = (
132+
data["tool"]["hatch"]["build"]["hooks"]
133+
.get("robotpy", {})
134+
.get("maven_lib_download", [])
135+
)
136+
137+
for dl in iter:
138+
139+
if dl["artifact_id"] in self.cfg.params.exclude_artifacts:
137140
continue
138141

139-
if wrapper["maven_lib_download"]["repo_url"] != self.wpilib_bin_url:
142+
artifact_id = dl["artifact_id"]
143+
144+
if dl["repo_url"] != self.wpilib_bin_url:
140145
print(
141146
"* ",
142-
pkg,
147+
artifact_id,
143148
"repo url:",
144-
wrapper["maven_lib_download"]["repo_url"],
149+
dl["repo_url"],
145150
"=>",
146151
self.wpilib_bin_url,
147152
)
148153
self.commit_changes.add(f"repo updated to {self.wpilib_bin_url}")
149154
info.changed = True
150-
wrapper["maven_lib_download"]["repo_url"] = self.wpilib_bin_url
155+
dl["repo_url"] = self.wpilib_bin_url
151156

152-
if wrapper["maven_lib_download"]["version"] != self.wpilib_bin_version:
157+
if dl["version"] != self.wpilib_bin_version:
153158
print(
154159
"* ",
155-
pkg,
160+
artifact_id,
156161
"so version:",
157-
wrapper["maven_lib_download"]["version"],
162+
dl["version"],
158163
"=>",
159164
self.wpilib_bin_version,
160165
)
161166
self.commit_changes.add(f"lib updated to {self.wpilib_bin_version}")
162167
info.changed = True
163-
wrapper["maven_lib_download"]["version"] = self.wpilib_bin_version
168+
dl["version"] = self.wpilib_bin_version
164169

165170
def update_maven(self):
166171
for data in self.subprojects.values():
167172
self._update_maven(data)
168173

174+
def _update_pyversion(self, info: ProjectInfo):
175+
current_version = info.data["project"]["version"]
176+
version = self.cfg.py_versions[info.cfg.py_version]
177+
178+
if current_version != version:
179+
name = info.data["project"]["name"]
180+
print(f"* {name} {current_version!r} => {version!r}")
181+
self.commit_changes.add(f"{name} updated to {version}")
182+
info.changed = True
183+
169184
def update(self):
170185
self.update_maven()
171186
self.update_requirements()

rdev.toml

Lines changed: 42 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,123 @@
11
#
22
# This is used by ./rdev.sh to manage the various robotpy packages
33
#
4+
# allwpilib-based python wheel versioning is xxxx.x.x.y:
5+
# - x is the upstream version
6+
# - y are specific robotpy patches when we release out of band
7+
#
8+
# Beta releases are always YEAR.0.0bX[.postX]
9+
#
10+
11+
[py_versions]
12+
13+
# Usually the same as wpilib_bin_version
14+
native = "2025.3.2"
15+
16+
# Usually similar to native, but subminor version is bumped for bugfixes
17+
wrapper = "2025.3.2.3"
418

519
[params]
620

721
wpilib_bin_url = "https://frcmaven.wpi.edu/artifactory/release"
822
wpilib_bin_version = "2025.3.2"
923
#wpilib_bin_url = "https://frcmaven.wpi.edu/artifactory/development"
1024

11-
# Don't update these artifacts
25+
# Don't update these maven artifacts
1226
exclude_artifacts = [
1327
"opencv-cpp"
1428
]
1529

16-
robotpy_build_req = "~=2025.1.0"
17-
1830
[params.requirements]
19-
# semiwrap = "TODO"
20-
hatch-meson = "0.1"
21-
hatch-nativelib = "~=0.1"
22-
hatch-robotpy = "~=0.1"
31+
semiwrap = "~=0.1"
32+
hatch-meson = "~=0.1"
33+
hatch-nativelib = "~=0.2.0"
34+
hatch-robotpy = "~=0.2"
2335

2436

25-
#
26-
# Subproject configuration
27-
#
28-
# allwpilib-based package versioning is xxxx.x.x.y:
29-
# - x is the upstream version
30-
# - y are specific robotpy patches when we release out of band
31-
#
32-
# Beta releases are always YEAR.0.0bX[.postX]
33-
#
34-
35-
# native projects use exact requirements
3637
[subprojects."native.wpiutil"]
38+
py_version = "native"
3739
roborio = true
3840

3941
[subprojects."native.wpinet"]
42+
py_version = "native"
4043
roborio = true
4144

4245
[subprojects."native.ntcore"]
46+
py_version = "native"
4347
roborio = true
4448

4549
[subprojects."native.wpihal"]
50+
py_version = "native"
4651
roborio = true
4752

4853
[subprojects."native.wpimath"]
54+
py_version = "native"
4955
roborio = true
5056

5157
[subprojects."native.apriltag"]
58+
py_version = "native"
5259
roborio = true
5360

5461
[subprojects."native.wpilib"]
62+
py_version = "native"
5563
roborio = true
5664

5765
[subprojects."native.romi"]
66+
py_version = "native"
5867
roborio = false
5968

6069
[subprojects."native.xrp"]
70+
py_version = "native"
6171
roborio = false
6272

6373
[subprojects."robotpy-wpiutil"]
64-
min_version = "2025.3.2"
74+
py_version = "wrapper"
6575
roborio = true
6676

6777
[subprojects."robotpy-wpinet"]
68-
min_version = "2025.3.2"
78+
py_version = "wrapper"
6979
roborio = true
7080

71-
[subprojects.pyntcore]
72-
min_version = "2025.3.2"
81+
[subprojects."pyntcore"]
82+
py_version = "wrapper"
7383
roborio = true
7484

7585
[subprojects."robotpy-hal"]
76-
min_version = "2025.3.2"
86+
py_version = "wrapper"
7787
roborio = true
7888

7989
[subprojects."robotpy-wpimath"]
80-
min_version = "2025.3.2"
90+
py_version = "wrapper"
8191
roborio = true
8292

8393
[subprojects."robotpy-cscore"]
84-
min_version = "2025.3.2"
94+
py_version = "wrapper"
8595
roborio = true
8696

8797
[subprojects."robotpy-apriltag"]
88-
min_version = "2025.3.2"
98+
py_version = "wrapper"
8999
roborio = true
90100

91101
[subprojects."robotpy-wpilib"]
92-
min_version = "2025.3.2"
102+
py_version = "wrapper"
93103
roborio = true
94104

95105
[subprojects."robotpy-halsim-ds-socket"]
96-
min_version = "2025.3.2"
106+
py_version = "native"
97107
roborio = false
98108

99109
[subprojects."robotpy-halsim-ws"]
100-
min_version = "2025.3.2"
110+
py_version = "native"
101111
roborio = false
102112

103113
[subprojects."robotpy-halsim-gui"]
104-
min_version = "2025.3.2"
114+
py_version = "wrapper"
105115
roborio = false
106116

107117
[subprojects."robotpy-romi"]
108-
min_version = "2025.3.2"
118+
py_version = "wrapper"
109119
roborio = false
110120

111121
[subprojects."robotpy-xrp"]
112-
min_version = "2025.3.2"
122+
py_version = "wrapper"
113123
roborio = false

subprojects/robotpy-wpiutil/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ authors = [
1818
license = "BSD-3-Clause"
1919
dependencies = [
2020
"native.wpiutil==2025.3.2",
21-
"msvc-runtime>=14.42.34433; platform_system == 'Windows'"
2221
]
2322

2423
[project.urls]

0 commit comments

Comments
 (0)