Struct pyo3_pack::PythonInterpreter [−][src]
pub struct PythonInterpreter {
pub major: usize,
pub minor: usize,
pub abiflags: String,
pub target: Target,
pub executable: PathBuf,
}The location and version of an interpreter
Fields
major: usize
Python's major version
minor: usize
Python's minor version
abiflags: String
For linux and mac, this contains the value of the abiflags, e.g. "m" for python3.5m or "mu" for python2.7mu. On windows, the value is always "".
See PEP 261 and PEP 393 for details
target: Target
Currently just the value of Target::os(), i.e. "windows", "linux" or "macos"
executable: PathBuf
Path to the python interpreter, e.g. /usr/bin/python3.6
Just the name of the binary in PATH does also work, e.g. python3.5
Methods
impl PythonInterpreter[src]
impl PythonInterpreterpub fn get_tag(&self) -> String[src]
pub fn get_tag(&self) -> StringReturns the supported python environment in the PEP 425 format: {python tag}-{abi tag}-{platform tag}
Don't ask me why or how, this is just what setuptools uses so I'm also going to use
pub fn get_library_extension(&self) -> String[src]
pub fn get_library_extension(&self) -> StringGenerates the correct suffix for shared libraries
For python 2, it's just .so. For python 3, there is PEP 3149, but
that is only valid for 3.2 - 3.4. Since only 3.5+ is supported, the
templates are adapted from the (also
incorrect) release notes of python 3.5:
https://docs.python.org/3/whatsnew/3.5.html#build-and-c-api-changes
Examples for 64-bit on Python 3.5m: Linux: steinlaus.cpython-35m-x86_64-linux-gnu.so Windows: steinlaus.cp35-win_amd64.pyd Mac: steinlaus.cpython-35m-darwin.so
Examples for 64-bit on Python 2.7mu: Linux: steinlaus.so Windows: steinlaus.pyd Mac: steinlaus.so
pub fn check_executable(
executable: impl AsRef<Path>,
target: &Target
) -> Result<Option<PythonInterpreter>, Error>[src]
pub fn check_executable(
executable: impl AsRef<Path>,
target: &Target
) -> Result<Option<PythonInterpreter>, Error>Checks whether the given command is a python interpreter and returns a PythonInterpreter if that is the case
pub fn find_all(target: &Target) -> Result<Vec<PythonInterpreter>, Error>[src]
pub fn find_all(target: &Target) -> Result<Vec<PythonInterpreter>, Error>Tries to find all installed python versions using the heuristic for the given platform
pub fn check_executables(
executables: &[String],
target: &Target
) -> Result<Vec<PythonInterpreter>, Error>[src]
pub fn check_executables(
executables: &[String],
target: &Target
) -> Result<Vec<PythonInterpreter>, Error>Checks that given list of executables are al valid python intepreters, determines the abiflags and versions of those interpreters and returns them as PythonInterpreter
Trait Implementations
impl Debug for PythonInterpreter[src]
impl Debug for PythonInterpreterfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for PythonInterpreter[src]
impl Clone for PythonInterpreterfn clone(&self) -> PythonInterpreter[src]
fn clone(&self) -> PythonInterpreterReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Eq for PythonInterpreter[src]
impl Eq for PythonInterpreterimpl PartialEq for PythonInterpreter[src]
impl PartialEq for PythonInterpreterfn eq(&self, other: &PythonInterpreter) -> bool[src]
fn eq(&self, other: &PythonInterpreter) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &PythonInterpreter) -> bool[src]
fn ne(&self, other: &PythonInterpreter) -> boolThis method tests for !=.
impl Display for PythonInterpreter[src]
impl Display for PythonInterpreterAuto Trait Implementations
impl Send for PythonInterpreter
impl Send for PythonInterpreterimpl Sync for PythonInterpreter
impl Sync for PythonInterpreter