diff --git a/Cargo.lock b/Cargo.lock index f826c8db3..2b7726505 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -281,7 +281,7 @@ version = "0.13.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c0e6249c249b8916c98ebae7bc06216c8dcab3002f32872b4abe642d17063b1" dependencies = [ - "bindgen", + "bindgen 0.72.1", "cc", "cmake", "dunce", @@ -332,6 +332,26 @@ version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" +[[package]] +name = "bindgen" +version = "0.71.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +dependencies = [ + "bitflags 2.13.1", + "cexpr", + "clang-sys", + "itertools 0.10.5", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex 1.3.0", + "syn 2.0.119", +] + [[package]] name = "bindgen" version = "0.72.1" @@ -2791,8 +2811,7 @@ dependencies = [ [[package]] name = "parking_lot_core" version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +source = "git+https://github.com/youknowone/parking_lot?branch=rustpython#f4ee53a7b803354a8f0a6de2f28e93fc141240bf" dependencies = [ "cfg-if", "libc", @@ -4048,6 +4067,8 @@ dependencies = [ "rustpython-unicode", "rustpython-vm", "scopeguard", + "tcl-sys", + "tk-sys", "uuid", "webpki-roots", "widestring", @@ -4416,6 +4437,14 @@ dependencies = [ "sponge-cursor", ] +[[package]] +name = "shared-build" +version = "0.2.0" +source = "git+https://github.com/arihant2math/tkinter.git?tag=v0.2.0#198fc35b1f18f4eda401f97a641908f321b1403a" +dependencies = [ + "bindgen 0.71.1", +] + [[package]] name = "shlex" version = "1.3.0" @@ -4634,6 +4663,15 @@ version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca" +[[package]] +name = "tcl-sys" +version = "0.2.0" +source = "git+https://github.com/arihant2math/tkinter.git?tag=v0.2.0#198fc35b1f18f4eda401f97a641908f321b1403a" +dependencies = [ + "pkg-config", + "shared-build", +] + [[package]] name = "tempfile" version = "3.27.0" @@ -4765,6 +4803,15 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tk-sys" +version = "0.2.0" +source = "git+https://github.com/arihant2math/tkinter.git?tag=v0.2.0#198fc35b1f18f4eda401f97a641908f321b1403a" +dependencies = [ + "pkg-config", + "shared-build", +] + [[package]] name = "toml" version = "1.1.2+spec-1.1.0" diff --git a/Cargo.toml b/Cargo.toml index 7e0db0672..2511b011d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,6 +31,7 @@ ssl-rustls-aws-lc = ["ssl-rustls", "dep:rustls", "rustls/aws_lc_rs"] ssl-rustls-aws-lc-fips = ["ssl-rustls-aws-lc", "rustls/fips"] ssl-openssl = ["ssl", "rustpython-stdlib/ssl-openssl"] ssl-openssl-vendor = ["ssl-openssl", "rustpython-stdlib/ssl-openssl-vendor"] +tkinter = ["rustpython-stdlib/tkinter"] [build-dependencies] winresource = "0.1" @@ -128,7 +129,7 @@ strip = true panic = "abort" [patch.crates-io] -# parking_lot_core = { git = "https://github.com/youknowone/parking_lot", branch = "rustpython" } +parking_lot_core = { git = "https://github.com/youknowone/parking_lot", branch = "rustpython" } # REDOX START, Uncomment when you want to compile/check with redoxer # REDOX END @@ -297,10 +298,12 @@ strum_macros = "0.28" syn = "2" syn-ext = "0.5.0" system-configuration = "0.8.0" +tcl-sys = { git = "https://github.com/arihant2math/tkinter.git", tag = "v0.2.0" } textwrap = { version = "0.16.2", default-features = false } termios = "0.3.3" thiserror = "2.0" thin-vec = "0.2.14" +tk-sys = { git = "https://github.com/arihant2math/tkinter.git", tag = "v0.2.0" } icu_casemap = "2" icu_locale = "2" icu_properties = "2" diff --git a/crates/stdlib/Cargo.toml b/crates/stdlib/Cargo.toml index 26bd045e7..64e926fb6 100644 --- a/crates/stdlib/Cargo.toml +++ b/crates/stdlib/Cargo.toml @@ -22,6 +22,7 @@ ssl = ["rustpython-host_env/ssl"] ssl-rustls = ["__ssl-rustls", "host_env", "rustls/custom-provider"] ssl-openssl = ["ssl", "host_env", "openssl", "openssl-sys", "foreign-types-shared", "rustpython-host_env/native-certs"] ssl-openssl-vendor = ["ssl-openssl", "openssl/vendored"] +tkinter = ["dep:tk-sys", "dep:tcl-sys", "dep:widestring"] flame-it = ["flame"] __ssl-rustls = ["ssl", "rustpython-host_env/ssl", "rustpython-host_env/rustls", "rustpython-host_env/native-certs", "rustls", "rustls-pemfile", "x509-parser", "pem-rfc7468", "webpki-roots"] @@ -70,6 +71,11 @@ constant_time_eq = { workspace = true } # compression adler32 = { workspace = true } +# tkinter +tk-sys = { workspace = true, optional = true } +tcl-sys = { workspace = true, optional = true } +widestring = { workspace = true, optional = true } + # uuid [target.'cfg(not(any(target_os = "ios", target_os = "android", target_os = "windows", target_arch = "wasm32", target_os = "redox")))'.dependencies] uuid = { workspace = true, features = ["v1"] } diff --git a/crates/stdlib/src/lib.rs b/crates/stdlib/src/lib.rs index 0db88f5ff..bc3350231 100644 --- a/crates/stdlib/src/lib.rs +++ b/crates/stdlib/src/lib.rs @@ -181,6 +181,9 @@ mod termios; ))] mod uuid; +#[cfg(all(feature = "host_env", feature = "tkinter"))] +mod tkinter; + use rustpython_common as common; use rustpython_vm as vm; @@ -306,6 +309,8 @@ pub fn stdlib_module_defs(ctx: &Context) -> Vec<&'static builtins::PyModuleDef> not(any(target_os = "ios", target_os = "redox")) ))] termios::module_def(ctx), + #[cfg(all(feature = "host_env", feature = "tkinter"))] + tkinter::module_def(ctx), unicodedata::module_def(ctx), #[cfg(all( feature = "host_env",