pep508: un-export fields for MarkerEnvironment

We now use the getters and setters everywhere.

There were some places where we wanted to build a `MarkerEnvironment`
out of whole cloth, usually in tests. To facilitate those use cases, we
add a `MarkerEnvironmentBuilder` that provides a convenient constructor.
It's basically like a `MarkerEnvironment::new`, but with named
parameters. That's useful here because there are so many fields (and
they many have the same type).
This commit is contained in:
Andrew Gallant 2024-05-08 19:01:44 -04:00 committed by Andrew Gallant
parent be12cfb2b8
commit 7d67b7bb49
11 changed files with 198 additions and 169 deletions

View file

@ -20,7 +20,7 @@ impl PythonRequirement {
}
pub fn from_marker_environment(interpreter: &Interpreter, env: &MarkerEnvironment) -> Self {
Self::new(interpreter, &env.python_full_version)
Self::new(interpreter, env.python_full_version())
}
/// Return the installed version of Python.