Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: Build Script for Pixi Executable Fails in Certain Scenarios #8

Open
therealharshit opened this issue Feb 13, 2025 · 0 comments · May be fixed by #9
Open

Issue: Build Script for Pixi Executable Fails in Certain Scenarios #8

therealharshit opened this issue Feb 13, 2025 · 0 comments · May be fixed by #9

Comments

@therealharshit
Copy link
Member

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

  1. Run the script without setting the CARGO_TARGET_DIR environment variable.
  2. Ensure the build process fails or the executable is missing.
  3. Execute the script to copy the nonexistent executable.
  4. 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 if CARGO_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’s logging module for better debugging.
  • Include appropriate logging levels (INFO, ERROR, etc.).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant