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

Strip UNC prefix when setting working directory #1277

Merged
merged 1 commit into from
Feb 12, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

For PEP 517 builds, the current working directory needs to be set to the directory of the source distribution. It turns out that on Windows, if you use a UNC path for the working directory, then relative paths are interpreted relative to the root of the current drive (source). So, when builds attempted to resolve relative paths, they always errored...

This PR ensures that we remove the UNC prefix when setting the current working directory.

Closes #1238.

Test Plan

I tested this on my Windows machine by installing ujson with --no-binary ujson. (I don't want to add that specific test, since it's really slow to build.)

@charliermarsh charliermarsh added bug Something isn't working windows Specific to the Windows platform labels Feb 12, 2024
@@ -6,7 +6,7 @@ use fs_err as fs;
use url::Url;

use pep440_rs::Version;
use puffin_fs::NormalizedDisplay;
use puffin_fs::Normalized;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed this trait.

@@ -771,7 +772,7 @@ async fn run_python_script(
};
Command::new(venv.python_executable())
.args(["-c", script])
.current_dir(source_tree)
.current_dir(source_tree.normalized())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix.

@charliermarsh charliermarsh enabled auto-merge (squash) February 12, 2024 00:50
@charliermarsh charliermarsh merged commit d98b3c3 into main Feb 12, 2024
7 checks passed
@charliermarsh charliermarsh deleted the charlie/unc branch February 12, 2024 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working windows Specific to the Windows platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Puffin can't build ujson on windows due to pip difference
1 participant