License file being deleted in Cargo workspace
Bug Description
Maturin v1.9.0 introduced a new license handling mechanism in #2571
This caused our workspace to be impossible to build now, as the tool now deletes our license file and then fails due to lack of license file.
💥 maturin failed
Caused by: Failed to read C:\fake-workspace-path\host\..\LICENSE
Caused by: failed to open file `C:\fake-workspace-path\host\..\LICENSE`: The system cannot find the file specified. (os error 2)
I tried working around it by manually setting the path in pyproject.toml, but this also fails, because parent directory operator .. is not allowed.
Your maturin version (maturin --version)
1.9.0
Your Python version (python -V)
3.11.10
Your pip version (pip -V)
23.0.1
What bindings you're using
pyo3
Does cargo build work?
- [ ] Yes, it works
If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?
- [x] Yes
Steps to Reproduce
- Create a cargo workspace with a crate that uses maturin
- Create a LICENSE file in the root folder and specify it in the root Cargo.toml
- In the crate Cargo.toml, use
license-file.workspace = true - Try executing
maturin develop
Sorry I'm not sure what you meant by deleted, #2571 is not merged, the change in #2647 does not delete anything.
Please create a minimal repro in a public git repository, otherwise it's going to take more time for this to be resolved.
@messense sorry, my bad. I linked the wrong issue. Here is the minimal repo: https://github.com/krokosik/maturin-2664
I'm unable to reproduce this on macOS.
maturin-2664/host on main is 📦 v0.1.5 via 🐍 v3.13.5 via 🦀 v1.87.0
❯ uv run maturin develop
Uninstalled 1 package in 1ms
Installed 1 package in 2ms
🔗 Found pyo3 bindings with abi3 support
🐍 Not using a specific python interpreter
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
📦 Built wheel for abi3 Python ≥ 3.9 to /var/folders/wv/3487fygn67qfcw9j29b2gyyh0000gn/T/.tmpl5wjb8/rustpill_clients-0.1.5-cp39-abi3-macosx_11_0_arm64.whl
✏️ Setting installed package as editable
🛠 Installed rustpill_clients-0.1.5
maturin-2664/host on main is 📦 v0.1.5 via 🐍 v3.13.5 via 🦀 v1.87.0
❯ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
maturin-2664/host on main is 📦 v0.1.5 via 🐍 v3.13.5 via 🦀 v1.87.0
❯ file ../LICENSE
../LICENSE: ASCII text
I don't own a Windows machine, maybe you can try maturin generate-ci and try to repro it on github actions?
I'm on it, curiously maturin build does not delete the LICENSE even on my PC
Okay, the CI is ready. Do you want access to the repo?
I think we might be running into something similar in our conda-forge builds for ruff, if it helps: https://github.com/conda-forge/ruff-feedstock/runs/45139246899. Only the Windows build is failing.
Yeah, in the repro repo, the Linux runner passes, so it's only Windows
what happens if you do a maturin develop first, restore the deleted license file then run maturin develop --skip-install so it does not call uv pip/pip again? This could isolate the issue to maturin or uv pip/pip.
Woops, I missed this response. Problem is I switched my dev workspace to Linux in the meantime 😓