| Crates.io | sifli_sdk_wrapper |
| lib.rs | sifli_sdk_wrapper |
| version | 0.1.1 |
| created_at | 2025-03-15 10:45:59.200516+00 |
| updated_at | 2025-03-15 12:21:29.563939+00 |
| description | sdk.py.exe, wrapper tool to invoke sdk.py on Windows |
| homepage | https://github.com/OpenSiFli/sifli_sdk_wrapper |
| repository | https://github.com/OpenSiFli/sifli_sdk_wrapper |
| max_upload_size | |
| id | 1593464 |
| size | 25,213 |
This project is a lightweight command-line wrapper designed for Windows. It facilitates the execution of a Python script (typically sdk.py) located within the directory specified by the SIFLI_SDK_PATH environment variable. The wrapper forwards command-line parameters, sets up the necessary environment, and manages process signals.
The sdk.py Wrapper primarily performs the following operations:
Environment Variable Reading:
Reads the SIFLI_SDK_PATH environment variable, which should point to the root directory where the tools/sdk.py script is located.
Command Construction:
Constructs the full path to the Python script by joining SIFLI_SDK_PATH with tools/sdk.py and then prepares the command line to invoke python.exe with this script along with any additional command-line arguments provided by the user.
Environment Setup for Subprocess:
Sets an environment variable SIFLI_SDK_PY_PROGRAM_NAME to "sdk.py" before launching the Python subprocess. This can be used by the script for internal configuration or logging purposes.
Signal Handling (Ctrl+C):
Installs a handler using the ctrlc crate to capture the Ctrl+C signal and ignore it in order to prevent the parent process from immediately terminating.
Version Reporting:
If the executable is run with --version or -v (and its name ends with .exe), the program prints the version number (synchronized with the version set in Cargo.toml via CARGO_PKG_VERSION) and exits.
--version or -v:
When provided (and if the executable's name ends with .exe), the wrapper prints its version (from Cargo.toml) and exits immediately.
Additional Arguments:
Any other command-line arguments are passed through to the underlying sdk.py script.
Ensure you have Rust installed (preferably via rustup). Then, execute the following commands:
Build the Project in Release Mode:
cargo build --release
Rename the Executable (Optional):
By default, the binary will be named sdk_py.exe (on Windows) because crate names must follow certain naming rules. If you require the executable to be named sdk.py.exe, you can rename it manually:
cd target\release
ren sdk_py.exe sdk.py.exe
Alternatively, you can automate renaming with a custom build or deployment script.
Before running the executable, make sure the SIFLI_SDK_PATH environment variable is set. For example:
set SIFLI_SDK_PATH=C:\path\to\SiFli-SDK
$env:SIFLI_SDK_PATH="C:\path\to\SiFli-SDK"
After setting up the environment, you can run the wrapper from the command line:
To execute the Python script with additional arguments:
sdk.py.exe --some-argument
To display the version information:
sdk.py.exe --version
This project is licensed under the Apache-2.0. Replace this text with the actual license if applicable.
Contributions, issues, and feature requests are welcome! Please feel free to submit a pull request or open an issue to discuss any changes.