Skip to content

Commit

Permalink
Merge pull request #164 from PyO3/interpreter_are_paths
Browse files Browse the repository at this point in the history
Interpreter are paths
  • Loading branch information
konstin authored Jul 14, 2019
2 parents 7502811 + a7e2b38 commit efd60ec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct BuildOptions {
#[structopt(short, long)]
/// The python versions to build wheels for, given as the names of the
/// interpreters. Uses autodiscovery if not explicitly set.
pub interpreter: Vec<String>,
pub interpreter: Vec<PathBuf>,
/// Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin
#[structopt(short, long)]
pub bindings: Option<String>,
Expand Down Expand Up @@ -232,7 +232,7 @@ pub fn find_bridge(cargo_metadata: &Metadata, bridge: Option<&str>) -> Result<Br
/// This means all for bindings, one for cffi and zero for bin.
pub fn find_interpreter(
bridge: &BridgeModel,
interpreter: &[String],
interpreter: &[PathBuf],
target: &Target,
) -> Result<Vec<PythonInterpreter>, Error> {
Ok(match bridge {
Expand Down Expand Up @@ -264,7 +264,7 @@ pub fn find_interpreter(
let executable = if interpreter.is_empty() {
target.get_python()
} else if interpreter.len() == 1 {
PathBuf::from(interpreter[0].clone())
interpreter[0].clone()
} else {
bail!("You can only specify one python interpreter for cffi compilation");
};
Expand Down
2 changes: 1 addition & 1 deletion src/develop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn develop(

let build_options = BuildOptions {
manylinux: Manylinux::Off,
interpreter: vec!["python3".to_string()],
interpreter: vec![target.get_python()],
bindings,
manifest_path: manifest_file.to_path_buf(),
out: None,
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ fn pep517(subcommand: PEP517Command) -> Result<(), Error> {
metadata_directory,
strip,
} => {
build_options.interpreter = vec!["python".to_string()];
build_options.interpreter = vec![PathBuf::from("python")];
let context = build_options.into_build_context(true, strip)?;
let tags = match context.bridge {
BridgeModel::Bindings(_) => {
Expand Down
12 changes: 9 additions & 3 deletions src/python_interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,17 +544,23 @@ impl PythonInterpreter {
/// determines the abiflags and versions of those interpreters and
/// returns them as [PythonInterpreter]
pub fn check_executables(
executables: &[String],
executables: &[PathBuf],
target: &Target,
) -> Result<Vec<PythonInterpreter>, Error> {
let mut available_versions = Vec::new();
for executable in executables {
if let Some(version) = PythonInterpreter::check_executable(executable, &target)
.context(format!("{} is not a valid python interpreter", executable))?
.context(format!(
"{} is not a valid python interpreter",
executable.display()
))?
{
available_versions.push(version);
} else {
bail!("Python interpreter `{}` doesn't exist", executable);
bail!(
"Python interpreter `{}` doesn't exist",
executable.display()
);
}
}

Expand Down

0 comments on commit efd60ec

Please sign in to comment.