uv/crates/uv-virtualenv
Charlie Marsh 2ca39f1a2d
Skip root when assessing prefix viability (#9823)
## Summary

In CPython, it appears that `/` is not considered as a valid path in
`search_up`:

```c
static PyObject *
getpath_dirname(PyObject *Py_UNUSED(self), PyObject *args)
{
    PyObject *path;
    if (!PyArg_ParseTuple(args, "U", &path)) {
        return NULL;
    }
    Py_ssize_t end = PyUnicode_GET_LENGTH(path);
    Py_ssize_t pos = PyUnicode_FindChar(path, SEP, 0, end, -1);
    if (pos < 0) {
        return PyUnicode_FromStringAndSize(NULL, 0);
    }
    return PyUnicode_Substring(path, 0, pos);
}
```

```python
def search_up(prefix, *landmarks, test=isfile):
    while prefix:
        if any(test(joinpath(prefix, f)) for f in landmarks):
            return prefix
        prefix = dirname(prefix)
```

Closes https://github.com/astral-sh/uv/issues/9818.
2024-12-11 14:59:48 -05:00
..
src Skip root when assessing prefix viability (#9823) 2024-12-11 14:59:48 -05:00
Cargo.toml Allow apostrophe in venv name (#8984) 2024-11-15 10:52:10 +01:00
README.md Rename gourgeist to uv-virtualenv (#2118) 2024-03-01 14:02:40 -05:00

uv-virtualenv

uv-virtualenv is a rust library to create Python virtual environments. It also has a CLI.