pub struct PythonPackagingPolicy { /* private fields */ }
Expand description
Defines how Python resources should be packaged.
Implementations§
Source§impl PythonPackagingPolicy
impl PythonPackagingPolicy
Sourcepub fn extension_module_filter(&self) -> &ExtensionModuleFilter
pub fn extension_module_filter(&self) -> &ExtensionModuleFilter
Obtain the active extension module filter for this instance.
Sourcepub fn set_extension_module_filter(&mut self, filter: ExtensionModuleFilter)
pub fn set_extension_module_filter(&mut self, filter: ExtensionModuleFilter)
Set the extension module filter to use.
Sourcepub fn preferred_extension_module_variants(&self) -> &HashMap<String, String>
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.
Sourcepub fn set_preferred_extension_module_variant(
&mut self,
extension: &str,
variant: &str,
)
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.
Sourcepub fn resources_location(&self) -> &ConcreteResourceLocation
pub fn resources_location(&self) -> &ConcreteResourceLocation
Obtain the primary location for added resources.
Sourcepub fn set_resources_location(&mut self, location: ConcreteResourceLocation)
pub fn set_resources_location(&mut self, location: ConcreteResourceLocation)
Set the primary location for added resources.
Sourcepub fn resources_location_fallback(&self) -> &Option<ConcreteResourceLocation>
pub fn resources_location_fallback(&self) -> &Option<ConcreteResourceLocation>
Obtain the fallback location for added resources.
Sourcepub fn set_resources_location_fallback(
&mut self,
location: Option<ConcreteResourceLocation>,
)
pub fn set_resources_location_fallback( &mut self, location: Option<ConcreteResourceLocation>, )
Set the fallback location for added resources.
Sourcepub fn allow_files(&self) -> bool
pub fn allow_files(&self) -> bool
Whether to allow untyped File
resources.
Sourcepub fn set_allow_files(&mut self, value: bool)
pub fn set_allow_files(&mut self, value: bool)
Set whether to allow untyped File
resources.
Sourcepub fn file_scanner_emit_files(&self) -> bool
pub fn file_scanner_emit_files(&self) -> bool
Whether file scanning should emit PythonResource::File
variants.
Sourcepub fn set_file_scanner_emit_files(&mut self, value: bool)
pub fn set_file_scanner_emit_files(&mut self, value: bool)
Set whether file scanning should emit PythonResource::File
variants.
Sourcepub fn file_scanner_classify_files(&self) -> bool
pub fn file_scanner_classify_files(&self) -> bool
Whether file scanning should classify files into PythonResource::*
variants.
Sourcepub fn set_file_scanner_classify_files(&mut self, value: bool)
pub fn set_file_scanner_classify_files(&mut self, value: bool)
Set whether file scanning should classify files into PythonResource::*
variants.
Whether to allow in-memory shared library loading.
Set the value for whether to allow in-memory shared library loading.
Sourcepub fn include_distribution_sources(&self) -> bool
pub fn include_distribution_sources(&self) -> bool
Get setting for whether to include source modules from the distribution.
Sourcepub fn set_include_distribution_sources(&mut self, include: bool)
pub fn set_include_distribution_sources(&mut self, include: bool)
Set whether we should include a Python distribution’s module source code.
Sourcepub fn include_distribution_resources(&self) -> bool
pub fn include_distribution_resources(&self) -> bool
Get setting for whether to include Python package resources from the distribution.
Sourcepub fn set_include_distribution_resources(&mut self, include: bool)
pub fn set_include_distribution_resources(&mut self, include: bool)
Set whether to include package resources from the Python distribution.
Sourcepub fn include_non_distribution_sources(&self) -> bool
pub fn include_non_distribution_sources(&self) -> bool
Whether to include Python sources for modules not in the standard library.
Sourcepub fn set_include_non_distribution_sources(&mut self, include: bool)
pub fn set_include_non_distribution_sources(&mut self, include: bool)
Set whether to include Python sources for modules not in the standard library.
Sourcepub fn include_test(&self) -> bool
pub fn include_test(&self) -> bool
Get setting for whether to include test files.
Sourcepub fn set_include_test(&mut self, include: bool)
pub fn set_include_test(&mut self, include: bool)
Set whether we should include Python modules that define tests.
Sourcepub fn include_file_resources(&self) -> bool
pub fn include_file_resources(&self) -> bool
Get whether to classify File
resources as include by default.
Sourcepub fn set_include_file_resources(&mut self, value: bool)
pub fn set_include_file_resources(&mut self, value: bool)
Set whether to classify File
resources as include by default.
Sourcepub fn include_classified_resources(&self) -> bool
pub fn include_classified_resources(&self) -> bool
Get whether to classify non-File
resources as include by default.
Sourcepub fn set_include_classified_resources(&mut self, value: bool)
pub fn set_include_classified_resources(&mut self, value: bool)
Set whether to classify non-File
resources as include by default.
Sourcepub fn bytecode_optimize_level_zero(&self) -> bool
pub fn bytecode_optimize_level_zero(&self) -> bool
Whether to write bytecode at optimization level 0.
Sourcepub fn set_bytecode_optimize_level_zero(&mut self, value: bool)
pub fn set_bytecode_optimize_level_zero(&mut self, value: bool)
Set whether to write bytecode at optimization level 0.
Sourcepub fn bytecode_optimize_level_one(&self) -> bool
pub fn bytecode_optimize_level_one(&self) -> bool
Whether to write bytecode at optimization level 1.
Sourcepub fn set_bytecode_optimize_level_one(&mut self, value: bool)
pub fn set_bytecode_optimize_level_one(&mut self, value: bool)
Set whether to write bytecode at optimization level 1.
Sourcepub fn bytecode_optimize_level_two(&self) -> bool
pub fn bytecode_optimize_level_two(&self) -> bool
Whether to write bytecode at optimization level 2.
Sourcepub fn set_bytecode_optimize_level_two(&mut self, value: bool)
pub fn set_bytecode_optimize_level_two(&mut self, value: bool)
Set whether to write bytecode at optimization level 2.
Sourcepub fn set_resource_handling_mode(&mut self, mode: ResourceHandlingMode)
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.
Sourcepub fn broken_extensions_for_triple(
&self,
target_triple: &str,
) -> Option<&Vec<String>>
pub fn broken_extensions_for_triple( &self, target_triple: &str, ) -> Option<&Vec<String>>
Obtain broken extensions for a target triple.
Sourcepub fn register_broken_extension(
&mut self,
target_triple: &str,
extension: &str,
)
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.
Sourcepub fn register_no_bytecode_module(&mut self, name: &str)
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.
Sourcepub fn derive_add_collection_context(
&self,
resource: &PythonResource<'_>,
) -> PythonResourceAddCollectionContext
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.
Sourcepub fn resolve_python_extension_modules<'a>(
&self,
extensions_variants: impl Iterator<Item = &'a PythonExtensionModuleVariants>,
target_triple: &str,
) -> Result<Vec<PythonExtensionModule>>
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
impl Clone for PythonPackagingPolicy
Source§fn clone(&self) -> PythonPackagingPolicy
fn clone(&self) -> PythonPackagingPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PythonPackagingPolicy
impl Debug for PythonPackagingPolicy
Source§impl Default for PythonPackagingPolicy
impl Default for PythonPackagingPolicy
Source§impl PartialEq for PythonPackagingPolicy
impl PartialEq for PythonPackagingPolicy
impl Eq for PythonPackagingPolicy
impl StructuralPartialEq for PythonPackagingPolicy
Auto Trait Implementations§
impl Freeze for PythonPackagingPolicy
impl RefUnwindSafe for PythonPackagingPolicy
impl Send for PythonPackagingPolicy
impl Sync for PythonPackagingPolicy
impl Unpin for PythonPackagingPolicy
impl UnwindSafe for PythonPackagingPolicy
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> 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