diff --git a/Cargo.lock b/Cargo.lock
index 2b864cb2e..eef99c77d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -116,33 +116,6 @@ dependencies = [
"syn 2.0.87",
]
-[[package]]
-name = "aws-lc-rs"
-version = "1.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cdd82dba44d209fddb11c190e0a94b78651f95299598e472215667417a03ff1d"
-dependencies = [
- "aws-lc-sys",
- "mirai-annotations",
- "paste",
- "zeroize",
-]
-
-[[package]]
-name = "aws-lc-sys"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df7a4168111d7eb622a31b214057b8509c0a7e1794f44c546d742330dc793972"
-dependencies = [
- "bindgen",
- "cc",
- "cmake",
- "dunce",
- "fs_extra",
- "libc",
- "paste",
-]
-
[[package]]
name = "base64"
version = "0.21.7"
@@ -155,29 +128,6 @@ version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
-[[package]]
-name = "bindgen"
-version = "0.69.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
-dependencies = [
- "bitflags 2.5.0",
- "cexpr",
- "clang-sys",
- "itertools",
- "lazy_static",
- "lazycell",
- "log",
- "prettyplease",
- "proc-macro2",
- "quote",
- "regex",
- "rustc-hash",
- "shlex",
- "syn 2.0.87",
- "which 4.4.2",
-]
-
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -308,16 +258,16 @@ dependencies = [
[[package]]
name = "cargo-xwin"
-version = "0.17.3"
+version = "0.17.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc80ddf05acf2ff312d58830f763f07d522aa1ea56c9e7895189b920126b9197"
+checksum = "177548480a9f6291a24d0183941d59c4552bb3206c888bf89caef30a1c036e03"
dependencies = [
"anyhow",
"cargo-config2",
"cargo-options",
"clap",
"dirs",
- "fs-err",
+ "fs-err 3.0.0",
"indicatif",
"native-tls",
"paste",
@@ -326,15 +276,15 @@ dependencies = [
"rustls-pemfile",
"tracing-subscriber",
"ureq",
- "which 6.0.3",
+ "which",
"xwin",
]
[[package]]
name = "cargo-zigbuild"
-version = "0.19.3"
+version = "0.19.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e700178b11124560cdbabc8808e938fe6d77abde036b77a4c03a191b02bac854"
+checksum = "5eb13fbc2ba490ac9eb0b359cf46ba265255424c04a172f1c1772a8b9532283d"
dependencies = [
"anyhow",
"cargo-config2",
@@ -343,7 +293,7 @@ dependencies = [
"clap",
"crc",
"dirs",
- "fs-err",
+ "fs-err 3.0.0",
"path-slash",
"rustc_version",
"rustflags",
@@ -352,21 +302,21 @@ dependencies = [
"serde_json",
"shlex",
"target-lexicon",
- "which 6.0.3",
+ "which",
]
[[package]]
name = "cargo_metadata"
-version = "0.18.1"
+version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037"
+checksum = "afc309ed89476c8957c50fb818f56fe894db857866c3e163335faa91dc34eb85"
dependencies = [
"camino",
"cargo-platform",
"semver",
"serde",
"serde_json",
- "thiserror",
+ "thiserror 1.0.64",
]
[[package]]
@@ -393,20 +343,9 @@ version = "1.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0"
dependencies = [
- "jobserver",
- "libc",
"shlex",
]
-[[package]]
-name = "cexpr"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
-dependencies = [
- "nom",
-]
-
[[package]]
name = "cfb"
version = "0.10.0"
@@ -444,17 +383,6 @@ dependencies = [
"stacker",
]
-[[package]]
-name = "clang-sys"
-version = "1.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
-dependencies = [
- "glob",
- "libc",
- "libloading",
-]
-
[[package]]
name = "clap"
version = "4.5.7"
@@ -536,15 +464,6 @@ dependencies = [
"unicode-width",
]
-[[package]]
-name = "cmake"
-version = "0.1.51"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a"
-dependencies = [
- "cc",
-]
-
[[package]]
name = "colorchoice"
version = "1.0.1"
@@ -717,7 +636,7 @@ checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de"
dependencies = [
"console",
"shell-words",
- "thiserror",
+ "thiserror 1.0.64",
"zeroize",
]
@@ -910,23 +829,26 @@ dependencies = [
"autocfg",
]
+[[package]]
+name = "fs-err"
+version = "3.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8bb60e7409f34ef959985bc9d9c5ee8f5db24ee46ed9775850548021710f807f"
+dependencies = [
+ "autocfg",
+]
+
[[package]]
name = "fs4"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e871a4cfa68bb224863b53149d973df1ac8d1ed2fa1d1bfc37ac1bb65dd37207"
dependencies = [
- "fs-err",
+ "fs-err 2.11.0",
"rustix",
"windows-sys 0.52.0",
]
-[[package]]
-name = "fs_extra"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c"
-
[[package]]
name = "futures"
version = "0.3.30"
@@ -1206,15 +1128,6 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
-[[package]]
-name = "jobserver"
-version = "0.1.32"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "keyring"
version = "2.3.3"
@@ -1231,19 +1144,13 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-[[package]]
-name = "lazycell"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
-
[[package]]
name = "lddtree"
-version = "0.3.6"
+version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "470645aa69c87af88557f2b87e0b0894b0843a2b059b4661d892414a89c24169"
+checksum = "e0779ac94bd7b6ab781fa12388dbf79ac45ec1fa433e7d25521753be8227b08e"
dependencies = [
- "fs-err",
+ "fs-err 3.0.0",
"glob",
"goblin",
]
@@ -1254,16 +1161,6 @@ version = "0.2.158"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439"
-[[package]]
-name = "libloading"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4"
-dependencies = [
- "cfg-if",
- "windows-targets 0.52.5",
-]
-
[[package]]
name = "libmimalloc-sys"
version = "0.1.38"
@@ -1300,6 +1197,12 @@ version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89"
+[[package]]
+name = "litemap"
+version = "0.7.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "643cb0b8d4fcc284004d5fd0d67ccf61dfffadb7f75e1e71bc420f4688a3a704"
+
[[package]]
name = "lock_api"
version = "0.4.12"
@@ -1372,7 +1275,7 @@ dependencies = [
"expect-test",
"fat-macho",
"flate2",
- "fs-err",
+ "fs-err 3.0.0",
"fs4",
"glob",
"goblin",
@@ -1410,7 +1313,7 @@ dependencies = [
"target-lexicon",
"tempfile",
"textwrap",
- "thiserror",
+ "thiserror 2.0.3",
"time",
"toml",
"toml_edit 0.22.16",
@@ -1420,9 +1323,9 @@ dependencies = [
"unicode-xid",
"ureq",
"url",
- "which 6.0.3",
+ "which",
"wild",
- "zip 0.6.6",
+ "zip 2.1.6",
]
[[package]]
@@ -1480,12 +1383,6 @@ dependencies = [
"adler2",
]
-[[package]]
-name = "mirai-annotations"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c9be0862c1b3f26a88803c4a49de6889c10e608b3ee9344e6ef5b45fb37ad3d1"
-
[[package]]
name = "msi"
version = "0.8.0"
@@ -1706,7 +1603,7 @@ dependencies = [
"pep440_rs",
"regex",
"serde",
- "thiserror",
+ "thiserror 1.0.64",
"tracing",
"unicode-width",
"url",
@@ -1781,16 +1678,6 @@ dependencies = [
"yansi",
]
-[[package]]
-name = "prettyplease"
-version = "0.2.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033"
-dependencies = [
- "proc-macro2",
- "syn 2.0.87",
-]
-
[[package]]
name = "proc-macro-crate"
version = "3.1.0"
@@ -1838,11 +1725,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3f3f0d552c7efdde2b6898bf21b49c4e76b3e6071ff196dfe52109804db896"
dependencies = [
"flate2",
- "fs-err",
+ "fs-err 2.11.0",
"mailparse",
"rfc2047-decoder",
"tar",
- "thiserror",
+ "thiserror 1.0.64",
"zip 0.6.6",
]
@@ -1937,7 +1824,7 @@ checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891"
dependencies = [
"getrandom",
"libredox",
- "thiserror",
+ "thiserror 1.0.64",
]
[[package]]
@@ -2001,7 +1888,7 @@ dependencies = [
"chumsky",
"memchr",
"quoted_printable",
- "thiserror",
+ "thiserror 1.0.64",
]
[[package]]
@@ -2049,12 +1936,6 @@ dependencies = [
"unicode-ident",
]
-[[package]]
-name = "rustc-hash"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
-
[[package]]
name = "rustc_version"
version = "0.4.1"
@@ -2085,11 +1966,10 @@ dependencies = [
[[package]]
name = "rustls"
-version = "0.23.13"
+version = "0.23.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8"
+checksum = "934b404430bb06b3fae2cba809eb45a1ab1aecd64491213d7c3301b88393f8d1"
dependencies = [
- "aws-lc-rs",
"log",
"once_cell",
"ring",
@@ -2111,9 +1991,9 @@ dependencies = [
[[package]]
name = "rustls-pki-types"
-version = "1.7.0"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d"
+checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
[[package]]
name = "rustls-webpki"
@@ -2121,7 +2001,6 @@ version = "0.102.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9"
dependencies = [
- "aws-lc-rs",
"ring",
"rustls-pki-types",
"untrusted",
@@ -2404,6 +2283,12 @@ version = "0.9.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
+[[package]]
+name = "stable_deref_trait"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
+
[[package]]
name = "stacker"
version = "0.1.15"
@@ -2523,7 +2408,16 @@ version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
dependencies = [
- "thiserror-impl",
+ "thiserror-impl 1.0.64",
+]
+
+[[package]]
+name = "thiserror"
+version = "2.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c006c85c7651b3cf2ada4584faa36773bd07bac24acfb39f3c431b36d7e667aa"
+dependencies = [
+ "thiserror-impl 2.0.3",
]
[[package]]
@@ -2537,6 +2431,17 @@ dependencies = [
"syn 2.0.87",
]
+[[package]]
+name = "thiserror-impl"
+version = "2.0.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 2.0.87",
+]
+
[[package]]
name = "thread_local"
version = "1.1.8"
@@ -2807,12 +2712,13 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
[[package]]
name = "ureq"
-version = "2.10.1"
+version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a"
+checksum = "b30e6f97efe1fa43535ee241ee76967d3ff6ff3953ebb430d8d55c5393029e7b"
dependencies = [
"base64 0.22.1",
"flate2",
+ "litemap",
"log",
"native-tls",
"once_cell",
@@ -2823,6 +2729,8 @@ dependencies = [
"socks",
"url",
"webpki-roots",
+ "yoke",
+ "zerofrom",
]
[[package]]
@@ -2919,21 +2827,9 @@ dependencies = [
[[package]]
name = "which"
-version = "4.4.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
-dependencies = [
- "either",
- "home",
- "once_cell",
- "rustix",
-]
-
-[[package]]
-name = "which"
-version = "6.0.3"
+version = "7.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f"
+checksum = "c9cad3279ade7346b96e38731a641d7343dd6a53d55083dd54eadfa5a1b38c6b"
dependencies = [
"either",
"home",
@@ -3195,6 +3091,17 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049"
+[[package]]
+name = "yoke"
+version = "0.7.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6c5b1314b079b0930c31e3af543d8ee1757b1951ae1e1565ec704403a7240ca5"
+dependencies = [
+ "serde",
+ "stable_deref_trait",
+ "zerofrom",
+]
+
[[package]]
name = "zerocopy"
version = "0.7.34"
@@ -3215,6 +3122,12 @@ dependencies = [
"syn 2.0.87",
]
+[[package]]
+name = "zerofrom"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91ec111ce797d0e0784a1116d0ddcdbea84322cd79e5d5ad173daeba4f93ab55"
+
[[package]]
name = "zeroize"
version = "1.8.1"
@@ -3228,11 +3141,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261"
dependencies = [
"byteorder",
- "bzip2",
"crc32fast",
"crossbeam-utils",
"flate2",
- "time",
]
[[package]]
@@ -3242,13 +3153,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "40dd8c92efc296286ce1fbd16657c5dbefff44f1b4ca01cc5f517d8b7b3d3e2e"
dependencies = [
"arbitrary",
+ "bzip2",
"crc32fast",
"crossbeam-utils",
"displaydoc",
"flate2",
"indexmap",
"memchr",
- "thiserror",
+ "thiserror 1.0.64",
+ "time",
"zopfli",
]
diff --git a/Cargo.toml b/Cargo.toml
index 6195ab233..fa51b4962 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -43,7 +43,7 @@ anyhow = "1.0.80"
base64 = "0.21.0"
glob = "0.3.0"
cargo-config2 = "0.1.24"
-cargo_metadata = "0.18.0"
+cargo_metadata = "0.19.0"
cargo-options = "0.7.2"
cbindgen = { version = "0.27.0", default-features = false }
flate2 = "1.0.18"
@@ -57,13 +57,13 @@ tar = "0.4.38"
tempfile = "3.2.0"
toml = "0.8.10"
toml_edit = "0.22.6"
-zip = { version = "0.6.1", default-features = false, features = [
+zip = { version = "2.0.0", default-features = false, features = [
"bzip2",
"deflate",
"time",
] }
-thiserror = "1.0.37"
-fs-err = "2.11.0"
+thiserror = "2.0.3"
+fs-err = "3.0.0"
fat-macho = { version = "0.4.8", default-features = false }
once_cell = "1.7.2"
rustc_version = "0.4.0"
@@ -75,7 +75,7 @@ python-pkginfo = "0.6.0"
textwrap = "0.16.1"
ignore = "0.4.20"
itertools = "0.12.1"
-lddtree = "0.3.4"
+lddtree = "0.3.7"
cc = "1.0.88"
dunce = "1.0.2"
normpath = "1.1.1"
@@ -97,8 +97,8 @@ clap = { version = "4.0.0", features = [
clap_complete_command = { version = "0.6.1", optional = true }
# cross compile
-cargo-zigbuild = { version = "0.19.3", default-features = false, optional = true }
-cargo-xwin = { version = "0.17", default-features = false, optional = true }
+cargo-zigbuild = { version = "0.19.5", default-features = false, optional = true }
+cargo-xwin = { version = "0.17.4", default-features = false, optional = true }
# log
tracing = "0.1.36"
@@ -122,7 +122,11 @@ ureq = { version = "2.9.4", features = [
"socks-proxy",
], default-features = false, optional = true }
native-tls = { version = "0.2.8", optional = true }
-rustls = { version = "0.23", optional = true }
+rustls = { version = "0.23", default-features = false, features = [
+ "logging",
+ "std",
+ "tls12",
+], optional = true }
rustls-pemfile = { version = "2.1.0", optional = true }
keyring = { version = "2.3.2", default-features = false, features = [
"linux-no-secret-service",
@@ -142,7 +146,7 @@ rstest = "0.22.0"
rustversion = "1.0.9"
time = { version = "0.3.34", features = ["macros"] }
trycmd = "0.15.0"
-which = "6.0.0"
+which = "7.0.0"
[features]
default = ["full", "rustls"]
diff --git a/deny.toml b/deny.toml
index aa0847056..ae56e270c 100644
--- a/deny.toml
+++ b/deny.toml
@@ -105,6 +105,7 @@ allow = [
"BSD-3-Clause",
"CC0-1.0",
"Unicode-3.0",
+ "BSL-1.0",
]
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the
diff --git a/maturin.schema.json b/maturin.schema.json
index 0af4b8173..0f1360095 100644
--- a/maturin.schema.json
+++ b/maturin.schema.json
@@ -231,6 +231,53 @@
}
]
},
+ "CargoCrateType": {
+ "description": "Supported cargo crate types",
+ "oneOf": [
+ {
+ "description": "Binary executable target",
+ "type": "string",
+ "enum": [
+ "bin"
+ ]
+ },
+ {
+ "description": "Dynamic system library target",
+ "type": "string",
+ "enum": [
+ "cdylib"
+ ]
+ },
+ {
+ "description": "Dynamic Rust library target",
+ "type": "string",
+ "enum": [
+ "dylib"
+ ]
+ },
+ {
+ "description": "Rust library",
+ "type": "string",
+ "enum": [
+ "lib"
+ ]
+ },
+ {
+ "description": "Rust library for use as an intermediate target",
+ "type": "string",
+ "enum": [
+ "rlib"
+ ]
+ },
+ {
+ "description": "Static library",
+ "type": "string",
+ "enum": [
+ "staticlib"
+ ]
+ }
+ ]
+ },
"CargoTarget": {
"description": "Cargo compile target",
"type": "object",
@@ -239,10 +286,14 @@
],
"properties": {
"kind": {
- "description": "Kind of target (\"bin\", \"lib\")",
- "type": [
- "string",
- "null"
+ "description": "Kind of target (\"bin\", \"cdylib\")",
+ "anyOf": [
+ {
+ "$ref": "#/definitions/CargoCrateType"
+ },
+ {
+ "type": "null"
+ }
]
},
"name": {
diff --git a/src/build_context.rs b/src/build_context.rs
index a7a5b9b95..409eed016 100644
--- a/src/build_context.rs
+++ b/src/build_context.rs
@@ -14,6 +14,7 @@ use crate::{
PythonInterpreter, Target,
};
use anyhow::{anyhow, bail, Context, Result};
+use cargo_metadata::CrateType;
use cargo_metadata::Metadata;
use fs_err as fs;
use ignore::overrides::{Override, OverrideBuilder};
@@ -841,7 +842,7 @@ impl BuildContext {
let artifacts = artifacts.first().context(error_msg)?;
let mut artifact = artifacts
- .get("cdylib")
+ .get(&CrateType::CDyLib)
.cloned()
.ok_or_else(|| anyhow!(error_msg,))?;
@@ -1089,7 +1090,7 @@ impl BuildContext {
let mut artifact_paths = Vec::with_capacity(artifacts.len());
for artifact in artifacts {
let artifact = artifact
- .get("bin")
+ .get(&CrateType::Bin)
.cloned()
.ok_or_else(|| anyhow!("Cargo didn't build a binary"))?;
diff --git a/src/build_options.rs b/src/build_options.rs
index 4b8ea0bed..27f12c9a2 100644
--- a/src/build_options.rs
+++ b/src/build_options.rs
@@ -7,6 +7,7 @@ use crate::pyproject_toml::ToolMaturin;
use crate::python_interpreter::{InterpreterConfig, InterpreterKind, MINIMUM_PYTHON_MINOR};
use crate::{BuildContext, PythonInterpreter, Target};
use anyhow::{bail, format_err, Context, Result};
+use cargo_metadata::{CrateType, TargetKind};
use cargo_metadata::{Metadata, Node};
use cargo_options::heading;
use pep440_rs::VersionSpecifiers;
@@ -884,7 +885,7 @@ fn filter_cargo_targets(
.all(|f| resolved_features.contains(f))
}
}
- _ => target.kind.contains(&"cdylib".to_string()),
+ _ => target.crate_types.contains(&CrateType::CDyLib),
})
.map(|target| CompileTarget {
target: target.clone(),
@@ -896,9 +897,9 @@ fn filter_cargo_targets(
// Let's try compile one of the target with `--crate-type cdylib`
let lib_target = root_pkg.targets.iter().find(|target| {
target
- .kind
+ .crate_types
.iter()
- .any(|k| LIB_CRATE_TYPES.contains(&k.as_str()))
+ .any(|crate_type| LIB_CRATE_TYPES.contains(crate_type))
});
if let Some(target) = lib_target {
targets.push(CompileTarget {
@@ -914,7 +915,7 @@ fn filter_cargo_targets(
config_targets.iter().any(|config_target| {
let name_eq = config_target.name == target.name;
match &config_target.kind {
- Some(kind) => name_eq && target.kind.contains(kind),
+ Some(kind) => name_eq && target.crate_types.contains(&CrateType::from(*kind)),
None => name_eq,
}
})
@@ -1066,11 +1067,16 @@ pub fn find_bridge(cargo_metadata: &Metadata, bridge: Option<&str>) -> Result
) -> Result
) -> Result
,
targets: &[CompileTarget],
-) -> Result>> {
+) -> Result>> {
if context.universal2 {
compile_universal2(context, python_interpreter, targets)
} else {
@@ -61,7 +67,7 @@ fn compile_universal2(
context: &BuildContext,
python_interpreter: Option<&PythonInterpreter>,
targets: &[CompileTarget],
-) -> Result>> {
+) -> Result>> {
let mut aarch64_context = context.clone();
aarch64_context.target = Target::from_target_triple(Some("aarch64-apple-darwin".to_string()))?;
@@ -80,12 +86,12 @@ fn compile_universal2(
.zip(aarch64_artifacts.iter().zip(&x86_64_artifacts))
{
let build_type = if bridge_model.is_bin() {
- "bin"
+ CrateType::Bin
} else {
- "cdylib"
+ CrateType::CDyLib
};
- let aarch64_artifact = aarch64_artifact.get(build_type).cloned().ok_or_else(|| {
- if build_type == "cdylib" {
+ let aarch64_artifact = aarch64_artifact.get(&build_type).cloned().ok_or_else(|| {
+ if build_type == CrateType::CDyLib {
anyhow!(
"Cargo didn't build an aarch64 cdylib. Did you miss crate-type = [\"cdylib\"] \
in the lib section of your Cargo.toml?",
@@ -94,8 +100,8 @@ fn compile_universal2(
anyhow!("Cargo didn't build an aarch64 bin.")
}
})?;
- let x86_64_artifact = x86_64_artifact.get(build_type).cloned().ok_or_else(|| {
- if build_type == "cdylib" {
+ let x86_64_artifact = x86_64_artifact.get(&build_type).cloned().ok_or_else(|| {
+ if build_type == CrateType::CDyLib {
anyhow!(
"Cargo didn't build a x86_64 cdylib. Did you miss crate-type = [\"cdylib\"] \
in the lib section of your Cargo.toml?",
@@ -128,7 +134,7 @@ fn compile_universal2(
path: PathBuf::from(output_path),
..x86_64_artifact
};
- result.insert(build_type.to_string(), universal_artifact);
+ result.insert(build_type, universal_artifact);
universal_artifacts.push(result);
}
Ok(universal_artifacts)
@@ -138,7 +144,7 @@ fn compile_targets(
context: &BuildContext,
python_interpreter: Option<&PythonInterpreter>,
targets: &[CompileTarget],
-) -> Result>> {
+) -> Result>> {
let mut artifacts = Vec::with_capacity(targets.len());
for target in targets {
let build_command = cargo_build_command(context, python_interpreter, target)?;
@@ -165,9 +171,9 @@ fn cargo_build_command(
// Add `--crate-type cdylib` if available
if compile_target
.target
- .kind
+ .crate_types
.iter()
- .any(|k| LIB_CRATE_TYPES.contains(&k.as_str()))
+ .any(|crate_type| LIB_CRATE_TYPES.contains(crate_type))
{
// `--crate-type` is stable since Rust 1.64.0
// See https://github.com/rust-lang/cargo/pull/10838
@@ -461,7 +467,7 @@ fn cargo_build_command(
fn compile_target(
context: &BuildContext,
mut build_command: Command,
-) -> Result> {
+) -> Result> {
debug!("Running {:?}", build_command);
let using_cross = build_command
diff --git a/src/module_writer.rs b/src/module_writer.rs
index 003434e8a..04103c0e9 100644
--- a/src/module_writer.rs
+++ b/src/module_writer.rs
@@ -270,7 +270,7 @@ impl ModuleWriter for WheelWriter {
zip::CompressionMethod::Deflated
};
- let mut options = zip::write::FileOptions::default()
+ let mut options = zip::write::SimpleFileOptions::default()
.unix_permissions(permissions)
.compression_method(compression_method);
let mtime = self.mtime().ok();
@@ -379,7 +379,8 @@ impl WheelWriter {
zip::CompressionMethod::Deflated
};
- let mut options = zip::write::FileOptions::default().compression_method(compression_method);
+ let mut options =
+ zip::write::SimpleFileOptions::default().compression_method(compression_method);
let mtime = self.mtime().ok();
if let Some(mtime) = mtime {
options = options.last_modified_time(mtime);
diff --git a/src/pyproject_toml.rs b/src/pyproject_toml.rs
index 8728a27f4..f338b03ed 100644
--- a/src/pyproject_toml.rs
+++ b/src/pyproject_toml.rs
@@ -97,13 +97,50 @@ impl GlobPattern {
pub struct CargoTarget {
/// Name as given in the `Cargo.toml` or generated from the file name
pub name: String,
- /// Kind of target ("bin", "lib")
- pub kind: Option,
+ /// Kind of target ("bin", "cdylib")
+ pub kind: Option,
// TODO: Add bindings option
// Bridge model, which kind of bindings to use
// pub bindings: Option,
}
+/// Supported cargo crate types
+#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
+#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
+pub enum CargoCrateType {
+ /// Binary executable target
+ #[serde(rename = "bin")]
+ Bin,
+ /// Dynamic system library target
+ #[serde(rename = "cdylib")]
+ CDyLib,
+ /// Dynamic Rust library target
+ #[serde(rename = "dylib")]
+ DyLib,
+ /// Rust library
+ #[serde(rename = "lib")]
+ Lib,
+ /// Rust library for use as an intermediate target
+ #[serde(rename = "rlib")]
+ RLib,
+ /// Static library
+ #[serde(rename = "staticlib")]
+ StaticLib,
+}
+
+impl From for cargo_metadata::CrateType {
+ fn from(value: CargoCrateType) -> Self {
+ match value {
+ CargoCrateType::Bin => cargo_metadata::CrateType::Bin,
+ CargoCrateType::CDyLib => cargo_metadata::CrateType::CDyLib,
+ CargoCrateType::DyLib => cargo_metadata::CrateType::DyLib,
+ CargoCrateType::Lib => cargo_metadata::CrateType::Lib,
+ CargoCrateType::RLib => cargo_metadata::CrateType::RLib,
+ CargoCrateType::StaticLib => cargo_metadata::CrateType::StaticLib,
+ }
+ }
+}
+
/// Target configuration
#[derive(Serialize, Deserialize, Debug, Clone)]
#[serde(rename_all = "kebab-case")]
diff --git a/tests/common/integration.rs b/tests/common/integration.rs
index 84e1f5dc4..47c1f97be 100644
--- a/tests/common/integration.rs
+++ b/tests/common/integration.rs
@@ -5,7 +5,7 @@ use anyhow::{bail, Context, Result};
#[cfg(feature = "zig")]
use cargo_zigbuild::Zig;
use clap::Parser;
-use fs4::fs_err::FileExt;
+use fs4::fs_std::FileExt;
use fs_err::File;
use maturin::{BuildOptions, PlatformTag, PythonInterpreter, Target};
use normpath::PathExt;
@@ -90,7 +90,7 @@ pub fn test_integration(
// All tests try to use this venv at the same time, so we need to make sure only one
// modifies it at a time and that during that time, no other test reads it.
let file = File::create(venvs_dir.join("cffi-provider.lock"))?;
- file.lock_exclusive()?;
+ file.file().lock_exclusive()?;
let python = if !cffi_venv.is_dir() {
create_named_virtualenv(cffi_provider, python_interp.clone().map(PathBuf::from))?;
let target_triple = Target::from_target_triple(None)?;
@@ -123,7 +123,7 @@ pub fn test_integration(
let target_triple = Target::from_target_triple(None)?;
target_triple.get_venv_python(&cffi_venv)
};
- file.unlock()?;
+ file.file().unlock()?;
cli.push("--interpreter".into());
cli.push(python.as_os_str().to_owned());
}
diff --git a/tests/common/other.rs b/tests/common/other.rs
index 4448885d4..b7a51beb4 100644
--- a/tests/common/other.rs
+++ b/tests/common/other.rs
@@ -248,7 +248,7 @@ pub fn check_wheel_mtimes(
let mut mtimes = BTreeSet::::new();
for idx in 0..wheel.len() {
- let mtime = wheel.by_index(idx)?.last_modified().to_time()?;
+ let mtime = wheel.by_index(idx)?.last_modified().unwrap().try_into()?;
mtimes.insert(mtime);
}