mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-31 20:09:09 +00:00
Treat non-existent site-packages as empty (#2413)
## Summary It turns out this doesn't need to exist until something has been installed into it. See, e.g., https://github.com/astral-sh/uv/pull/2402. Closes https://github.com/astral-sh/uv/issues/2404.
This commit is contained in:
parent
bfddd729b7
commit
cca9de13e2
5 changed files with 47 additions and 7 deletions
29
.github/workflows/ci.yml
vendored
29
.github/workflows/ci.yml
vendored
|
|
@ -480,3 +480,32 @@ jobs:
|
|||
- name: "Validate global Python install"
|
||||
shell: bash -el {0}
|
||||
run: python ./scripts/check_system_python.py --uv ./uv
|
||||
|
||||
system-test-amazonlinux:
|
||||
needs: build-binary-linux
|
||||
name: "check system | amazonlinux"
|
||||
runs-on: ubuntu-latest
|
||||
container: amazonlinux:2023
|
||||
steps:
|
||||
- name: "Install base requirements"
|
||||
run: |
|
||||
# Needed for `actions/checkout`
|
||||
yum install tar gzip which -y
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: "Install Python"
|
||||
run: yum install python3 python3-pip -y
|
||||
|
||||
- name: "Download binary"
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: uv-linux-${{ github.sha }}
|
||||
|
||||
- name: "Prepare binary"
|
||||
run: chmod +x ./uv
|
||||
|
||||
- name: "Print Python path"
|
||||
run: echo $(which python3)
|
||||
|
||||
- name: "Validate global Python install"
|
||||
run: python3 scripts/check_system_python.py --uv ./uv
|
||||
|
|
|
|||
|
|
@ -182,8 +182,7 @@ impl<'a> BuildContext for BuildDispatch<'a> {
|
|||
let tags = self.interpreter.tags()?;
|
||||
|
||||
// Determine the set of installed packages.
|
||||
let site_packages =
|
||||
SitePackages::from_executable(venv).context("Failed to list installed packages")?;
|
||||
let site_packages = SitePackages::from_executable(venv)?;
|
||||
|
||||
let Plan {
|
||||
local,
|
||||
|
|
|
|||
|
|
@ -42,8 +42,22 @@ impl<'a> SitePackages<'a> {
|
|||
let mut by_name = FxHashMap::default();
|
||||
let mut by_url = FxHashMap::default();
|
||||
|
||||
// Read the site-packages directory.
|
||||
let site_packages = match fs::read_dir(venv.site_packages()) {
|
||||
Ok(site_packages) => site_packages,
|
||||
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {
|
||||
return Ok(Self {
|
||||
venv,
|
||||
distributions,
|
||||
by_name,
|
||||
by_url,
|
||||
});
|
||||
}
|
||||
Err(err) => return Err(err).context("Failed to read site-packages directory"),
|
||||
};
|
||||
|
||||
// Index all installed packages by name.
|
||||
for entry in fs::read_dir(venv.site_packages())? {
|
||||
for entry in site_packages {
|
||||
let entry = entry?;
|
||||
if entry.file_type()?.is_dir() {
|
||||
let path = entry.path();
|
||||
|
|
|
|||
|
|
@ -143,8 +143,7 @@ pub(crate) async fn pip_install(
|
|||
let _lock = venv.lock()?;
|
||||
|
||||
// Determine the set of installed packages.
|
||||
let site_packages =
|
||||
SitePackages::from_executable(&venv).context("Failed to list installed packages")?;
|
||||
let site_packages = SitePackages::from_executable(&venv)?;
|
||||
|
||||
// If the requirements are already satisfied, we're done. Ideally, the resolver would be fast
|
||||
// enough to let us remove this check. But right now, for large environments, it's an order of
|
||||
|
|
|
|||
|
|
@ -157,8 +157,7 @@ pub(crate) async fn pip_sync(
|
|||
);
|
||||
|
||||
// Determine the set of installed packages.
|
||||
let site_packages =
|
||||
SitePackages::from_executable(&venv).context("Failed to list installed packages")?;
|
||||
let site_packages = SitePackages::from_executable(&venv)?;
|
||||
|
||||
// Resolve any editables.
|
||||
let resolved_editables = resolve_editables(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue