-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Error when a project.license-files glob matches nothing
#16697
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
Conversation
|
|
||
| let license_glob_matchers = license_globs_parsed | ||
| .iter() | ||
| .map(Glob::compile_matcher) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't we using PortableGlobParser::Pep639 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Each one of those globs went through the PEP 639 parser, we're just calling compile_matcher on them here.
| if let Some(pattern) = license_glob_patterns | ||
| .iter() | ||
| .zip(license_globs_matched.iter()) | ||
| .find_map(|(pattern, matched)| (!matched).then_some(pattern)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Just filter is simpler than then_some
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I broke this out into separate find and map calls to make this more clear, using filter here doesn't make sense to me 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to map explicitly, you can use a Some((_, pattern)) pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, just tweaked this
I noticed this when working on #16697. [PEP 639](https://peps.python.org/pep-0639/#add-license-files-key) expects tools to ship license texts as UTF‑8, but previously `uv build` would quietly include any binary blob listed under `project.license-files`. I have no clue what is going on with `rustfmt` for this file, but it seems that when I add the check, it wants to reformat a bunch of surrounding stuff. The relevant part to look at is: ```rust for license_file in &license_files { let file_path = root.join(license_file); let bytes = fs_err::read(&file_path)?; if str::from_utf8(&bytes).is_err() { return Err(ValidationError::LicenseFileNotUtf8(license_file.clone()).into()); } } ``` where we validate all collected license files before proceeding. --------- Co-authored-by: konstin <konstin@mailbox.org>
project.license-files globs match nothingproject.license-files glob matches nothing
konstin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.9` -> `0.9.10` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>astral-sh/uv (astral-sh/uv)</summary> ### [`v0.9.10`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0910) [Compare Source](astral-sh/uv@0.9.9...0.9.10) Released on 2025-11-17. ##### Enhancements - Add support for `SSL_CERT_DIR` ([#​16473](astral-sh/uv#16473)) - Enforce UTF‑8-encoded license files during `uv build` ([#​16699](astral-sh/uv#16699)) - Error when a `project.license-files` glob matches nothing ([#​16697](astral-sh/uv#16697)) - `pip install --target` (and `sync`) install Python if necessary ([#​16694](astral-sh/uv#16694)) - Account for `python_downloads_json_url` in pre-release Python version warnings ([#​16737](astral-sh/uv#16737)) - Support HTTP/HTTPS URLs in `uv python --python-downloads-json-url` ([#​16542](astral-sh/uv#16542)) ##### Preview features - Add support for `--upgrade` in `uv python install` ([#​16676](astral-sh/uv#16676)) - Fix handling of `python install --default` for pre-release Python versions ([#​16706](astral-sh/uv#16706)) - Add `uv workspace list` to list workspace members ([#​16691](astral-sh/uv#16691)) ##### Bug fixes - Don't check file URLs for ambiguously parsed credentials ([#​16759](astral-sh/uv#16759)) ##### Documentation - Add a "storage" reference document ([#​15954](astral-sh/uv#15954)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNzMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE3My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Resolves #16693
PEP 639requires build tools to error if any user-specifiedproject.license-filesglob fails to match a file, but uv currently allows the build to succeed and produces empty.dist-info/licenses/directories.This PR enforces the spec by tracking matches for each glob during metadata generation, raising a clear
validation error when one is unmatched.