Port some code to Python3

This commit is contained in:
Vincent Ricard 2020-12-28 22:31:49 +01:00 committed by Josh Matthews
parent f73370088b
commit a627dde0d0
24 changed files with 1439 additions and 2341 deletions

View file

@ -65,11 +65,11 @@ impl<'a> phf_shared::PhfHash for Bytes<'a> {
}
fn find_python() -> String {
env::var("PYTHON2").ok().unwrap_or_else(|| {
env::var("PYTHON3").ok().unwrap_or_else(|| {
let candidates = if cfg!(windows) {
["python2.7.exe", "python27.exe", "python.exe"]
["python3.8.exe", "python38.exe", "python.exe"]
} else {
["python2.7", "python2", "python"]
["python3.8", "python3", "python"]
};
for &name in &candidates {
if Command::new(name)
@ -82,7 +82,7 @@ fn find_python() -> String {
}
}
panic!(
"Can't find python (tried {})! Try fixing PATH or setting the PYTHON2 env var",
"Can't find python (tried {})! Try fixing PATH or setting the PYTHON3 env var",
candidates.join(", ")
)
})