Trait PythonDistribution

Source
pub trait PythonDistribution {
Show 28 methods // Required methods fn clone_trait(&self) -> Arc<dyn PythonDistribution>; fn target_triple(&self) -> &str; fn compatible_host_triples(&self) -> Vec<String>; fn python_exe_path(&self) -> &Path; fn python_version(&self) -> &str; fn python_major_minor_version(&self) -> String; fn python_implementation(&self) -> &str; fn python_implementation_short(&self) -> &str; fn python_tag(&self) -> &str; fn python_abi_tag(&self) -> Option<&str>; fn python_platform_tag(&self) -> &str; fn python_platform_compatibility_tag(&self) -> &str; fn cache_tag(&self) -> &str; fn python_module_suffixes(&self) -> Result<PythonModuleSuffixes>; fn python_config_vars(&self) -> &HashMap<String, String>; fn stdlib_test_packages(&self) -> Vec<String>; fn apple_sdk_info(&self) -> Option<&AppleSdkInfo>; fn create_bytecode_compiler( &self, env: &Environment, ) -> Result<Box<dyn PythonBytecodeCompiler>>; fn create_packaging_policy(&self) -> Result<PythonPackagingPolicy>; fn create_python_interpreter_config( &self, ) -> Result<PyembedPythonInterpreterConfig>; fn as_python_executable_builder( &self, host_triple: &str, target_triple: &str, name: &str, libpython_link_mode: BinaryLibpythonLinkMode, policy: &PythonPackagingPolicy, config: &PyembedPythonInterpreterConfig, host_distribution: Option<Arc<dyn PythonDistribution>>, ) -> Result<Box<dyn PythonBinaryBuilder>>; fn python_resources<'a>(&self) -> Vec<PythonResource<'a>>; fn ensure_pip(&self) -> Result<PathBuf>; fn resolve_distutils( &self, libpython_link_mode: LibpythonLinkMode, dest_dir: &Path, extra_python_paths: &[&Path], ) -> Result<HashMap<String, String>>; fn supports_in_memory_shared_library_loading(&self) -> bool; fn tcl_files(&self) -> Result<Vec<(PathBuf, FileEntry)>>; fn tcl_library_path_directory(&self) -> Option<String>; // Provided method fn is_stdlib_test_package(&self, name: &str) -> bool { ... }
}
Expand description

Describes a generic Python distribution.

Required Methods§

Source

fn clone_trait(&self) -> Arc<dyn PythonDistribution>

Clone self into a Box’ed trait object.

Source

fn target_triple(&self) -> &str

The Rust machine triple this distribution runs on.

Source

fn compatible_host_triples(&self) -> Vec<String>

Rust target triples on which this distribution’s binaries can run.

For example, an x86 distribution might advertise that it can run on 64-bit host triples.

target_triple() is always in the result.

Source

fn python_exe_path(&self) -> &Path

Obtain the filesystem path to a python executable for this distribution.

Source

fn python_version(&self) -> &str

Obtain the full Python version string.

Source

fn python_major_minor_version(&self) -> String

Obtain the X.Y Python version component. e.g. 3.7.

Source

fn python_implementation(&self) -> &str

Obtain the full Python implementation name. e.g. cpython.

Source

fn python_implementation_short(&self) -> &str

Obtain the short Python implementation name. e.g. cp

Source

fn python_tag(&self) -> &str

Obtain the PEP 425 Python tag. e.g. cp38.

Source

fn python_abi_tag(&self) -> Option<&str>

Obtain the PEP 425 Python ABI tag. e.g. cp38d.

Source

fn python_platform_tag(&self) -> &str

Obtain the Python platform tag.

Source

fn python_platform_compatibility_tag(&self) -> &str

Obtain the Python platform tag used to indicate compatibility.

This is similar to the platform tag. But where python_platform_tag() exposes the raw value like linux-x86_64, this is the normalized value that can be used by tools like pip. e.g. manylinux2014_x86_64.

Source

fn cache_tag(&self) -> &str

Obtain the cache tag to apply to Python bytecode modules.

Source

fn python_module_suffixes(&self) -> Result<PythonModuleSuffixes>

Obtain file suffixes for various Python module flavors.

Source

fn python_config_vars(&self) -> &HashMap<String, String>

Python configuration variables.

Source

fn stdlib_test_packages(&self) -> Vec<String>

Obtain Python packages in the standard library that provide tests.

Source

fn apple_sdk_info(&self) -> Option<&AppleSdkInfo>

Obtain Apple SDK settings for this distribution.

Source

fn create_bytecode_compiler( &self, env: &Environment, ) -> Result<Box<dyn PythonBytecodeCompiler>>

Create a PythonBytecodeCompiler from this instance.

Source

fn create_packaging_policy(&self) -> Result<PythonPackagingPolicy>

Construct a PythonPackagingPolicy derived from this instance.

Source

fn create_python_interpreter_config( &self, ) -> Result<PyembedPythonInterpreterConfig>

Construct an EmbeddedPythonConfig derived from this instance.

Source

fn as_python_executable_builder( &self, host_triple: &str, target_triple: &str, name: &str, libpython_link_mode: BinaryLibpythonLinkMode, policy: &PythonPackagingPolicy, config: &PyembedPythonInterpreterConfig, host_distribution: Option<Arc<dyn PythonDistribution>>, ) -> Result<Box<dyn PythonBinaryBuilder>>

Obtain a PythonBinaryBuilder for constructing an executable embedding Python.

This method is how you start the process of creating a new executable file from a Python distribution. Using the returned PythonBinaryBuilder instance, you can manipulate resources, etc and then eventually build a new executable with it.

Source

fn python_resources<'a>(&self) -> Vec<PythonResource<'a>>

Obtain PythonResource instances for every resource in this distribution.

Source

fn ensure_pip(&self) -> Result<PathBuf>

Ensure pip is available to run in the distribution.

Returns the path to a pip executable.

Source

fn resolve_distutils( &self, libpython_link_mode: LibpythonLinkMode, dest_dir: &Path, extra_python_paths: &[&Path], ) -> Result<HashMap<String, String>>

Resolve a distutils installation used for building Python packages.

Some distributions may need to use a modified distutils to coerce builds to work as PyOxidizer desires. This method is used to realize such a distutils installation.

Note that we pass in an explicit libpython link mode because the link mode we care about may differ from the link mode of the distribution itself (as some distributions support multiple link modes).

The return is a map of environment variables to set in the build environment.

Source

fn supports_in_memory_shared_library_loading(&self) -> bool

Whether this distribution supports loading shared libraries from memory.

This effectively answers whether we can embed a shared library into an executable and load it without having to materialize it on a filesystem.

Source

fn tcl_files(&self) -> Result<Vec<(PathBuf, FileEntry)>>

Obtain support files for tcl/tk.

The returned list of files contains relative file names and the locations of file content. If the files are installed in a new directory, it should be possible to use that directory joined with tcl_library_path_directory as the value of TCL_LIBRARY.

Source

fn tcl_library_path_directory(&self) -> Option<String>

The name of the directory to use for TCL_LIBRARY

Provided Methods§

Source

fn is_stdlib_test_package(&self, name: &str) -> bool

Determine whether a named module is in a known standard library test package.

Implementors§