Skip to content

Commit

Permalink
feat: move uv options into context (#911)
Browse files Browse the repository at this point in the history
Move the uv no-binary and no-build options into the shared context. So
that they are the same across resolve and install.
  • Loading branch information
tdejager authored Mar 4, 2024
1 parent d95148f commit be7066f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 3 additions & 7 deletions src/install_pypi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use uv_installer::{Downloader, SitePackages};
use uv_interpreter::{Interpreter, PythonEnvironment};
use uv_normalize::PackageName;

use uv_traits::{ConfigSettings, NoBinary, NoBuild, SetupPyStrategy};
use uv_traits::{ConfigSettings, SetupPyStrategy};

type CombinedPypiPackageData = (PypiPackageData, PypiPackageEnvironmentData);

Expand Down Expand Up @@ -351,10 +351,6 @@ pub async fn update_python_distributions(
FlatIndex::from_entries(entries, &tags)
};

// Track in-flight downloads, builds, etc., across resolutions.
let no_build = NoBuild::None;
let no_binary = NoBinary::None;

let in_memory_index = InMemoryIndex::default();
let config_settings = ConfigSettings::default();

Expand All @@ -376,8 +372,8 @@ pub async fn update_python_distributions(
&uv_context.in_flight,
SetupPyStrategy::default(),
&config_settings,
&no_build,
&no_binary,
&uv_context.no_build,
&uv_context.no_binary,
)
.with_build_extra_env_vars(environment_variables.iter());

Expand Down
8 changes: 6 additions & 2 deletions src/lock_file/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ pub struct UvResolutionContext {
pub registry_client: Arc<RegistryClient>,
pub in_flight: Arc<InFlight>,
pub index_locations: Arc<IndexLocations>,
pub no_build: NoBuild,
pub no_binary: NoBinary,
}

impl UvResolutionContext {
Expand All @@ -83,6 +85,8 @@ impl UvResolutionContext {
registry_client,
in_flight,
index_locations,
no_build: NoBuild::None,
no_binary: NoBinary::None,
})
}
}
Expand Down Expand Up @@ -304,8 +308,8 @@ pub async fn resolve_pypi(
&context.in_flight,
SetupPyStrategy::default(),
&config_settings,
&NoBuild::None,
&NoBinary::None,
&context.no_build,
&context.no_binary,
)
.with_options(options)
.with_build_extra_env_vars(env_variables.iter());
Expand Down

0 comments on commit be7066f

Please sign in to comment.