Skip to content

Commit

Permalink
fix: prevent attempting to use python-build in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Sep 23, 2024
1 parent 663170b commit e15545b
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions src/plugins/core/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl PythonPlugin {
.join("plugins/python-build/bin/python-build")
}
fn install_or_update_python_build(&self) -> eyre::Result<()> {
ensure_not_windows()?;
if self.python_build_path().exists() {
self.update_python_build()
} else {
Expand Down Expand Up @@ -139,11 +140,13 @@ impl PythonPlugin {
Some((_, tag, filename)) => (tag, filename),
None => {
if cfg!(windows) || Settings::get().python_compile == Some(false) {
hint!(
"python_compile",
"To compile python from source, run",
"mise settings set python_compile 1"
);
if !cfg!(windows) {
hint!(
"python_compile",
"To compile python from source, run",
"mise settings set python_compile 1"
);
}
bail!(
"no precompiled python found for {} on {}-{}",
ctx.tv.version,
Expand All @@ -158,12 +161,14 @@ impl PythonPlugin {
}
};

hint!(
"python_precompiled",
"installing precompiled python from indygreg/python-build-standalone\n\
if you experience issues with this python (e.g.: running poetry), switch to python-build by running",
"mise settings set python_compile 1"
);
if cfg!(unix) {
hint!(
"python_precompiled",
"installing precompiled python from indygreg/python-build-standalone\n\
if you experience issues with this python (e.g.: running poetry), switch to python-build by running",
"mise settings set python_compile 1"
);
}

let url = format!(
"https://github.com/indygreg/python-build-standalone/releases/download/{tag}/{filename}"
Expand Down Expand Up @@ -433,3 +438,10 @@ fn python_arch(settings: &Settings) -> &str {
built_info::CFG_TARGET_ARCH
}
}

fn ensure_not_windows() -> eyre::Result<()> {
if cfg!(windows) {
bail!("python can not currently be compiled on windows");
}
Ok(())
}

0 comments on commit e15545b

Please sign in to comment.