maturin 1.8.7__tar.gz → 1.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of maturin might be problematic. Click here for more details.
- {maturin-1.8.7 → maturin-1.9.0}/.gitignore +11 -13
- {maturin-1.8.7 → maturin-1.9.0}/.pre-commit-config.yaml +1 -1
- {maturin-1.8.7 → maturin-1.9.0}/Cargo.lock +30 -17
- {maturin-1.8.7 → maturin-1.9.0}/Cargo.toml +3 -2
- {maturin-1.8.7 → maturin-1.9.0}/Changelog.md +11 -3
- {maturin-1.8.7 → maturin-1.9.0}/PKG-INFO +1 -1
- {maturin-1.8.7 → maturin-1.9.0}/maturin/__init__.py +5 -5
- {maturin-1.8.7 → maturin-1.9.0}/maturin/bootstrap.py +4 -12
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/audit.rs +10 -6
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/platform_tag.rs +42 -34
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/policy.rs +26 -15
- {maturin-1.8.7 → maturin-1.9.0}/src/build_context.rs +58 -7
- {maturin-1.8.7 → maturin-1.9.0}/src/build_options.rs +42 -18
- {maturin-1.8.7 → maturin-1.9.0}/src/ci.rs +16 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/compile.rs +2 -2
- {maturin-1.8.7 → maturin-1.9.0}/src/lib.rs +1 -1
- {maturin-1.8.7 → maturin-1.9.0}/src/main.rs +8 -30
- {maturin-1.8.7 → maturin-1.9.0}/src/metadata.rs +60 -30
- {maturin-1.8.7 → maturin-1.9.0}/src/module_writer.rs +36 -10
- {maturin-1.8.7 → maturin-1.9.0}/src/source_distribution.rs +1 -1
- maturin-1.9.0/src/target/legacy_py.rs +64 -0
- maturin-1.8.7/src/target.rs → maturin-1.9.0/src/target/mod.rs +13 -2
- maturin-1.9.0/src/target/pypi_tags.rs +240 -0
- {maturin-1.8.7 → maturin-1.9.0}/.cirrus.yml +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/.codespellrc +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/.config/nextest.toml +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/MANIFEST.in +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/README.md +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/clippy.toml +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/license-apache +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/license-mit +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/maturin/__main__.py +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/maturin.schema.json +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/netlify.toml +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/pyproject.toml +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/setup.py +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/manylinux-policy.json +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/mod.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/musllinux-policy.json +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/musllinux.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/patchelf.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/auditwheel/repair.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/bridge.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/cargo_toml.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/compression.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/cross_compile.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/develop.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/generate_json_schema.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/new_project.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/project_layout.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/pyproject_toml.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/python_interpreter/config.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/python_interpreter/get_interpreter_metadata.py +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/python_interpreter/mod.rs +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/.gitignore.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/Cargo.toml.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/__init__.py.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/build.rs.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/example.udl.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/lib.rs.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/main.rs.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/pyproject.toml.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/templates/test_all.py.j2 +0 -0
- {maturin-1.8.7 → maturin-1.9.0}/src/upload.rs +0 -0
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
.venv/
|
|
4
|
-
.pytest_cache/
|
|
5
|
-
.tox/
|
|
1
|
+
*.egg
|
|
2
|
+
*.egg-info/
|
|
6
3
|
*.o
|
|
7
|
-
*.so
|
|
8
4
|
*.py[cdo]
|
|
5
|
+
*.so
|
|
6
|
+
.pytest_cache/
|
|
7
|
+
.tox/
|
|
8
|
+
.venv/
|
|
9
|
+
/target/
|
|
10
|
+
/test-crates/*/target
|
|
9
11
|
__pycache__/
|
|
10
|
-
*.egg-info/
|
|
11
|
-
*.egg
|
|
12
12
|
dist/
|
|
13
|
-
|
|
14
|
-
dist
|
|
13
|
+
node_modules
|
|
15
14
|
tags
|
|
16
|
-
test-crates/wheels/
|
|
17
15
|
test-crates/targets/
|
|
18
16
|
test-crates/venvs/
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
test-crates/wheels/
|
|
18
|
+
venv*/
|
|
@@ -976,9 +976,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
|
|
976
976
|
|
|
977
977
|
[[package]]
|
|
978
978
|
name = "globset"
|
|
979
|
-
version = "0.4.
|
|
979
|
+
version = "0.4.16"
|
|
980
980
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
981
|
-
checksum = "
|
|
981
|
+
checksum = "54a1028dfc5f5df5da8a56a73e6c153c9a9708ec57232470703592a3f18e49f5"
|
|
982
982
|
dependencies = [
|
|
983
983
|
"aho-corasick",
|
|
984
984
|
"bstr",
|
|
@@ -1230,6 +1230,17 @@ version = "2.0.5"
|
|
|
1230
1230
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1231
1231
|
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
|
1232
1232
|
|
|
1233
|
+
[[package]]
|
|
1234
|
+
name = "insta"
|
|
1235
|
+
version = "1.43.1"
|
|
1236
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1237
|
+
checksum = "154934ea70c58054b556dd430b99a98c2a7ff5309ac9891597e339b5c28f4371"
|
|
1238
|
+
dependencies = [
|
|
1239
|
+
"console",
|
|
1240
|
+
"once_cell",
|
|
1241
|
+
"similar",
|
|
1242
|
+
]
|
|
1243
|
+
|
|
1233
1244
|
[[package]]
|
|
1234
1245
|
name = "is_terminal_polyfill"
|
|
1235
1246
|
version = "1.70.0"
|
|
@@ -1425,7 +1436,7 @@ dependencies = [
|
|
|
1425
1436
|
|
|
1426
1437
|
[[package]]
|
|
1427
1438
|
name = "maturin"
|
|
1428
|
-
version = "1.
|
|
1439
|
+
version = "1.9.0"
|
|
1429
1440
|
dependencies = [
|
|
1430
1441
|
"anyhow",
|
|
1431
1442
|
"base64 0.21.7",
|
|
@@ -1454,6 +1465,7 @@ dependencies = [
|
|
|
1454
1465
|
"ignore",
|
|
1455
1466
|
"indexmap",
|
|
1456
1467
|
"indoc",
|
|
1468
|
+
"insta",
|
|
1457
1469
|
"itertools 0.12.1",
|
|
1458
1470
|
"keyring",
|
|
1459
1471
|
"lddtree",
|
|
@@ -1485,7 +1497,7 @@ dependencies = [
|
|
|
1485
1497
|
"target-lexicon",
|
|
1486
1498
|
"tempfile",
|
|
1487
1499
|
"textwrap",
|
|
1488
|
-
"thiserror 2.0.
|
|
1500
|
+
"thiserror 2.0.12",
|
|
1489
1501
|
"time",
|
|
1490
1502
|
"toml",
|
|
1491
1503
|
"toml_edit 0.22.22",
|
|
@@ -1820,9 +1832,9 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
|
|
1820
1832
|
|
|
1821
1833
|
[[package]]
|
|
1822
1834
|
name = "platform-info"
|
|
1823
|
-
version = "2.0.
|
|
1835
|
+
version = "2.0.5"
|
|
1824
1836
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1825
|
-
checksum = "
|
|
1837
|
+
checksum = "7539aeb3fdd8cb4f6a331307cf71a1039cee75e94e8a71725b9484f4a0d9451a"
|
|
1826
1838
|
dependencies = [
|
|
1827
1839
|
"libc",
|
|
1828
1840
|
"winapi",
|
|
@@ -1885,15 +1897,16 @@ dependencies = [
|
|
|
1885
1897
|
|
|
1886
1898
|
[[package]]
|
|
1887
1899
|
name = "pyproject-toml"
|
|
1888
|
-
version = "0.13.
|
|
1900
|
+
version = "0.13.5"
|
|
1889
1901
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1890
|
-
checksum = "
|
|
1902
|
+
checksum = "7b0f6160dc48298b9260d9b958ad1d7f96f6cd0b9df200b22329204e09334663"
|
|
1891
1903
|
dependencies = [
|
|
1904
|
+
"glob",
|
|
1892
1905
|
"indexmap",
|
|
1893
1906
|
"pep440_rs",
|
|
1894
1907
|
"pep508_rs",
|
|
1895
1908
|
"serde",
|
|
1896
|
-
"thiserror
|
|
1909
|
+
"thiserror 2.0.12",
|
|
1897
1910
|
"toml",
|
|
1898
1911
|
]
|
|
1899
1912
|
|
|
@@ -1908,7 +1921,7 @@ dependencies = [
|
|
|
1908
1921
|
"mailparse",
|
|
1909
1922
|
"rfc2047-decoder",
|
|
1910
1923
|
"tar",
|
|
1911
|
-
"thiserror 2.0.
|
|
1924
|
+
"thiserror 2.0.12",
|
|
1912
1925
|
"zip",
|
|
1913
1926
|
]
|
|
1914
1927
|
|
|
@@ -2073,7 +2086,7 @@ dependencies = [
|
|
|
2073
2086
|
"chumsky",
|
|
2074
2087
|
"memchr",
|
|
2075
2088
|
"quoted_printable",
|
|
2076
|
-
"thiserror 2.0.
|
|
2089
|
+
"thiserror 2.0.12",
|
|
2077
2090
|
]
|
|
2078
2091
|
|
|
2079
2092
|
[[package]]
|
|
@@ -2597,11 +2610,11 @@ dependencies = [
|
|
|
2597
2610
|
|
|
2598
2611
|
[[package]]
|
|
2599
2612
|
name = "thiserror"
|
|
2600
|
-
version = "2.0.
|
|
2613
|
+
version = "2.0.12"
|
|
2601
2614
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2602
|
-
checksum = "
|
|
2615
|
+
checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708"
|
|
2603
2616
|
dependencies = [
|
|
2604
|
-
"thiserror-impl 2.0.
|
|
2617
|
+
"thiserror-impl 2.0.12",
|
|
2605
2618
|
]
|
|
2606
2619
|
|
|
2607
2620
|
[[package]]
|
|
@@ -2617,9 +2630,9 @@ dependencies = [
|
|
|
2617
2630
|
|
|
2618
2631
|
[[package]]
|
|
2619
2632
|
name = "thiserror-impl"
|
|
2620
|
-
version = "2.0.
|
|
2633
|
+
version = "2.0.12"
|
|
2621
2634
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2622
|
-
checksum = "
|
|
2635
|
+
checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d"
|
|
2623
2636
|
dependencies = [
|
|
2624
2637
|
"proc-macro2",
|
|
2625
2638
|
"quote",
|
|
@@ -3494,7 +3507,7 @@ dependencies = [
|
|
|
3494
3507
|
"indexmap",
|
|
3495
3508
|
"lzma-rs",
|
|
3496
3509
|
"memchr",
|
|
3497
|
-
"thiserror 2.0.
|
|
3510
|
+
"thiserror 2.0.12",
|
|
3498
3511
|
"time",
|
|
3499
3512
|
"zopfli",
|
|
3500
3513
|
"zstd",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
authors = ["konstin <konstin@mailbox.org>", "messense <messense@icloud.com>"]
|
|
3
3
|
name = "maturin"
|
|
4
|
-
version = "1.
|
|
4
|
+
version = "1.9.0"
|
|
5
5
|
description = "Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages"
|
|
6
6
|
exclude = [
|
|
7
7
|
"test-crates/**/*",
|
|
@@ -72,7 +72,7 @@ rustc_version = "0.4.0"
|
|
|
72
72
|
semver = "1.0.22"
|
|
73
73
|
target-lexicon = "0.13.0"
|
|
74
74
|
indexmap = "2.2.3"
|
|
75
|
-
pyproject-toml = "0.13.
|
|
75
|
+
pyproject-toml = { version = "0.13.5", features = ["pep639-glob"] }
|
|
76
76
|
python-pkginfo = "0.6.5"
|
|
77
77
|
textwrap = "0.16.1"
|
|
78
78
|
ignore = "0.4.20"
|
|
@@ -143,6 +143,7 @@ pretty_assertions = { version = "1.3.0", optional = true }
|
|
|
143
143
|
expect-test = "1.4.1"
|
|
144
144
|
fs4 = { version = "0.12.0", features = ["fs-err3"] }
|
|
145
145
|
indoc = "2.0.3"
|
|
146
|
+
insta = "1.34.0"
|
|
146
147
|
pretty_assertions = "1.3.0"
|
|
147
148
|
rstest = "0.22.0"
|
|
148
149
|
rustversion = "1.0.9"
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## [1.9.0]
|
|
6
|
+
|
|
7
|
+
* Add full PEP 639 support for `project.license` and `project.license-files` in [#2647](https://github.com/PyO3/maturin/pull/2647).
|
|
8
|
+
* Add `--compatiblity pypi` to only build wheels with platform tags that can also be uploaded to PyPI. This blocks e.g. building for riscv64, which is supported by manylinux, but not by PyPI.
|
|
9
|
+
|
|
3
10
|
## [1.8.7]
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
|
|
12
|
+
* Allow specifying compression method and level, in both `build` and `develop` modes, in [#2625](https://github.com/PyO3/maturin/pull/2625).
|
|
13
|
+
* Fix Windows free-threaded builds on Python 3.14 in [#2632](https://github.com/PyO3/maturin/pull/2632)
|
|
7
14
|
|
|
8
15
|
## [1.8.6]
|
|
9
16
|
|
|
@@ -1074,7 +1081,8 @@ points-0.1.0-py2.py3-none-manylinux1_x86_64.whl | 2,8M | 752K | 85K
|
|
|
1074
1081
|
|
|
1075
1082
|
* Initial Release
|
|
1076
1083
|
|
|
1077
|
-
[Unreleased]: https://github.com/pyo3/maturin/compare/v1.
|
|
1084
|
+
[Unreleased]: https://github.com/pyo3/maturin/compare/v1.9.0...HEAD
|
|
1085
|
+
[1.9.0]: https://github.com/pyo3/maturin/compare/v1.8.7...v1.9.0
|
|
1078
1086
|
[1.8.7]: https://github.com/pyo3/maturin/compare/v1.8.6...v1.8.7
|
|
1079
1087
|
[1.8.6]: https://github.com/pyo3/maturin/compare/v1.8.5...v1.8.6
|
|
1080
1088
|
[1.8.5]: https://github.com/pyo3/maturin/compare/v1.8.4...v1.8.5
|
|
@@ -21,13 +21,13 @@ import sys
|
|
|
21
21
|
from subprocess import SubprocessError
|
|
22
22
|
from typing import Any, Dict, Mapping, List, Optional
|
|
23
23
|
|
|
24
|
-
try:
|
|
25
|
-
import tomllib
|
|
26
|
-
except ModuleNotFoundError:
|
|
27
|
-
import tomli as tomllib # type: ignore
|
|
28
|
-
|
|
29
24
|
|
|
30
25
|
def get_config() -> Dict[str, str]:
|
|
26
|
+
try:
|
|
27
|
+
import tomllib
|
|
28
|
+
except ModuleNotFoundError:
|
|
29
|
+
import tomli as tomllib # type: ignore
|
|
30
|
+
|
|
31
31
|
with open("pyproject.toml", "rb") as fp:
|
|
32
32
|
pyproject_toml = tomllib.load(fp)
|
|
33
33
|
return pyproject_toml.get("tool", {}).get("maturin", {})
|
|
@@ -17,23 +17,15 @@ from typing import Any
|
|
|
17
17
|
|
|
18
18
|
# noinspection PyUnresolvedReferences
|
|
19
19
|
from setuptools.build_meta import * # noqa:F403
|
|
20
|
-
from setuptools.build_meta import (
|
|
21
|
-
get_requires_for_build_sdist as _orig_get_requires_for_build_sdist,
|
|
22
|
-
)
|
|
23
|
-
from setuptools.build_meta import (
|
|
24
|
-
get_requires_for_build_wheel as _orig_get_requires_for_build_wheel,
|
|
25
|
-
)
|
|
26
20
|
|
|
27
21
|
|
|
28
22
|
def get_requires_for_build_wheel(config_settings: dict[str, Any] | None = None) -> list[str]:
|
|
29
|
-
reqs = _orig_get_requires_for_build_wheel()
|
|
30
23
|
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
31
|
-
|
|
32
|
-
return
|
|
24
|
+
return ["puccinialin>=0.1,<0.2"]
|
|
25
|
+
return []
|
|
33
26
|
|
|
34
27
|
|
|
35
28
|
def get_requires_for_build_sdist(config_settings: dict[str, Any] | None = None) -> list[str]:
|
|
36
|
-
reqs = _orig_get_requires_for_build_sdist()
|
|
37
29
|
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
38
|
-
|
|
39
|
-
return
|
|
30
|
+
return ["puccinialin>=0.1,<0.2"]
|
|
31
|
+
return []
|
|
@@ -56,7 +56,7 @@ pub enum AuditWheelError {
|
|
|
56
56
|
UnsupportedArchitecture(Policy, String),
|
|
57
57
|
/// This platform tag isn't defined by auditwheel yet
|
|
58
58
|
#[error("{0} compatibility policy is not defined by auditwheel yet, pass `--auditwheel=skip` to proceed anyway")]
|
|
59
|
-
UndefinedPolicy(
|
|
59
|
+
UndefinedPolicy(PlatformTag),
|
|
60
60
|
/// Failed to analyze external shared library dependencies of the wheel
|
|
61
61
|
#[error("Failed to analyze external shared library dependencies of the wheel")]
|
|
62
62
|
DependencyAnalysisError(#[source] lddtree::Error),
|
|
@@ -311,16 +311,20 @@ pub fn auditwheel_rs(
|
|
|
311
311
|
// Find the highest possible policy, if any
|
|
312
312
|
let platform_policies = match platform_tag {
|
|
313
313
|
Some(PlatformTag::Manylinux { .. }) => MANYLINUX_POLICIES.clone(),
|
|
314
|
-
Some(PlatformTag::Musllinux {
|
|
314
|
+
Some(PlatformTag::Musllinux { major, minor }) => MUSLLINUX_POLICIES
|
|
315
315
|
.clone()
|
|
316
316
|
.into_iter()
|
|
317
|
-
.filter(|policy|
|
|
317
|
+
.filter(|policy| {
|
|
318
|
+
policy.name == "linux" || policy.name == format!("musllinux_{major}_{minor}")
|
|
319
|
+
})
|
|
318
320
|
.map(|mut policy| {
|
|
319
321
|
policy.fixup_musl_libc_so_name(target.target_arch());
|
|
320
322
|
policy
|
|
321
323
|
})
|
|
322
324
|
.collect(),
|
|
323
|
-
None => {
|
|
325
|
+
None | Some(PlatformTag::Pypi) => {
|
|
326
|
+
// Using the default for the `pypi` tag means we're correctly using manylinux where
|
|
327
|
+
// possible.
|
|
324
328
|
let mut policies = get_default_platform_policies();
|
|
325
329
|
for policy in &mut policies {
|
|
326
330
|
policy.fixup_musl_libc_so_name(target.target_arch());
|
|
@@ -362,8 +366,8 @@ pub fn auditwheel_rs(
|
|
|
362
366
|
}
|
|
363
367
|
|
|
364
368
|
let policy = if let Some(platform_tag) = platform_tag {
|
|
365
|
-
let
|
|
366
|
-
|
|
369
|
+
let mut policy = Policy::from_tag(&platform_tag)
|
|
370
|
+
.ok_or(AuditWheelError::UndefinedPolicy(platform_tag))?;
|
|
367
371
|
policy.fixup_musl_libc_so_name(target.target_arch());
|
|
368
372
|
|
|
369
373
|
if let Some(highest_policy) = highest_policy {
|
|
@@ -7,53 +7,53 @@ use std::str::FromStr;
|
|
|
7
7
|
#[derive(Serialize, Debug, Clone, Eq, PartialEq, Copy, Ord, PartialOrd)]
|
|
8
8
|
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
|
|
9
9
|
pub enum PlatformTag {
|
|
10
|
-
/// Use the
|
|
10
|
+
/// Use the `manylinux_<major>_<minor>` tag
|
|
11
11
|
Manylinux {
|
|
12
12
|
/// GLIBC version major
|
|
13
|
-
|
|
13
|
+
major: u16,
|
|
14
14
|
/// GLIBC version minor
|
|
15
|
-
|
|
15
|
+
minor: u16,
|
|
16
16
|
},
|
|
17
|
-
/// Use the
|
|
17
|
+
/// Use the `musllinux_<major>_<minor>` tag
|
|
18
18
|
Musllinux {
|
|
19
19
|
/// musl libc version major
|
|
20
|
-
|
|
20
|
+
major: u16,
|
|
21
21
|
/// musl libc version minor
|
|
22
|
-
|
|
22
|
+
minor: u16,
|
|
23
23
|
},
|
|
24
24
|
/// Use the native linux tag
|
|
25
25
|
Linux,
|
|
26
|
+
/// Ensure that a PyPI-compatible tag is used, error if the target is not supported by PyPI.
|
|
27
|
+
Pypi,
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
impl PlatformTag {
|
|
29
31
|
/// `manylinux1` aka `manylinux_2_5`
|
|
30
32
|
pub fn manylinux1() -> Self {
|
|
31
|
-
Self::Manylinux {
|
|
33
|
+
Self::Manylinux { major: 2, minor: 5 }
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
/// `manylinux2010` aka `manylinux_2_12`
|
|
35
37
|
pub fn manylinux2010() -> Self {
|
|
36
|
-
Self::Manylinux {
|
|
38
|
+
Self::Manylinux {
|
|
39
|
+
major: 2,
|
|
40
|
+
minor: 12,
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
/// `manylinux2014` aka `manylinux_2_17`
|
|
40
45
|
pub fn manylinux2014() -> Self {
|
|
41
|
-
Self::Manylinux {
|
|
46
|
+
Self::Manylinux {
|
|
47
|
+
major: 2,
|
|
48
|
+
minor: 17,
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
|
|
44
|
-
/// manylinux aliases
|
|
52
|
+
/// manylinux aliases, namely `manylinux1`, `manylinux2010` and `manylinux2014`.
|
|
45
53
|
pub fn aliases(&self) -> Vec<String> {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
policy.aliases
|
|
50
|
-
} else {
|
|
51
|
-
Vec::new()
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
PlatformTag::Musllinux { .. } => Vec::new(),
|
|
55
|
-
PlatformTag::Linux => Vec::new(),
|
|
56
|
-
}
|
|
54
|
+
Policy::from_tag(self)
|
|
55
|
+
.map(|policy| policy.aliases)
|
|
56
|
+
.unwrap_or_default()
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/// Is this a portable linux platform tag
|
|
@@ -73,12 +73,18 @@ impl PlatformTag {
|
|
|
73
73
|
matches!(self, PlatformTag::Musllinux { .. })
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/// Is this the PyPI compatibility option
|
|
77
|
+
pub fn is_pypi(&self) -> bool {
|
|
78
|
+
matches!(self, PlatformTag::Pypi)
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
/// Is it supported by Rust compiler and manylinux project
|
|
77
82
|
pub fn is_supported(&self) -> bool {
|
|
78
83
|
match self {
|
|
79
|
-
PlatformTag::Manylinux {
|
|
84
|
+
PlatformTag::Manylinux { major, minor } => (*major, *minor) >= (2, 17),
|
|
80
85
|
PlatformTag::Musllinux { .. } => true,
|
|
81
86
|
PlatformTag::Linux => true,
|
|
87
|
+
PlatformTag::Pypi => true,
|
|
82
88
|
}
|
|
83
89
|
}
|
|
84
90
|
}
|
|
@@ -86,9 +92,10 @@ impl PlatformTag {
|
|
|
86
92
|
impl fmt::Display for PlatformTag {
|
|
87
93
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
88
94
|
match *self {
|
|
89
|
-
PlatformTag::Manylinux {
|
|
90
|
-
PlatformTag::Musllinux {
|
|
95
|
+
PlatformTag::Manylinux { major, minor } => write!(f, "manylinux_{major}_{minor}"),
|
|
96
|
+
PlatformTag::Musllinux { major, minor } => write!(f, "musllinux_{major}_{minor}"),
|
|
91
97
|
PlatformTag::Linux => write!(f, "linux"),
|
|
98
|
+
PlatformTag::Pypi => write!(f, "pypi"),
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
}
|
|
@@ -100,33 +107,34 @@ impl FromStr for PlatformTag {
|
|
|
100
107
|
let value = value.to_ascii_lowercase();
|
|
101
108
|
match value.as_str() {
|
|
102
109
|
"off" | "linux" => Ok(PlatformTag::Linux),
|
|
110
|
+
"pypi" => Ok(PlatformTag::Pypi),
|
|
103
111
|
"1" | "manylinux1" => Ok(PlatformTag::manylinux1()),
|
|
104
112
|
"2010" | "manylinux2010" => Ok(PlatformTag::manylinux2010()),
|
|
105
113
|
"2014" | "manylinux2014" => Ok(PlatformTag::manylinux2014()),
|
|
106
114
|
_ => {
|
|
107
115
|
if let Some(value) = value.strip_prefix("musllinux_") {
|
|
108
116
|
let mut parts = value.split('_');
|
|
109
|
-
let
|
|
117
|
+
let major = parts
|
|
110
118
|
.next()
|
|
111
|
-
.and_then(|
|
|
119
|
+
.and_then(|major| major.parse::<u16>().ok())
|
|
112
120
|
.ok_or("invalid musllinux option")?;
|
|
113
|
-
let
|
|
121
|
+
let minor = parts
|
|
114
122
|
.next()
|
|
115
|
-
.and_then(|
|
|
123
|
+
.and_then(|minor| minor.parse::<u16>().ok())
|
|
116
124
|
.ok_or("invalid musllinux option")?;
|
|
117
|
-
Ok(PlatformTag::Musllinux {
|
|
125
|
+
Ok(PlatformTag::Musllinux { major, minor })
|
|
118
126
|
} else {
|
|
119
127
|
let value = value.strip_prefix("manylinux_").unwrap_or(&value);
|
|
120
128
|
let mut parts = value.split('_');
|
|
121
|
-
let
|
|
129
|
+
let major = parts
|
|
122
130
|
.next()
|
|
123
|
-
.and_then(|
|
|
131
|
+
.and_then(|major| major.parse::<u16>().ok())
|
|
124
132
|
.ok_or("invalid manylinux option")?;
|
|
125
|
-
let
|
|
133
|
+
let minor = parts
|
|
126
134
|
.next()
|
|
127
|
-
.and_then(|
|
|
135
|
+
.and_then(|minor| minor.parse::<u16>().ok())
|
|
128
136
|
.ok_or("invalid manylinux option")?;
|
|
129
|
-
Ok(PlatformTag::Manylinux {
|
|
137
|
+
Ok(PlatformTag::Manylinux { major, minor })
|
|
130
138
|
}
|
|
131
139
|
}
|
|
132
140
|
}
|
|
@@ -49,7 +49,7 @@ pub struct Policy {
|
|
|
49
49
|
impl Default for Policy {
|
|
50
50
|
fn default() -> Self {
|
|
51
51
|
// defaults to linux
|
|
52
|
-
Policy::
|
|
52
|
+
Policy::from_tag(&PlatformTag::Linux).unwrap()
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -79,17 +79,23 @@ impl Policy {
|
|
|
79
79
|
self.name.parse().expect("unknown platform tag")
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
/// Get policy by
|
|
83
|
-
pub fn
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
82
|
+
/// Get policy by its platform tag
|
|
83
|
+
pub fn from_tag(tag: &PlatformTag) -> Option<Self> {
|
|
84
|
+
match tag {
|
|
85
|
+
PlatformTag::Manylinux { major, minor } => {
|
|
86
|
+
let name = format!("manylinux_{major}_{minor}");
|
|
87
|
+
MANYLINUX_POLICIES.iter().find(|p| p.name == name).cloned()
|
|
88
|
+
}
|
|
89
|
+
PlatformTag::Musllinux { major, minor } => {
|
|
90
|
+
let name = format!("musllinux_{major}_{minor}");
|
|
91
|
+
MUSLLINUX_POLICIES.iter().find(|p| p.name == name).cloned()
|
|
92
|
+
}
|
|
93
|
+
PlatformTag::Linux => MANYLINUX_POLICIES
|
|
94
|
+
.iter()
|
|
95
|
+
.find(|p| p.name == "linux")
|
|
96
|
+
.cloned(),
|
|
97
|
+
PlatformTag::Pypi => unreachable!("pypi is not a policy"),
|
|
98
|
+
}
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
pub(crate) fn fixup_musl_libc_so_name(&mut self, target_arch: Arch) {
|
|
@@ -116,15 +122,20 @@ impl Policy {
|
|
|
116
122
|
#[cfg(test)]
|
|
117
123
|
mod test {
|
|
118
124
|
use super::{Arch, Policy, MANYLINUX_POLICIES, MUSLLINUX_POLICIES};
|
|
125
|
+
use crate::PlatformTag;
|
|
119
126
|
use pretty_assertions::assert_eq;
|
|
120
127
|
|
|
121
128
|
#[test]
|
|
122
129
|
fn test_load_policy() {
|
|
123
|
-
let linux = Policy::
|
|
130
|
+
let linux = Policy::from_tag(&PlatformTag::Linux).unwrap();
|
|
124
131
|
assert!(linux.symbol_versions.is_empty());
|
|
125
132
|
assert!(linux.lib_whitelist.is_empty());
|
|
126
133
|
|
|
127
|
-
let manylinux2010 = Policy::
|
|
134
|
+
let manylinux2010 = Policy::from_tag(&PlatformTag::Manylinux {
|
|
135
|
+
major: 2,
|
|
136
|
+
minor: 12,
|
|
137
|
+
})
|
|
138
|
+
.unwrap();
|
|
128
139
|
assert!(manylinux2010.lib_whitelist.contains("libc.so.6"));
|
|
129
140
|
let symbol_version = &manylinux2010.symbol_versions["x86_64"];
|
|
130
141
|
assert_eq!(symbol_version["CXXABI"].len(), 4);
|
|
@@ -150,7 +161,7 @@ mod test {
|
|
|
150
161
|
|
|
151
162
|
#[test]
|
|
152
163
|
fn test_policy_musllinux_fixup_libc_so_name() {
|
|
153
|
-
let mut policy = Policy::
|
|
164
|
+
let mut policy = Policy::from_tag(&PlatformTag::Musllinux { major: 1, minor: 1 }).unwrap();
|
|
154
165
|
policy.fixup_musl_libc_so_name(Arch::Aarch64);
|
|
155
166
|
assert!(policy.lib_whitelist.contains("libc.musl-aarch64.so.1"));
|
|
156
167
|
}
|