pub struct PythonInfo {
pub platform: Platform,
pub short_version: (u64, u64),
pub path: PathBuf,
pub site_packages_path: PathBuf,
pub bin_dir: PathBuf,
}Expand description
Information required for linking no-arch python packages. The struct contains information about a specific Python version that is installed in an environment.
Fields§
§platform: PlatformThe platform that the python package is installed for
short_version: (u64, u64)The major and minor version
path: PathBufThe relative path to the python executable
site_packages_path: PathBufThe relative path to where site-packages are stored
bin_dir: PathBufPath to the binary directory
Implementations§
Source§impl PythonInfo
impl PythonInfo
Sourcepub fn from_python_record(
record: &PackageRecord,
platform: Platform,
) -> Result<Self, PythonInfoError>
pub fn from_python_record( record: &PackageRecord, platform: Platform, ) -> Result<Self, PythonInfoError>
Build an instance based on metadata of the package that represents the python interpreter.
Sourcepub fn from_version(
version: &Version,
site_packages_path: Option<&str>,
platform: Platform,
) -> Result<Self, PythonInfoError>
pub fn from_version( version: &Version, site_packages_path: Option<&str>, platform: Platform, ) -> Result<Self, PythonInfoError>
Build an instance based on the version of the python package and the platform it is installed for.
Sourcepub fn shebang(&self, target_prefix: &str) -> String
pub fn shebang(&self, target_prefix: &str) -> String
Constructs a shebang that will run the rest of the script as Python.
Sourcepub fn get_python_noarch_target_path<'a>(
&self,
relative_path: &'a Path,
) -> Cow<'a, Path>
pub fn get_python_noarch_target_path<'a>( &self, relative_path: &'a Path, ) -> Cow<'a, Path>
Returns the target location of a file in a noarch python package given its location in its package archive.
Sourcepub fn is_relink_required(&self, previous: &PythonInfo) -> bool
pub fn is_relink_required(&self, previous: &PythonInfo) -> bool
Returns true if this version of python differs so much that a relink is required for all noarch python packages.
Trait Implementations§
Source§impl Clone for PythonInfo
impl Clone for PythonInfo
Source§fn clone(&self) -> PythonInfo
fn clone(&self) -> PythonInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for PythonInfo
impl RefUnwindSafe for PythonInfo
impl Send for PythonInfo
impl Sync for PythonInfo
impl Unpin for PythonInfo
impl UnsafeUnpin for PythonInfo
impl UnwindSafe for PythonInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more