Struct PythonPackagingPolicy

Source
pub struct PythonPackagingPolicy { /* private fields */ }
Expand description

Defines how Python resources should be packaged.

Implementations§

Source§

impl PythonPackagingPolicy

Source

pub fn extension_module_filter(&self) -> &ExtensionModuleFilter

Obtain the active extension module filter for this instance.

Source

pub fn set_extension_module_filter(&mut self, filter: ExtensionModuleFilter)

Set the extension module filter to use.

Source

pub fn preferred_extension_module_variants(&self) -> &HashMap<String, String>

Obtain the preferred extension module variants for this policy.

The returned object is a mapping of extension name to its variant name.

Source

pub fn set_preferred_extension_module_variant( &mut self, extension: &str, variant: &str, )

Denote the preferred variant for an extension module.

If set, the named variant will be chosen if it is present.

Source

pub fn resources_location(&self) -> &ConcreteResourceLocation

Obtain the primary location for added resources.

Source

pub fn set_resources_location(&mut self, location: ConcreteResourceLocation)

Set the primary location for added resources.

Source

pub fn resources_location_fallback(&self) -> &Option<ConcreteResourceLocation>

Obtain the fallback location for added resources.

Source

pub fn set_resources_location_fallback( &mut self, location: Option<ConcreteResourceLocation>, )

Set the fallback location for added resources.

Source

pub fn allow_files(&self) -> bool

Whether to allow untyped File resources.

Source

pub fn set_allow_files(&mut self, value: bool)

Set whether to allow untyped File resources.

Source

pub fn file_scanner_emit_files(&self) -> bool

Whether file scanning should emit PythonResource::File variants.

Source

pub fn set_file_scanner_emit_files(&mut self, value: bool)

Set whether file scanning should emit PythonResource::File variants.

Source

pub fn file_scanner_classify_files(&self) -> bool

Whether file scanning should classify files into PythonResource::* variants.

Source

pub fn set_file_scanner_classify_files(&mut self, value: bool)

Set whether file scanning should classify files into PythonResource::* variants.

Source

pub fn allow_in_memory_shared_library_loading(&self) -> bool

Whether to allow in-memory shared library loading.

Source

pub fn set_allow_in_memory_shared_library_loading(&mut self, value: bool)

Set the value for whether to allow in-memory shared library loading.

Source

pub fn include_distribution_sources(&self) -> bool

Get setting for whether to include source modules from the distribution.

Source

pub fn set_include_distribution_sources(&mut self, include: bool)

Set whether we should include a Python distribution’s module source code.

Source

pub fn include_distribution_resources(&self) -> bool

Get setting for whether to include Python package resources from the distribution.

Source

pub fn set_include_distribution_resources(&mut self, include: bool)

Set whether to include package resources from the Python distribution.

Source

pub fn include_non_distribution_sources(&self) -> bool

Whether to include Python sources for modules not in the standard library.

Source

pub fn set_include_non_distribution_sources(&mut self, include: bool)

Set whether to include Python sources for modules not in the standard library.

Source

pub fn include_test(&self) -> bool

Get setting for whether to include test files.

Source

pub fn set_include_test(&mut self, include: bool)

Set whether we should include Python modules that define tests.

Source

pub fn include_file_resources(&self) -> bool

Get whether to classify File resources as include by default.

Source

pub fn set_include_file_resources(&mut self, value: bool)

Set whether to classify File resources as include by default.

Source

pub fn include_classified_resources(&self) -> bool

Get whether to classify non-File resources as include by default.

Source

pub fn set_include_classified_resources(&mut self, value: bool)

Set whether to classify non-File resources as include by default.

Source

pub fn bytecode_optimize_level_zero(&self) -> bool

Whether to write bytecode at optimization level 0.

Source

pub fn set_bytecode_optimize_level_zero(&mut self, value: bool)

Set whether to write bytecode at optimization level 0.

Source

pub fn bytecode_optimize_level_one(&self) -> bool

Whether to write bytecode at optimization level 1.

Source

pub fn set_bytecode_optimize_level_one(&mut self, value: bool)

Set whether to write bytecode at optimization level 1.

Source

pub fn bytecode_optimize_level_two(&self) -> bool

Whether to write bytecode at optimization level 2.

Source

pub fn set_bytecode_optimize_level_two(&mut self, value: bool)

Set whether to write bytecode at optimization level 2.

Source

pub fn set_resource_handling_mode(&mut self, mode: ResourceHandlingMode)

Set the resource handling mode of the policy.

This is a convenience function for mapping a ResourceHandlingMode to corresponding field values.

Source

pub fn broken_extensions_for_triple( &self, target_triple: &str, ) -> Option<&Vec<String>>

Obtain broken extensions for a target triple.

Source

pub fn register_broken_extension( &mut self, target_triple: &str, extension: &str, )

Mark an extension as broken on a target platform, preventing it from being used.

Source

pub fn register_no_bytecode_module(&mut self, name: &str)

Register a Python module as one that should not generate bytecode.

When source modules matching names registered with this function are added, their default settings for adding bytecode will always be false.

It is still possible to force bytecode generation by setting the add context fields to true or explicitly adding a bytecode resource.

Source

pub fn derive_add_collection_context( &self, resource: &PythonResource<'_>, ) -> PythonResourceAddCollectionContext

Derive a PythonResourceAddCollectionContext for a resource using current settings.

The returned object essentially says how the resource should be added to a PythonResourceCollector given this policy.

Source

pub fn resolve_python_extension_modules<'a>( &self, extensions_variants: impl Iterator<Item = &'a PythonExtensionModuleVariants>, target_triple: &str, ) -> Result<Vec<PythonExtensionModule>>

Resolve Python extension modules that are compliant with the policy.

Trait Implementations§

Source§

impl Clone for PythonPackagingPolicy

Source§

fn clone(&self) -> PythonPackagingPolicy

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 Debug for PythonPackagingPolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PythonPackagingPolicy

Source§

fn default() -> Self

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

impl PartialEq for PythonPackagingPolicy

Source§

fn eq(&self, other: &PythonPackagingPolicy) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for PythonPackagingPolicy

Source§

impl StructuralPartialEq for PythonPackagingPolicy

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.

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
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.