python-poetry/python-poetry-1.6.1-python-build-1.0.3.patch

99 lines
3.2 KiB
Diff
Raw Permalink Normal View History

From a16863d1a448ff91a7cc4e48042d3a8669b78b34 Mon Sep 17 00:00:00 2001
From: David Hotham <david.hotham@blueyonder.co.uk>
Date: Fri, 8 Sep 2023 10:27:09 +0100
Subject: [PATCH] Support build 1.0 (#8400)
---
poetry.lock | 25 ++++++++++++++++++-------
pyproject.toml | 2 +-
src/poetry/inspection/info.py | 9 ++++-----
src/poetry/installation/chef.py | 19 +++++++++++++------
4 files changed, 36 insertions(+), 19 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 8f5db44f8a7..73e31be5de7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -34,7 +34,7 @@ python = "^3.8"
poetry-core = "1.7.0"
poetry-plugin-export = "^1.5.0"
-build = "^0.10.0"
+build = "^1.0.3"
cachecontrol = { version = "^0.13.0", extras = ["filecache"] }
cleo = "^2.0.0"
crashtest = "^0.4.1"
diff --git a/src/poetry/inspection/info.py b/src/poetry/inspection/info.py
index d1461d4ed76..e45046dceea 100644
--- a/src/poetry/inspection/info.py
+++ b/src/poetry/inspection/info.py
@@ -46,11 +46,10 @@
source = '{source}'
dest = '{dest}'
-with build.env.IsolatedEnvBuilder() as env:
+with build.env.DefaultIsolatedEnv() as env:
builder = build.ProjectBuilder(
- srcdir=source,
- scripts_dir=env.scripts_dir,
- python_executable=env.executable,
+ source_dir=source,
+ python_executable=env.python_executable,
runner=pyproject_hooks.quiet_subprocess_runner,
)
env.install(builder.build_system_requires)
@@ -58,7 +57,7 @@
builder.metadata_path(dest)
"""
-PEP517_META_BUILD_DEPS = ["build==0.10.0", "pyproject_hooks==1.0.0"]
+PEP517_META_BUILD_DEPS = ["build==1.0.3", "pyproject_hooks==1.0.0"]
class PackageInfoError(ValueError):
diff --git a/src/poetry/installation/chef.py b/src/poetry/installation/chef.py
index da8679df21f..bcbb77d5ba1 100644
--- a/src/poetry/installation/chef.py
+++ b/src/poetry/installation/chef.py
@@ -1,5 +1,6 @@
from __future__ import annotations
+import os
import tarfile
import tempfile
import zipfile
@@ -43,12 +44,19 @@ def __init__(self, env: Env, pool: RepositoryPool) -> None:
self._pool = pool
@property
- def executable(self) -> str:
+ def python_executable(self) -> str:
return str(self._env.python)
- @property
- def scripts_dir(self) -> str:
- return str(self._env._bin_dir)
+ def make_extra_environ(self) -> dict[str, str]:
+ path = os.environ.get("PATH")
+ scripts_dir = str(self._env._bin_dir)
+ return {
+ "PATH": (
+ os.pathsep.join([scripts_dir, path])
+ if path is not None
+ else scripts_dir
+ )
+ }
def install(self, requirements: Collection[str]) -> None:
from cleo.io.null_io import NullIO
@@ -109,8 +117,7 @@ def _prepare(
env = IsolatedEnv(venv, self._pool)
builder = ProjectBuilder(
directory,
- python_executable=env.executable,
- scripts_dir=env.scripts_dir,
+ python_executable=env.python_executable,
runner=quiet_subprocess_runner,
)
env.install(builder.build_system_requires)