Skip to content

Commit

Permalink
make sure setuptools is installed in new venvs after python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
pirate committed Oct 5, 2024
1 parent 5bb4205 commit 819f280
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pydantic_pkgr/binprovider_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def setup(self):
self.pip_venv.parent.mkdir(parents=True, exist_ok=True)

# create new venv in pip_venv if it doesnt exist
if not (self.pip_venv / "bin" / "python").is_file():
venv_pip_path = self.pip_venv / "bin" / "python"
if not venv_pip_path.is_file():
import venv

venv.create(
Expand All @@ -122,6 +123,8 @@ def setup(self):
with_pip=True,
upgrade_deps=True,
)
assert venv_pip_path.is_file(), f'could not find pip inside venv after creating it: {self.pip_venv}'
self.exec(bin_name=venv_pip_path, cmd=["install", "--upgrade", "pip", "setuptools"]) # setuptools is not installed by default after python >= 3.12

def on_install(self, bin_name: str, packages: Optional[InstallArgs] = None, **context) -> str:
if self.pip_venv:
Expand Down

0 comments on commit 819f280

Please sign in to comment.