diff --git a/.devcontainer/DOCKERFILE b/.devcontainer/Dockerfile similarity index 100% rename from .devcontainer/DOCKERFILE rename to .devcontainer/Dockerfile diff --git a/Cargo.lock b/Cargo.lock index 63608aefb96..9aee27fb415 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2286,6 +2286,7 @@ dependencies = [ "rustpython-stdlib", "rustpython-vm", "rustyline", + "winresource", ] [[package]] @@ -2747,6 +2748,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" +dependencies = [ + "serde", +] + [[package]] name = "sha-1" version = "0.10.1" @@ -3043,6 +3053,47 @@ dependencies = [ "shared-build", ] +[[package]] +name = "toml" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ae329d1f08c4d17a59bed7ff5b5a769d062e64a62d34a3261b219e62cd5aae" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3da5db5a963e24bc68be8b17b6fa82814bb22ee8660f192bb182771d498f09a3" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "310068873db2c5b3e7659d2cc35d21855dbafa50d1ce336397c666e3cb08137e" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" + [[package]] name = "twox-hash" version = "1.6.3" @@ -3666,6 +3717,15 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "winnow" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.55.0" @@ -3676,6 +3736,16 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "winresource" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4a67c78ee5782c0c1cb41bebc7e12c6e79644daa1650ebbc1de5d5b08593f7" +dependencies = [ + "toml", + "version_check", +] + [[package]] name = "winsafe" version = "0.0.19" diff --git a/Cargo.toml b/Cargo.toml index 163289e8b26..1766738ced3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,9 @@ ssl = ["rustpython-stdlib/ssl"] ssl-vendor = ["ssl", "rustpython-stdlib/ssl-vendor"] tkinter = ["rustpython-stdlib/tkinter"] +[build-dependencies] +winresource = "0.1" + [dependencies] rustpython-compiler = { workspace = true } rustpython-pylib = { workspace = true, optional = true } diff --git a/build.rs b/build.rs new file mode 100644 index 00000000000..adebd659ade --- /dev/null +++ b/build.rs @@ -0,0 +1,17 @@ +fn main() { + if std::env::var("CARGO_CFG_TARGET_OS").unwrap() == "windows" { + println!("cargo:rerun-if-changed=logo.ico"); + let mut res = winresource::WindowsResource::new(); + if std::path::Path::new("logo.ico").exists() { + res.set_icon("logo.ico"); + } else { + println!("cargo:warning=logo.ico not found, skipping icon embedding"); + return; + } + res.compile() + .map_err(|e| { + println!("cargo:warning=Failed to compile Windows resources: {e}"); + }) + .ok(); + } +} diff --git a/logo.ico b/logo.ico new file mode 100644 index 00000000000..24cbb8c3789 Binary files /dev/null and b/logo.ico differ