Skip to content

Commit ddf7083

Browse files
committed
fix: don't require package versions conforming to semver (fixes #1)
1 parent 5e6df19 commit ddf7083

File tree

4 files changed

+266
-4
lines changed

4 files changed

+266
-4
lines changed

cli/src/lockfile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl NixSystem {
6565
pub struct Dependency {
6666
pub name: String,
6767
pub install_path: String,
68-
pub version: semver::Version,
68+
pub version: String,
6969
pub manifest: String,
7070
pub systems: BTreeMap<NixSystem, FetchUrl>,
7171
}
@@ -104,7 +104,7 @@ impl Dependency {
104104
fn new(
105105
manifest: &Manifest,
106106
name: String,
107-
version: semver::Version,
107+
version: String,
108108
systems: BTreeMap<NixSystem, FetchUrl>,
109109
) -> Self {
110110
let install_path = format!(

cli/src/manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl PackageType {
2929
pub struct Manifest {
3030
#[serde(rename = "type")]
3131
pub ty: PackageType,
32-
pub version: semver::Version,
32+
pub version: String,
3333
pub spec: PackageSpec,
3434

3535
#[serde(flatten)]

cli/src/registry/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ pub struct PackageSpec {
180180

181181
#[derive(Deserialize, Clone, Debug)]
182182
pub struct VersionSpec {
183-
pub name: semver::Version,
183+
pub name: String,
184184
pub files: Vec<File>,
185185
}
186186

@@ -412,4 +412,20 @@ mod tests {
412412
let version = spec.pick_latest_compatible("~1".parse().unwrap(), &System::LinuxX86_64);
413413
assert_eq!(version.map(|v| &v.name), Some(&"1.1.0".parse().unwrap()));
414414
} */
415+
416+
#[test]
417+
fn deserialize_lib_package_spec_invalid_semver() {
418+
let json = include_str!("./test/simplefoc.json");
419+
let de = &mut serde_json::Deserializer::from_str(json);
420+
let spec = serde_path_to_error::deserialize::<_, PackageSpec>(de);
421+
// TODO: snapshot test?
422+
match spec {
423+
Ok(spec) => {
424+
println!("{:?}", spec);
425+
}
426+
Err(err) => {
427+
panic!("failed to deserialize: {err}");
428+
}
429+
}
430+
}
415431
}
Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
{
2+
"id": 7229,
3+
"type": "library",
4+
"tier": "community",
5+
"owner": {
6+
"username": "askuric",
7+
"firstname": "Antun",
8+
"lastname": "Skuric",
9+
"is_org": false
10+
},
11+
"name": "Simple FOC",
12+
"description": "A library demistifying FOC for BLDC motors. Simple library intended for hobby comunity to run the BLDC and Stepper motor using FOC algorithm. It is intended to support as many BLDC/Stepper motor+sensor+driver combinations as possible and in the same time maintain simplicity of usage. Library supports Arudino devices such as Arduino UNO, MEGA, NANO and similar, stm32 boards such as Nucleo and Bluepill, ESP32 and Teensy boards.",
13+
"added_at": "2020-04-11T16:38:49Z",
14+
"updated_at": "2024-07-21T17:15:01Z",
15+
"modified_at": "2024-07-21T13:13:21Z",
16+
"downloads_trend": -174,
17+
"popularity_trend": -1,
18+
"popularity_rank": 148,
19+
"open_issues_count": 72,
20+
"stars_count": 1961,
21+
"examples_count": 64,
22+
"title": null,
23+
"license": "MIT",
24+
"homepage": "https://docs.simplefoc.com",
25+
"repository_url": "https://github.com/simplefoc/Arduino-FOC.git",
26+
"keywords": ["device", "control"],
27+
"authors": [
28+
{ "maintainer": true, "email": "[email protected]", "name": "Simplefoc" }
29+
],
30+
"headers": [
31+
"BLDCDriver3PWM.h",
32+
"BLDCDriver6PWM.h",
33+
"BLDCMotor.h",
34+
"Commander.h",
35+
"Encoder.h",
36+
"HallSensor.h",
37+
"InlineCurrentSense.h",
38+
"LowsideCurrentSense.h",
39+
"MagneticSensorAnalog.h",
40+
"MagneticSensorI2C.h",
41+
"MagneticSensorPWM.h",
42+
"MagneticSensorSPI.h",
43+
"SimpleFOC.h",
44+
"StepDirListener.h",
45+
"StepperDriver2PWM.h",
46+
"StepperDriver4PWM.h",
47+
"StepperMotor.h",
48+
"commands.h",
49+
"defaults.h",
50+
"foc_utils.h",
51+
"hardware_api.h",
52+
"lowpass_filter.h",
53+
"pid.h",
54+
"time_utils.h"
55+
],
56+
"frameworks": ["arduino"],
57+
"platforms": ["*"],
58+
"dependencies_count": 0,
59+
"dependents_count": 3,
60+
"top_dependencies": [],
61+
"top_dependents": [
62+
{
63+
"id": 13496,
64+
"type": "library",
65+
"owner": { "username": "simplefoc" },
66+
"name": "SimpleFOCDrivers"
67+
},
68+
{
69+
"id": 15220,
70+
"type": "library",
71+
"owner": { "username": "simplefoc" },
72+
"name": "SimpleDCMotor"
73+
},
74+
{
75+
"id": 11678,
76+
"type": "library",
77+
"owner": { "username": "jschoch" },
78+
"name": "Hap"
79+
}
80+
],
81+
"version": {
82+
"id": 38940,
83+
"name": "2.2",
84+
"unpacked_size": 597078,
85+
"released_at": "2021-10-02T18:57:37Z",
86+
"files": [
87+
{
88+
"name": "SimpleFOC-2.2.tar.gz",
89+
"size": 119012,
90+
"checksum": {
91+
"sha256": "268b700b07aa7b8f42307d20d9a4145480423e8caf3f72d05fcb26e92e838d88"
92+
},
93+
"system": "*",
94+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.2/SimpleFOC-2.2.tar.gz"
95+
}
96+
],
97+
"is_latest": false
98+
},
99+
"versions": [
100+
{
101+
"id": 64412,
102+
"name": "2.3.4",
103+
"unpacked_size": 1017464,
104+
"released_at": "2024-07-21T13:13:12Z",
105+
"files": [
106+
{
107+
"name": "SimpleFOC-2.3.4.tar.gz",
108+
"size": 188789,
109+
"checksum": {
110+
"sha256": "8bbdafd893f6d9f4eaa9a6187ebbc9ae1299e4d254027a1de643f03b36a2e4fe"
111+
},
112+
"system": "*",
113+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.3.4/SimpleFOC-2.3.4.tar.gz"
114+
}
115+
],
116+
"is_latest": true
117+
},
118+
{
119+
"id": 61865,
120+
"name": "2.3.3",
121+
"unpacked_size": 973245,
122+
"released_at": "2024-04-19T18:26:27Z",
123+
"files": [
124+
{
125+
"name": "SimpleFOC-2.3.3.tar.gz",
126+
"size": 176935,
127+
"checksum": {
128+
"sha256": "85e5beeacc541e07c766519d7107a55147f7ed5667abb09a100fba4d3a9fe418"
129+
},
130+
"system": "*",
131+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.3.3/SimpleFOC-2.3.3.tar.gz"
132+
}
133+
],
134+
"is_latest": false
135+
},
136+
{
137+
"id": 57896,
138+
"name": "2.3.2",
139+
"unpacked_size": 909413,
140+
"released_at": "2023-12-01T22:19:22Z",
141+
"files": [
142+
{
143+
"name": "SimpleFOC-2.3.2.tar.gz",
144+
"size": 166923,
145+
"checksum": {
146+
"sha256": "583d7d46db18ba00ee4193211028be3efd1014078a0a1c37272e396773a56a80"
147+
},
148+
"system": "*",
149+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.3.2/SimpleFOC-2.3.2.tar.gz"
150+
}
151+
],
152+
"is_latest": false
153+
},
154+
{
155+
"id": 55824,
156+
"name": "2.3.1",
157+
"unpacked_size": 909212,
158+
"released_at": "2023-09-23T08:51:26Z",
159+
"files": [
160+
{
161+
"name": "SimpleFOC-2.3.1.tar.gz",
162+
"size": 167290,
163+
"checksum": {
164+
"sha256": "8576c53d9c8e5f1155be38f69d73fb75688f7d32f701746ee27f332995de20d0"
165+
},
166+
"system": "*",
167+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.3.1/SimpleFOC-2.3.1.tar.gz"
168+
}
169+
],
170+
"is_latest": false
171+
},
172+
{
173+
"id": 51688,
174+
"name": "2.3.0",
175+
"unpacked_size": 877598,
176+
"released_at": "2023-03-18T12:00:31Z",
177+
"files": [
178+
{
179+
"name": "SimpleFOC-2.3.0.tar.gz",
180+
"size": 160894,
181+
"checksum": {
182+
"sha256": "6612fbbd787bc130942e0e16c37a60f0716294a1f876315a92fb36ee58f11232"
183+
},
184+
"system": "*",
185+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.3.0/SimpleFOC-2.3.0.tar.gz"
186+
}
187+
],
188+
"is_latest": false
189+
},
190+
{
191+
"id": 47614,
192+
"name": "2.2.3",
193+
"unpacked_size": 786611,
194+
"released_at": "2022-10-15T09:02:08Z",
195+
"files": [
196+
{
197+
"name": "SimpleFOC-2.2.3.tar.gz",
198+
"size": 147144,
199+
"checksum": {
200+
"sha256": "973c3268774850df58a381bb6db2b2882c24eb0c72b137f25cff4c4c2667dc27"
201+
},
202+
"system": "*",
203+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.2.3/SimpleFOC-2.2.3.tar.gz"
204+
}
205+
],
206+
"is_latest": false
207+
},
208+
{
209+
"id": 42000,
210+
"name": "2.2.1",
211+
"unpacked_size": 646667,
212+
"released_at": "2022-02-03T17:03:10Z",
213+
"files": [
214+
{
215+
"name": "SimpleFOC-2.2.1.tar.gz",
216+
"size": 126739,
217+
"checksum": {
218+
"sha256": "ad3390206d86afcb4f42371b6ddbca12a5d32be8c2125898b8e73dc48f922eec"
219+
},
220+
"system": "*",
221+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.2.1/SimpleFOC-2.2.1.tar.gz"
222+
}
223+
],
224+
"is_latest": false
225+
},
226+
{
227+
"id": 38940,
228+
"name": "2.2",
229+
"unpacked_size": 597078,
230+
"released_at": "2021-10-02T18:57:37Z",
231+
"files": [
232+
{
233+
"name": "SimpleFOC-2.2.tar.gz",
234+
"size": 119012,
235+
"checksum": {
236+
"sha256": "268b700b07aa7b8f42307d20d9a4145480423e8caf3f72d05fcb26e92e838d88"
237+
},
238+
"system": "*",
239+
"download_url": "https://dl.registry.platformio.org/download/askuric/library/Simple%20FOC/2.2/SimpleFOC-2.2.tar.gz"
240+
}
241+
],
242+
"is_latest": false
243+
}
244+
],
245+
"readme_url": "https://dl.registry.platformio.org/libraries/36/58/812fff96102dd2e13cb023d192ca53d7e35ad896a25554cade4bf31b01e2/README.md"
246+
}

0 commit comments

Comments
 (0)