Skip to content

Commit

Permalink
pep508.parseMarkers: Make platform_release a distinct type
Browse files Browse the repository at this point in the history
`platform_release` parsing is more complicated than other fields. It can be either a PEP-440 version, or a non-compliant version string.

If both lhs and rhs were correctly parsed as PEP-440 versions run regular version comparison, otherwise compare lexicographically

See:
- pypa/packaging#774
- astral-sh/uv#3917 (comment)
  • Loading branch information
adisbladis committed Sep 10, 2024
1 parent 424e960 commit 8a8d3b2
Show file tree
Hide file tree
Showing 18 changed files with 2,901 additions and 2,261 deletions.
81 changes: 81 additions & 0 deletions lib/expected/pep508.mkEnviron.testPypy3Linux.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"implementation_name": {
"type": "string",
"value": "pypy"
},
"implementation_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
7,
3,
11
],
"str": "7.3.11"
}
},
"os_name": {
"type": "string",
"value": "posix"
},
"platform_machine": {
"type": "string",
"value": "x86_64"
},
"platform_python_implementation": {
"type": "string",
"value": "PyPy"
},
"platform_release": {
"type": "platform_release",
"value": ""
},
"platform_system": {
"type": "string",
"value": "Linux"
},
"platform_version": {
"type": "string",
"value": ""
},
"python_full_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
7,
3,
11
],
"str": "7.3.11"
}
},
"python_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
9
],
"str": "3.9"
}
},
"sys_platform": {
"type": "string",
"value": "linux"
}
}
81 changes: 81 additions & 0 deletions lib/expected/pep508.mkEnviron.testPython311Darwin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"implementation_name": {
"type": "string",
"value": "cpython"
},
"implementation_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
11,
4
],
"str": "3.11.4"
}
},
"os_name": {
"type": "string",
"value": "posix"
},
"platform_machine": {
"type": "string",
"value": "x86_64"
},
"platform_python_implementation": {
"type": "string",
"value": "CPython"
},
"platform_release": {
"type": "platform_release",
"value": ""
},
"platform_system": {
"type": "string",
"value": "Darwin"
},
"platform_version": {
"type": "string",
"value": ""
},
"python_full_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
11,
4
],
"str": "3.11.4"
}
},
"python_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
11
],
"str": "3.11"
}
},
"sys_platform": {
"type": "string",
"value": "darwin"
}
}
81 changes: 81 additions & 0 deletions lib/expected/pep508.mkEnviron.testPython311DarwinAarch64.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"implementation_name": {
"type": "string",
"value": "cpython"
},
"implementation_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
11,
4
],
"str": "3.11.4"
}
},
"os_name": {
"type": "string",
"value": "posix"
},
"platform_machine": {
"type": "string",
"value": "arm64"
},
"platform_python_implementation": {
"type": "string",
"value": "CPython"
},
"platform_release": {
"type": "platform_release",
"value": ""
},
"platform_system": {
"type": "string",
"value": "Darwin"
},
"platform_version": {
"type": "string",
"value": ""
},
"python_full_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
11,
4
],
"str": "3.11.4"
}
},
"python_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
11
],
"str": "3.11"
}
},
"sys_platform": {
"type": "string",
"value": "darwin"
}
}
81 changes: 81 additions & 0 deletions lib/expected/pep508.mkEnviron.testPython38Linux.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"implementation_name": {
"type": "string",
"value": "cpython"
},
"implementation_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
8,
2
],
"str": "3.8.2"
}
},
"os_name": {
"type": "string",
"value": "posix"
},
"platform_machine": {
"type": "string",
"value": "x86_64"
},
"platform_python_implementation": {
"type": "string",
"value": "CPython"
},
"platform_release": {
"type": "platform_release",
"value": ""
},
"platform_system": {
"type": "string",
"value": "Linux"
},
"platform_version": {
"type": "string",
"value": ""
},
"python_full_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
8,
2
],
"str": "3.8.2"
}
},
"python_version": {
"type": "version",
"value": {
"dev": null,
"epoch": 0,
"local": null,
"post": null,
"pre": null,
"release": [
3,
8
],
"str": "3.8"
}
},
"sys_platform": {
"type": "string",
"value": "linux"
}
}
Loading

0 comments on commit 8a8d3b2

Please sign in to comment.