-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Description
The current Python script (build_and_copy.py
) responsible for building the Pixi executable and copying it to a destination directory has a few issues that may cause failures or unexpected behavior.
Steps to Reproduce
- Run the script without setting the
CARGO_TARGET_DIR
environment variable. - Ensure the build process fails or the executable is missing.
- Execute the script to copy the nonexistent executable.
- Observe the error output.
Expected Behavior
- The script should gracefully handle missing
CARGO_TARGET_DIR
. - If the executable is missing, the script should provide a meaningful error message instead of failing unexpectedly.
- Proper logging should be used instead of
print
statements for better debugging.
Observed Behavior
- The script raises a
KeyError
ifCARGO_TARGET_DIR
is not set. - If the executable is missing, it proceeds to copy, leading to an unhandled
FileNotFoundError
. - No clear logging is in place to debug failures effectively.
Suggested Fixes
1. Handle Missing CARGO_TARGET_DIR
Gracefully
- Before using
CARGO_TARGET_DIR
, check if it exists. - If not set, provide a user-friendly error message.
2. Verify the Executable Exists Before Copying
- Check if the built executable exists at the expected location.
- If missing, exit with a proper error message instead of proceeding.
3. Use Logging Instead of print
Statements
- Replace all
print
statements with Python’slogging
module for better debugging. - Include appropriate logging levels (INFO, ERROR, etc.).
Metadata
Metadata
Assignees
Labels
No labels