Skip to content

Commit

Permalink
Remove dependency on pip-run.
Browse files Browse the repository at this point in the history
The dependency chain of `pip-run` includes `pydantic-core`.
The problem is that newer versions `pydantic-core` are written in Rust
and don't have pre-compiled wheels available for all platforms (e.g.
freebsd). It might be the case it is not even currently possible to
compile it to some platforms due to the lack of availability of the
toolchain (seems to be the problem with cygwin).

See `jaraco/inflect#195` and `pydantic/pydantic-core#773`.
  • Loading branch information
abravalheri committed Jul 17, 2023
1 parent 6083e18 commit 2cd3450
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ testing =
jaraco.path>=3.2.0
build[virtualenv]
filelock>=3.4.0
pip_run>=8.8
ini2toml[lite]>=0.9
tomli-w>=1.0.0
pytest-timeout
Expand Down
13 changes: 11 additions & 2 deletions setuptools/tests/test_editable_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import jaraco.envs
import jaraco.path
import pip_run.launch
import pytest
from path import Path as _Path

Expand Down Expand Up @@ -379,7 +378,7 @@ def test_editable_with_prefix(tmp_path, sample_project, editable_opts):
site_packages.mkdir(parents=True)

# install workaround
pip_run.launch.inject_sitecustomize(site_packages)
_addsitedir(site_packages)

env = dict(os.environ, PYTHONPATH=str(site_packages))
cmd = [
Expand Down Expand Up @@ -1038,6 +1037,16 @@ def install_project(name, venv, tmp_path, files, *opts):
return project, out


def _addsitedir(new_dir: Path):
"""To use this function, it is necessary to insert new_dir in front of sys.path.
The Python process will try to import a ``sitecustomize`` module on startup.
If we manipulate sys.path/PYTHONPATH, we can force it to run our code,
which invokes ``addsitedir`` and ensure ``.pth`` files are loaded.
"""
file = f"import site; site.addsitedir({os.fspath(new_dir)!r})\n"
(new_dir / "sitecustomize.py").write_text(file, encoding="utf-8")


# ---- Assertion Helpers ----


Expand Down

0 comments on commit 2cd3450

Please sign in to comment.