From 80264cc3c25c1f8c23bb5c0ddf8b1cc252cb711a Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:25:20 -0700 Subject: [PATCH 01/13] Update package.py --- src/poetry/core/packages/package.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/poetry/core/packages/package.py b/src/poetry/core/packages/package.py index 3342388e6..1b7bd1e1d 100644 --- a/src/poetry/core/packages/package.py +++ b/src/poetry/core/packages/package.py @@ -23,6 +23,7 @@ from collections.abc import Collection from collections.abc import Iterable from collections.abc import Iterator + from typing import Mapping, Union, Sequence from pathlib import Path from packaging.utils import NormalizedName @@ -69,6 +70,7 @@ def __init__( source_subdirectory: str | None = None, features: Iterable[str] | None = None, develop: bool = False, + config_settings: Mapping[str, Union[str, Sequence[str]]] | None = None, yanked: str | bool = False, ) -> None: """ @@ -132,6 +134,8 @@ def __init__( self.develop = develop + self.config_settings = config_settings + self._yanked = yanked @property From e1f45e0ca8943bd49b449c12cead6062be9745c4 Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:27:59 -0700 Subject: [PATCH 02/13] Update factory.py --- src/poetry/core/factory.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/poetry/core/factory.py b/src/poetry/core/factory.py index a0c84a85b..6d7169183 100644 --- a/src/poetry/core/factory.py +++ b/src/poetry/core/factory.py @@ -280,6 +280,7 @@ def create_dependency( groups=groups, optional=optional, develop=constraint.get("develop", False), + config_settings=constraint.get("config_settings", {}), extras=constraint.get("extras", []), ) elif "file" in constraint: @@ -322,6 +323,7 @@ def create_dependency( optional=optional, base=root_dir, develop=constraint.get("develop", False), + config_settings=constraint.get("config_settings", {}), extras=constraint.get("extras", []), ) elif "url" in constraint: From 311f1dad0f16a6a96bdb7393518b6aa2933f04af Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:31:51 -0700 Subject: [PATCH 03/13] Update poetry-schema.json --- src/poetry/core/json/schemas/poetry-schema.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/poetry/core/json/schemas/poetry-schema.json b/src/poetry/core/json/schemas/poetry-schema.json index b534e3b68..ee2ae1a48 100644 --- a/src/poetry/core/json/schemas/poetry-schema.json +++ b/src/poetry/core/json/schemas/poetry-schema.json @@ -439,6 +439,10 @@ "develop": { "type": "boolean", "description": "Whether to install the dependency in development mode." + }, + "config-settings": { + "type": "object", + "description": "Config-settings passed to the builder when installing." } } }, From 8d4dd6fc9ea0d56f390dbe4ae050314f0ac3d9b9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 14:34:39 +0000 Subject: [PATCH 04/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/poetry/core/packages/package.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/poetry/core/packages/package.py b/src/poetry/core/packages/package.py index 1b7bd1e1d..14934c64b 100644 --- a/src/poetry/core/packages/package.py +++ b/src/poetry/core/packages/package.py @@ -23,8 +23,10 @@ from collections.abc import Collection from collections.abc import Iterable from collections.abc import Iterator - from typing import Mapping, Union, Sequence from pathlib import Path + from typing import Mapping + from typing import Sequence + from typing import Union from packaging.utils import NormalizedName From 415e01c0120033c3769d8452e7f574aa45c8b55b Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:35:15 -0700 Subject: [PATCH 05/13] Update factory.py --- src/poetry/core/factory.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/poetry/core/factory.py b/src/poetry/core/factory.py index 6d7169183..f76576634 100644 --- a/src/poetry/core/factory.py +++ b/src/poetry/core/factory.py @@ -280,7 +280,7 @@ def create_dependency( groups=groups, optional=optional, develop=constraint.get("develop", False), - config_settings=constraint.get("config_settings", {}), + config_settings=constraint.get("config-settings", {}), extras=constraint.get("extras", []), ) elif "file" in constraint: @@ -323,7 +323,7 @@ def create_dependency( optional=optional, base=root_dir, develop=constraint.get("develop", False), - config_settings=constraint.get("config_settings", {}), + config_settings=constraint.get("config-settings", {}), extras=constraint.get("extras", []), ) elif "url" in constraint: From 8068534fb20bfb26a69c4331062c036ac593a1cc Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:36:33 -0700 Subject: [PATCH 06/13] Update package.py --- src/poetry/core/packages/package.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/poetry/core/packages/package.py b/src/poetry/core/packages/package.py index 14934c64b..65d645f1c 100644 --- a/src/poetry/core/packages/package.py +++ b/src/poetry/core/packages/package.py @@ -26,7 +26,6 @@ from pathlib import Path from typing import Mapping from typing import Sequence - from typing import Union from packaging.utils import NormalizedName @@ -72,7 +71,7 @@ def __init__( source_subdirectory: str | None = None, features: Iterable[str] | None = None, develop: bool = False, - config_settings: Mapping[str, Union[str, Sequence[str]]] | None = None, + config_settings: Mapping[str, str | Sequence[str]] | None = None, yanked: str | bool = False, ) -> None: """ From c8af90f4d4305720bb5c693ad437a30f0da50e3f Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:40:49 -0700 Subject: [PATCH 07/13] Update vcs_dependency.py --- src/poetry/core/packages/vcs_dependency.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/poetry/core/packages/vcs_dependency.py b/src/poetry/core/packages/vcs_dependency.py index 38a4e9680..f67a85028 100644 --- a/src/poetry/core/packages/vcs_dependency.py +++ b/src/poetry/core/packages/vcs_dependency.py @@ -27,6 +27,7 @@ def __init__( groups: Iterable[str] | None = None, optional: bool = False, develop: bool = False, + config_settings: Mapping[str, str | Sequence[str]] | None = None, extras: Iterable[str] | None = None, ) -> None: # Attributes must be immutable for clone() to be safe! @@ -38,6 +39,7 @@ def __init__( self._rev = rev self._directory = directory self._develop = develop + self._config_settings = config_settings super().__init__( name, @@ -83,6 +85,10 @@ def directory(self) -> str | None: def develop(self) -> bool: return self._develop + @property + def config_settings(self) -> Mapping[str, str | Sequence[str]] | None: + return self._develop + @property def reference(self) -> str: reference = self._branch or self._tag or self._rev or "" From 59791bb709923474343da7f012813078f165fc92 Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:43:12 -0700 Subject: [PATCH 08/13] Update directory_dependency.py --- src/poetry/core/packages/directory_dependency.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/poetry/core/packages/directory_dependency.py b/src/poetry/core/packages/directory_dependency.py index ffa45c2c8..4c5e217a6 100644 --- a/src/poetry/core/packages/directory_dependency.py +++ b/src/poetry/core/packages/directory_dependency.py @@ -12,6 +12,7 @@ if TYPE_CHECKING: from collections.abc import Iterable from pathlib import Path + from typing import Mapping, Sequence class DirectoryDependency(PathDependency): @@ -23,6 +24,7 @@ def __init__( optional: bool = False, base: Path | None = None, develop: bool = False, + config_settings: Mapping[str, str | Sequence[str]] | None = None, extras: Iterable[str] | None = None, ) -> None: super().__init__( @@ -37,6 +39,7 @@ def __init__( # Attributes must be immutable for clone() to be safe! # (For performance reasons, clone only creates a copy instead of a deep copy). self._develop = develop + self._config_settings = config_settings # cache this function to avoid multiple IO reads and parsing self.supports_poetry = functools.lru_cache(maxsize=1)(self._supports_poetry) @@ -45,6 +48,10 @@ def __init__( def develop(self) -> bool: return self._develop + @property + def config_settings(self) -> Mapping[str, str | Sequence[str]] | None = None: + return self._develop + def _validate(self) -> str: message = super()._validate() if message: From 8278bf213e78429cd44c280d153f48b6c21875ce Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:43:36 -0700 Subject: [PATCH 09/13] Update vcs_dependency.py --- src/poetry/core/packages/vcs_dependency.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/poetry/core/packages/vcs_dependency.py b/src/poetry/core/packages/vcs_dependency.py index f67a85028..f00a23de8 100644 --- a/src/poetry/core/packages/vcs_dependency.py +++ b/src/poetry/core/packages/vcs_dependency.py @@ -7,6 +7,7 @@ if TYPE_CHECKING: from collections.abc import Iterable + from typing import Mapping, Sequence class VCSDependency(Dependency): From 8e68054269432c3358e592c2281d1e6ce7b39155 Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:44:42 -0700 Subject: [PATCH 10/13] Update directory_dependency.py --- src/poetry/core/packages/directory_dependency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/poetry/core/packages/directory_dependency.py b/src/poetry/core/packages/directory_dependency.py index 4c5e217a6..56d1d84ba 100644 --- a/src/poetry/core/packages/directory_dependency.py +++ b/src/poetry/core/packages/directory_dependency.py @@ -49,7 +49,7 @@ def develop(self) -> bool: return self._develop @property - def config_settings(self) -> Mapping[str, str | Sequence[str]] | None = None: + def config_settings(self) -> Mapping[str, str | Sequence[str]] | None: return self._develop def _validate(self) -> str: From 9a03f06d6c117899c0ef26557c84605d11a337a3 Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:46:05 -0700 Subject: [PATCH 11/13] Update vcs_dependency.py --- src/poetry/core/packages/vcs_dependency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/poetry/core/packages/vcs_dependency.py b/src/poetry/core/packages/vcs_dependency.py index f00a23de8..721688e52 100644 --- a/src/poetry/core/packages/vcs_dependency.py +++ b/src/poetry/core/packages/vcs_dependency.py @@ -88,7 +88,7 @@ def develop(self) -> bool: @property def config_settings(self) -> Mapping[str, str | Sequence[str]] | None: - return self._develop + return self._config_settings @property def reference(self) -> str: From 840e0e7b40f7b964acdbcab62f9c4e1193ceec0e Mon Sep 17 00:00:00 2001 From: earonesty Date: Wed, 27 Mar 2024 07:46:37 -0700 Subject: [PATCH 12/13] Update directory_dependency.py --- src/poetry/core/packages/directory_dependency.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/poetry/core/packages/directory_dependency.py b/src/poetry/core/packages/directory_dependency.py index 56d1d84ba..e0cc82cd6 100644 --- a/src/poetry/core/packages/directory_dependency.py +++ b/src/poetry/core/packages/directory_dependency.py @@ -50,7 +50,7 @@ def develop(self) -> bool: @property def config_settings(self) -> Mapping[str, str | Sequence[str]] | None: - return self._develop + return self._config_settings def _validate(self) -> str: message = super()._validate() From c816c2330032542192ea47c9818810308dafafb5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 14:47:19 +0000 Subject: [PATCH 13/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/poetry/core/packages/directory_dependency.py | 3 ++- src/poetry/core/packages/vcs_dependency.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/poetry/core/packages/directory_dependency.py b/src/poetry/core/packages/directory_dependency.py index e0cc82cd6..ff74adb68 100644 --- a/src/poetry/core/packages/directory_dependency.py +++ b/src/poetry/core/packages/directory_dependency.py @@ -12,7 +12,8 @@ if TYPE_CHECKING: from collections.abc import Iterable from pathlib import Path - from typing import Mapping, Sequence + from typing import Mapping + from typing import Sequence class DirectoryDependency(PathDependency): diff --git a/src/poetry/core/packages/vcs_dependency.py b/src/poetry/core/packages/vcs_dependency.py index 721688e52..409e7e391 100644 --- a/src/poetry/core/packages/vcs_dependency.py +++ b/src/poetry/core/packages/vcs_dependency.py @@ -7,7 +7,8 @@ if TYPE_CHECKING: from collections.abc import Iterable - from typing import Mapping, Sequence + from typing import Mapping + from typing import Sequence class VCSDependency(Dependency):