-
-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: config setting option for other commands that may build packages (
#2688) * feat: share config settings in installation Signed-off-by: Frost Ming <[email protected]> * feat: add --config-setting option to add/update/remove/lock/sync/install/export comands Signed-off-by: Frost Ming <[email protected]> * add news Signed-off-by: Frost Ming <[email protected]> * tweak the test case Signed-off-by: Frost Ming <[email protected]>
- Loading branch information
Showing
15 changed files
with
165 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add `--config-setting` option to `add/install/sync/update/remove/export` commands, the config settings dictionary will be shared by all packages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
from typing import Any, Mapping | ||
|
||
from pdm.builders.base import EnvBuilder | ||
|
||
|
||
class SdistBuilder(EnvBuilder): | ||
"""Build sdist in isolated env with managed Python.""" | ||
|
||
def build( | ||
self, | ||
out_dir: str, | ||
config_settings: Mapping[str, Any] | None = None, | ||
metadata_directory: str | None = None, | ||
) -> str: | ||
def build(self, out_dir: str, metadata_directory: str | None = None) -> str: | ||
self.install(self._requires, shared=True) | ||
requires = self._hook.get_requires_for_build_sdist(config_settings) | ||
requires = self._hook.get_requires_for_build_sdist(self.config_settings) | ||
self.install(requires) | ||
filename = self._hook.build_sdist(out_dir, config_settings) | ||
filename = self._hook.build_sdist(out_dir, self.config_settings) | ||
return os.path.join(out_dir, filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,23 @@ | ||
from __future__ import annotations | ||
|
||
import os | ||
from typing import Any, Mapping | ||
|
||
from pdm.builders.base import EnvBuilder | ||
|
||
|
||
class WheelBuilder(EnvBuilder): | ||
"""Build wheel in isolated env with managed Python.""" | ||
|
||
def prepare_metadata(self, out_dir: str, config_settings: Mapping[str, Any] | None = None) -> str: | ||
def prepare_metadata(self, out_dir: str) -> str: | ||
self.install(self._requires, shared=True) | ||
requires = self._hook.get_requires_for_build_wheel(config_settings) | ||
requires = self._hook.get_requires_for_build_wheel(self.config_settings) | ||
self.install(requires) | ||
filename = self._hook.prepare_metadata_for_build_wheel(out_dir, config_settings) | ||
filename = self._hook.prepare_metadata_for_build_wheel(out_dir, self.config_settings) | ||
return os.path.join(out_dir, filename) | ||
|
||
def build( | ||
self, | ||
out_dir: str, | ||
config_settings: Mapping[str, Any] | None = None, | ||
metadata_directory: str | None = None, | ||
) -> str: | ||
def build(self, out_dir: str, metadata_directory: str | None = None) -> str: | ||
self.install(self._requires, shared=True) | ||
requires = self._hook.get_requires_for_build_wheel(config_settings) | ||
requires = self._hook.get_requires_for_build_wheel(self.config_settings) | ||
self.install(requires) | ||
filename = self._hook.build_wheel(out_dir, config_settings, metadata_directory) | ||
filename = self._hook.build_wheel(out_dir, self.config_settings, metadata_directory) | ||
return os.path.join(out_dir, filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.