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

uv build builds into a top-level dist dir in workspaces #7813

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/uv/src/commands/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,13 @@ async fn build_package(
let output_dir = if let Some(output_dir) = output_dir {
Cow::Owned(std::path::absolute(output_dir)?)
} else {
match &source.source {
Source::Directory(src) => Cow::Owned(src.join("dist")),
Source::File(src) => Cow::Borrowed(src.parent().unwrap()),
if let Ok(workspace) = workspace {
Cow::Owned(workspace.install_path().join("dist"))
} else {
match &source.source {
Source::Directory(src) => Cow::Owned(src.join("dist")),
Source::File(src) => Cow::Borrowed(src.parent().unwrap()),
}
}
};

Expand Down
26 changes: 13 additions & 13 deletions crates/uv/tests/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,21 +1041,21 @@ fn workspace() -> Result<()> {
Copying src/member.egg-info to build/bdist.linux-x86_64/wheel/member-0.1.0-py3.12.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/member-0.1.0.dist-info/WHEEL
creating '[TEMP_DIR]/project/packages/member/dist/[TMP]/wheel' to it
creating '[TEMP_DIR]/project/dist/[TMP]/wheel' to it
adding '__init__.py'
adding 'member-0.1.0.dist-info/METADATA'
adding 'member-0.1.0.dist-info/WHEEL'
adding 'member-0.1.0.dist-info/top_level.txt'
adding 'member-0.1.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built packages/member/dist/member-0.1.0.tar.gz and packages/member/dist/member-0.1.0-py3-none-any.whl
Successfully built dist/member-0.1.0.tar.gz and dist/member-0.1.0-py3-none-any.whl
"###);

member
project
.child("dist")
.child("member-0.1.0.tar.gz")
.assert(predicate::path::is_file());
member
project
.child("dist")
.child("member-0.1.0-py3-none-any.whl")
.assert(predicate::path::is_file());
Expand All @@ -1071,15 +1071,15 @@ fn workspace() -> Result<()> {
[PKG] Building source distribution...
[PKG] Building wheel from source distribution...
[PKG] Building wheel from source distribution...
Successfully built packages/member/dist/member-0.1.0.tar.gz and packages/member/dist/member-0.1.0-py3-none-any.whl
Successfully built dist/member-0.1.0.tar.gz and dist/member-0.1.0-py3-none-any.whl
Successfully built dist/project-0.1.0.tar.gz and dist/project-0.1.0-py3-none-any.whl
"###);

member
project
.child("dist")
.child("member-0.1.0.tar.gz")
.assert(predicate::path::is_file());
member
project
.child("dist")
.child("member-0.1.0-py3-none-any.whl")
.assert(predicate::path::is_file());
Expand Down Expand Up @@ -1163,14 +1163,14 @@ fn workspace() -> Result<()> {
Copying src/member.egg-info to build/bdist.linux-x86_64/wheel/member-0.1.0-py3.12.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/member-0.1.0.dist-info/WHEEL
creating '[TEMP_DIR]/project/packages/member/dist/[TMP]/wheel' to it
creating '[TEMP_DIR]/project/dist/[TMP]/wheel' to it
adding '__init__.py'
adding 'member-0.1.0.dist-info/METADATA'
adding 'member-0.1.0.dist-info/WHEEL'
adding 'member-0.1.0.dist-info/top_level.txt'
adding 'member-0.1.0.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built project/packages/member/dist/member-0.1.0.tar.gz and project/packages/member/dist/member-0.1.0-py3-none-any.whl
Successfully built project/dist/member-0.1.0.tar.gz and project/dist/member-0.1.0-py3-none-any.whl
"###);

// If a source is provided, discover the workspace from the source.
Expand All @@ -1184,7 +1184,7 @@ fn workspace() -> Result<()> {
[PKG] Building source distribution...
[PKG] Building wheel from source distribution...
[PKG] Building wheel from source distribution...
Successfully built project/packages/member/dist/member-0.1.0.tar.gz and project/packages/member/dist/member-0.1.0-py3-none-any.whl
Successfully built project/dist/member-0.1.0.tar.gz and project/dist/member-0.1.0-py3-none-any.whl
Successfully built project/dist/project-0.1.0.tar.gz and project/dist/project-0.1.0-py3-none-any.whl
"###);

Expand Down Expand Up @@ -1327,7 +1327,7 @@ fn build_all_with_failure() -> Result<()> {
[PKG] Building source distribution...
[PKG] Building wheel from source distribution...
[PKG] Building wheel from source distribution...
Successfully built packages/member_a/dist/member_a-0.1.0.tar.gz and packages/member_a/dist/member_a-0.1.0-py3-none-any.whl
Successfully built dist/member_a-0.1.0.tar.gz and dist/member_a-0.1.0-py3-none-any.whl
[PKG] error: Build backend failed to determine extra requires with `build_sdist()` with exit status: 1
Successfully built dist/project-0.1.0.tar.gz and dist/project-0.1.0-py3-none-any.whl
"###);
Expand All @@ -1342,11 +1342,11 @@ fn build_all_with_failure() -> Result<()> {
.child("project-0.1.0-py3-none-any.whl")
.assert(predicate::path::is_file());

member_a
project
.child("dist")
.child("member_a-0.1.0.tar.gz")
.assert(predicate::path::is_file());
member_a
project
.child("dist")
.child("member_a-0.1.0-py3-none-any.whl")
.assert(predicate::path::is_file());
Expand Down
Loading