Skip to content

Build error in rustpython-pylib: py_freeze! macro resolves wrong Lib path #7995

@alok-108

Description

@alok-108

Bug Description

The workspace fails to build on Windows (and possibly other platforms) due to a path error in crates/pylib/src/lib.rs. The py_freeze! macro is invoked with dir = "../Lib", but since the pylib crate is inside crates/pylib/, this resolves to crates/Lib instead of the repository root's Lib/ directory. This causes the build to fail for the entire workspace.

Steps to Reproduce

  1. Clone the repository on a Windows machine (or any machine where relative path resolution matters).
  2. Run cargo build --workspace (or cargo build -p rustpython-pylib).
  3. Observe the build error related to the py_freeze! macro not finding the Lib directory.

Expected Behavior

The py_freeze! macro should correctly find the Lib/ directory at the repository root, and the build should succeed.

Actual Behavior

Build fails with an error indicating that the directory ../Lib cannot be found or is empty.

Environment

  • OS: Windows (also likely affects other OSes depending on Cargo's working directory)
  • Rust version: (output of rustc --version)
  • RustPython commit: (latest main at the time of reporting)

Possible Solution

Change the path in crates/pylib/src/lib.rs from "../Lib" to "../../Lib" so that it correctly points to the root Lib/ directory. Alternatively, use CARGO_MANIFEST_DIR to construct an absolute path.

Additional Context

This issue was discovered while running a full workspace build on Windows. All other crates reference Lib/ correctly; only pylib seems to have this broken relative path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions