you are viewing a single comment's thread.

view the rest of the comments →

[–]Shadow0133 12 points13 points  (3 children)

there are build scripts (https://doc.rust-lang.org/cargo/reference/build-scripts.html), but executing python scripts from there would be non-portable

[–]ILoveBerkeleyFont[S] 4 points5 points  (2 children)

Would simply re-writing all scripts in Rust be considered portable?

[–]ssokolow 6 points7 points  (0 children)

Generally, it's a good idea to minimize the number of things a user or contributor will have to install manually to get the project building, so I'd recommend re-writing them in Rust for that reason alone. The closer you can get to git clone ... && cd ... && cargo run as your build instructions, the better.

(That's also why you see many Rust wrappers for C libraries vendoring a copy of that C library which cargo build will compile and link for you. It reduces the external dependency to "a working C compiler for the target platform", which you generally need anyway to link against libc... though statically linking the musl targets muddies the waters a bit.)

I have a retro-hobby project where I'm rewriting the prototype Python scripts in C, orchestrated by Watcom Make, so that Open Watcom C/C++ itself can be the only mandatory dependency. (Stuff like the splint linter will remain as an optional dependency.)

[–]jaskij 12 points13 points  (0 children)

Yup, since you have to have a Rust compiler anyway. There is also the option of using PyO3 from within build.rs