Struct InstallOptions

Source
pub struct InstallOptions {
    pub target_prefix: Option<PathBuf>,
    pub paths_json: Option<PathsJson>,
    pub index_json: Option<IndexJson>,
    pub link_json: Option<Option<LinkJson>>,
    pub allow_symbolic_links: Option<bool>,
    pub allow_hard_links: Option<bool>,
    pub allow_ref_links: Option<bool>,
    pub platform: Option<Platform>,
    pub python_info: Option<PythonInfo>,
    pub apple_codesign_behavior: AppleCodeSignBehavior,
}
Expand description

Additional options to pass to link_package to modify the installation process. Using InstallOptions::default works in most cases unless you want specific control over the installation process.

Fields§

§target_prefix: Option<PathBuf>

When files are copied/linked to the target directory hardcoded paths in these files are “patched”. The hardcoded paths are replaced with the full path of the target directory, also called the “prefix”.

However, in exceptional cases you might want to use a different prefix than the one that is being installed to. This field allows you to do that. When its set this is used instead of the target directory.

§paths_json: Option<PathsJson>

Instead of reading the paths.json file from the package directory itself, use the data specified here.

This is sometimes useful to avoid reading the file twice or when you want to modify installation process externally.

§index_json: Option<IndexJson>

Instead of reading the index.json file from the package directory itself, use the data specified here.

This is sometimes useful to avoid reading the file twice or when you want to modify installation process externally.

§link_json: Option<Option<LinkJson>>

Instead of reading the link.json file from the package directory itself, use the data specified here.

This is sometimes useful to avoid reading the file twice or when you want to modify installation process externally.

Because the the link.json file is optional this fields is using a doubly wrapped Option. The first Option is to indicate whether or not this value is set. The second Option is the [LinkJson] to use or None if you want to force that there is no [LinkJson].

This struct is only used if the package to be linked is a noarch Python package.

§allow_symbolic_links: Option<bool>

Whether or not to use symbolic links where possible. If this is set to Some(false) symlinks are disabled, if set to Some(true) symbolic links are always used when specified in the [info/paths.json] file even if this is not supported. If the value is set to None symbolic links are only used if they are supported.

Windows only supports symbolic links in specific cases.

§allow_hard_links: Option<bool>

Whether or not to use hard links where possible. If this is set to Some(false) the use of hard links is disabled, if set to Some(true) hard links are always used when specified in the [info/paths.json] file even if this is not supported. If the value is set to None hard links are only used if they are supported. A dummy hardlink is created to determine support.

Hard links are supported by most OSes but often require that the hard link and its content are on the same filesystem.

§allow_ref_links: Option<bool>

Whether or not to use ref links where possible. If this is set to Some(false) the use of hard links is disabled, if set to Some(true) ref links are always used when hard links are specified in the [info/paths.json] file even if this is not supported. If the value is set to None ref links are only used if they are supported.

Ref links are only support by a small number of OSes and filesystems. If reflinking fails for whatever reason the files are hardlinked instead (if allowed).

§platform: Option<Platform>

The platform for which the package is installed. Some operations like signing require different behavior depending on the platform. If the field is set to None the current platform is used.

§python_info: Option<PythonInfo>

Python version information of the python distribution installed within the environment. This is only used when installing noarch Python packages. Noarch python packages are python packages that contain python source code that has to be installed in the correct site-packages directory based on the version of python. This site-packages directory depends on the version of python, therefor it must be provided when linking.

If you’re installing a noarch python package and do not provide this field, the link_package function will return InstallError::MissingPythonInfo.

§apple_codesign_behavior: AppleCodeSignBehavior

For binaries on macOS (both Intel and Apple Silicon), binaries need to be signed with an ad-hoc certificate to properly work when their signature has been invalidated by prefix replacement (modifying binary content). This field controls whether or not to do that. Code signing is executed when the target platform is macOS. By default, codesigning will fail the installation if it fails. This behavior can be changed by setting this field to AppleCodeSignBehavior::Ignore or AppleCodeSignBehavior::DoNothing.

To sign the binaries, the /usr/bin/codesign executable is called with --force, --sign -, and --preserve-metadata=entitlements arguments. The --force argument is used to overwrite existing signatures, the --sign - argument is used to sign with an ad-hoc certificate (which does not use an identity at all), and --preserve-metadata=entitlements preserves the original entitlements from the binary (required for programs that need specific permissions like virtualization).

Trait Implementations§

Source§

impl Clone for InstallOptions

Source§

fn clone(&self) -> InstallOptions

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for InstallOptions

Source§

fn default() -> InstallOptions

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more