[][src]Struct python_config::PythonConfig

pub struct PythonConfig { /* fields omitted */ }

Exposes Python configuration information

Methods

impl PythonConfig[src]

pub fn new() -> Self[src]

Create a new PythonConfig that uses the system installed Python 3 interpreter to query configuration information.

pub fn version(version: Version) -> Self[src]

Create a new PythonConfig that uses the system installed Python of version version.

Example

use python_config::{PythonConfig, Version};

// Use the system-wide Python2 interpreter
let cfg = PythonConfig::version(Version::Two);

pub fn interpreter<P: AsRef<Path>>(interpreter: P) -> PyResult<Self>[src]

Create a PythonConfig that uses the interpreter at the path interpreter.

This fails if the path cannot be represented as a string, or if a query for the Python version fails.

Example

use python_config::PythonConfig;

let cfg = PythonConfig::interpreter("/usr/local/bin/python3");
assert!(cfg.is_ok());

pub fn version_raw(&self) -> PyResult<String>[src]

Returns the Python version string

This is the raw return of python --version. Consider using semantic_version for something more useful.

pub fn semantic_version(&self) -> PyResult<Version>[src]

Returns the Python version as a semver

pub fn prefix(&self) -> PyResult<String>[src]

Returns the installation prefix of the Python interpreter as a string

pub fn prefix_path(&self) -> PyResult<PathBuf>[src]

Like prefix, but returns the installation prefix as a PathBuf.

pub fn exec_prefix(&self) -> PyResult<String>[src]

Returns the executable path prefix for the Python interpreter as a string

pub fn exec_prefix_path(&self) -> PyResult<PathBuf>[src]

Like exec_prefix, but returns the executable prefix as a PathBuf.

pub fn includes(&self) -> PyResult<String>[src]

Returns a list of paths that represent the include paths for the distribution's headers. This is a space-delimited string of paths prefixed with -I.

pub fn include_paths(&self) -> PyResult<Vec<PathBuf>>[src]

Returns a list of paths that represent the include paths for the distribution's headers. Unlike includes, This is simply a collection of paths.

pub fn cflags(&self) -> PyResult<String>[src]

All the flags useful for C compilation. This includes the include paths (see includes) as well as other compiler flags for this target. The return is a string with spaces separating the flags.

pub fn libs(&self) -> PyResult<String>[src]

Returns linker flags required for linking this Python distribution. All libraries / frameworks have the appropriate -l or -framework prefixes.

pub fn ldflags(&self) -> PyResult<String>[src]

Returns linker flags required for creating a shared library for this Python distribution. All libraries / frameworks have the appropriate -l or -framework prefixes.

pub fn extension_suffix(&self) -> Py3Only<String>[src]

Returns a string that represents the file extension for this distribution's library

This is only available when your interpreter is a Python 3 interpreter! This is for feature parity with the python3-config script.

pub fn abi_flags(&self) -> Py3Only<String>[src]

The ABI flags specified when building this Python distribution

This is only available when your interpreter is a Python 3 interpreter! This is for feature parity with the python3-config script.

pub fn config_dir(&self) -> Py3Only<String>[src]

The location of the distribution's actual python3-config script

This is only available when your interpreter is a Python 3 interpreter! This is for feature parity with the python3-config script.

pub fn config_dir_path(&self) -> Py3Only<PathBuf>[src]

Like config_dir, but returns the path to the distribution's python-config script as a PathBuf.

This is only available when your interpreter is a Python 3 interpreter! This is for feature parity with the python3-config script.

Trait Implementations

impl Default for PythonConfig[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]