Struct python_packaging::policy::PythonPackagingPolicy
source · [−]pub struct PythonPackagingPolicy { /* private fields */ }
Expand description
Defines how Python resources should be packaged.
Implementations
sourceimpl 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
sourceimpl Clone for PythonPackagingPolicy
impl Clone for PythonPackagingPolicy
sourcefn clone(&self) -> PythonPackagingPolicy
fn clone(&self) -> PythonPackagingPolicy
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PythonPackagingPolicy
impl Debug for PythonPackagingPolicy
sourceimpl Default for PythonPackagingPolicy
impl Default for PythonPackagingPolicy
sourceimpl PartialEq<PythonPackagingPolicy> for PythonPackagingPolicy
impl PartialEq<PythonPackagingPolicy> for PythonPackagingPolicy
sourcefn eq(&self, other: &PythonPackagingPolicy) -> bool
fn eq(&self, other: &PythonPackagingPolicy) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &PythonPackagingPolicy) -> bool
fn ne(&self, other: &PythonPackagingPolicy) -> bool
This method tests for !=
.
impl StructuralPartialEq for PythonPackagingPolicy
Auto Trait Implementations
impl RefUnwindSafe for PythonPackagingPolicy
impl Send for PythonPackagingPolicy
impl Sync for PythonPackagingPolicy
impl Unpin for PythonPackagingPolicy
impl UnwindSafe for PythonPackagingPolicy
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more