mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-29 03:02:55 +00:00
build-backend: Allow overriding module names for editable builds (#12137)
## Summary This PR enables module name overrides for editable installs. Builds upon https://github.com/astral-sh/uv/pull/11884. The `tool.uv.build-backend.module-name` option is now respected during editable build processes. ## Test Plan Added a test. --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
parent
897508aeb0
commit
f2ff218621
2 changed files with 74 additions and 1 deletions
|
|
@ -282,7 +282,17 @@ pub fn build_editable(
|
|||
return Err(Error::AbsoluteModuleRoot(settings.module_root.clone()));
|
||||
}
|
||||
let src_root = source_tree.join(settings.module_root);
|
||||
let module_root = src_root.join(pyproject_toml.name().as_dist_info_name().as_ref());
|
||||
|
||||
let module_name = if let Some(module_name) = settings.module_name {
|
||||
module_name
|
||||
} else {
|
||||
// Should never error, the rules for package names (in dist-info formatting) are stricter
|
||||
// than those for identifiers
|
||||
Identifier::from_str(pyproject_toml.name().as_dist_info_name().as_ref())?
|
||||
};
|
||||
debug!("Module name: `{:?}`", module_name);
|
||||
|
||||
let module_root = src_root.join(module_name.as_ref());
|
||||
if !module_root.join("__init__.py").is_file() {
|
||||
return Err(Error::MissingModule(module_root));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue