mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Add support for config_settings
in PEP 517 hooks (#1833)
## Summary Adds `--config-setting` / `-C` (with a `--config-settings` alias for convenience) to the CLI. Closes https://github.com/astral-sh/uv/issues/1460.
This commit is contained in:
parent
1103298e6c
commit
aa73a4f0ea
19 changed files with 392 additions and 35 deletions
|
@ -14,7 +14,7 @@ use uv_dispatch::BuildDispatch;
|
|||
use uv_installer::NoBinary;
|
||||
use uv_interpreter::Virtualenv;
|
||||
use uv_resolver::InMemoryIndex;
|
||||
use uv_traits::{BuildContext, BuildKind, InFlight, NoBuild, SetupPyStrategy};
|
||||
use uv_traits::{BuildContext, BuildKind, ConfigSettings, InFlight, NoBuild, SetupPyStrategy};
|
||||
|
||||
#[derive(Parser)]
|
||||
pub(crate) struct BuildArgs {
|
||||
|
@ -61,6 +61,7 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
|
|||
let index = InMemoryIndex::default();
|
||||
let setup_py = SetupPyStrategy::default();
|
||||
let in_flight = InFlight::default();
|
||||
let config_settings = ConfigSettings::default();
|
||||
|
||||
let build_dispatch = BuildDispatch::new(
|
||||
&client,
|
||||
|
@ -72,6 +73,7 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
|
|||
&in_flight,
|
||||
venv.python_executable(),
|
||||
setup_py,
|
||||
&config_settings,
|
||||
&NoBuild::None,
|
||||
&NoBinary::None,
|
||||
);
|
||||
|
@ -84,6 +86,7 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
|
|||
SourceBuildContext::default(),
|
||||
args.sdist.display().to_string(),
|
||||
setup_py,
|
||||
config_settings.clone(),
|
||||
build_kind,
|
||||
)
|
||||
.await?;
|
||||
|
|
|
@ -25,7 +25,7 @@ use uv_installer::{Downloader, NoBinary};
|
|||
use uv_interpreter::Virtualenv;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_resolver::{DistFinder, InMemoryIndex};
|
||||
use uv_traits::{BuildContext, InFlight, NoBuild, SetupPyStrategy};
|
||||
use uv_traits::{BuildContext, ConfigSettings, InFlight, NoBuild, SetupPyStrategy};
|
||||
|
||||
#[derive(Parser)]
|
||||
pub(crate) struct InstallManyArgs {
|
||||
|
@ -65,12 +65,12 @@ pub(crate) async fn install_many(args: InstallManyArgs) -> Result<()> {
|
|||
let setup_py = SetupPyStrategy::default();
|
||||
let in_flight = InFlight::default();
|
||||
let tags = venv.interpreter().tags()?;
|
||||
|
||||
let no_build = if args.no_build {
|
||||
NoBuild::All
|
||||
} else {
|
||||
NoBuild::None
|
||||
};
|
||||
let config_settings = ConfigSettings::default();
|
||||
|
||||
let build_dispatch = BuildDispatch::new(
|
||||
&client,
|
||||
|
@ -82,6 +82,7 @@ pub(crate) async fn install_many(args: InstallManyArgs) -> Result<()> {
|
|||
&in_flight,
|
||||
venv.python_executable(),
|
||||
setup_py,
|
||||
&config_settings,
|
||||
&no_build,
|
||||
&NoBinary::None,
|
||||
);
|
||||
|
|
|
@ -18,7 +18,7 @@ use uv_dispatch::BuildDispatch;
|
|||
use uv_installer::NoBinary;
|
||||
use uv_interpreter::Virtualenv;
|
||||
use uv_resolver::{InMemoryIndex, Manifest, Options, Resolver};
|
||||
use uv_traits::{InFlight, NoBuild, SetupPyStrategy};
|
||||
use uv_traits::{ConfigSettings, InFlight, NoBuild, SetupPyStrategy};
|
||||
|
||||
#[derive(ValueEnum, Default, Clone)]
|
||||
pub(crate) enum ResolveCliFormat {
|
||||
|
@ -72,12 +72,12 @@ pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> Result<()> {
|
|||
};
|
||||
let index = InMemoryIndex::default();
|
||||
let in_flight = InFlight::default();
|
||||
|
||||
let no_build = if args.no_build {
|
||||
NoBuild::All
|
||||
} else {
|
||||
NoBuild::None
|
||||
};
|
||||
let config_settings = ConfigSettings::default();
|
||||
|
||||
let build_dispatch = BuildDispatch::new(
|
||||
&client,
|
||||
|
@ -89,6 +89,7 @@ pub(crate) async fn resolve_cli(args: ResolveCliArgs) -> Result<()> {
|
|||
&in_flight,
|
||||
venv.python_executable(),
|
||||
SetupPyStrategy::default(),
|
||||
&config_settings,
|
||||
&no_build,
|
||||
&NoBinary::None,
|
||||
);
|
||||
|
|
|
@ -21,7 +21,7 @@ use uv_installer::NoBinary;
|
|||
use uv_interpreter::Virtualenv;
|
||||
use uv_normalize::PackageName;
|
||||
use uv_resolver::InMemoryIndex;
|
||||
use uv_traits::{BuildContext, InFlight, NoBuild, SetupPyStrategy};
|
||||
use uv_traits::{BuildContext, ConfigSettings, InFlight, NoBuild, SetupPyStrategy};
|
||||
|
||||
#[derive(Parser)]
|
||||
pub(crate) struct ResolveManyArgs {
|
||||
|
@ -96,6 +96,7 @@ pub(crate) async fn resolve_many(args: ResolveManyArgs) -> Result<()> {
|
|||
let index_locations = IndexLocations::default();
|
||||
let setup_py = SetupPyStrategy::default();
|
||||
let flat_index = FlatIndex::default();
|
||||
let config_settings = ConfigSettings::default();
|
||||
|
||||
// Create a `BuildDispatch` for each requirement.
|
||||
let build_dispatch = BuildDispatch::new(
|
||||
|
@ -108,6 +109,7 @@ pub(crate) async fn resolve_many(args: ResolveManyArgs) -> Result<()> {
|
|||
&in_flight,
|
||||
venv.python_executable(),
|
||||
setup_py,
|
||||
&config_settings,
|
||||
&no_build,
|
||||
&NoBinary::None,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue