diff --git a/CHANGELOG.md b/CHANGELOG.md index 7588388025..884a0d69c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,10 @@ _Unreleased_ out the dependencies. Today the only option is the `--installed-deps` option on the `show` command which spits out dependencies in the format of the lockfile. #543 +- The installer will no longer attempt to symlink targets which are not valid + executables on the platform. This works around some issues with Packages that + would prevent to install such as `changedetection.io`. #542 + ## 0.17.0 diff --git a/rye/src/installer.rs b/rye/src/installer.rs index b889cfe5f1..f7cf233f3f 100644 --- a/rye/src/installer.rs +++ b/rye/src/installer.rs @@ -18,7 +18,9 @@ use crate::platform::get_app_dir; use crate::pyproject::{normalize_package_name, ExpandedSources}; use crate::sources::PythonVersionRequest; use crate::sync::create_virtualenv; -use crate::utils::{get_short_executable_name, get_venv_python_bin, symlink_file, CommandOutput}; +use crate::utils::{ + get_short_executable_name, get_venv_python_bin, is_executable, symlink_file, CommandOutput, +}; const FIND_SCRIPT_SCRIPT: &str = r#" import os @@ -253,6 +255,18 @@ fn install_scripts( let mut rv = Vec::new(); for file in files { if let Ok(rest) = file.strip_prefix(target_venv_bin_path) { + // In some cases we are given paths here which point to sub-folders of the + // script/bin folder. For instance in some cases it has been shown that + // __pycache__/something.pyc shows up there. These are obviously not good + // targets to link as they would never show up via PATH discovery. Skip + // over these. + // + // Also do not try to link things which are not considered executables on + // this operating system. + if !rest.parent().map_or(true, |x| x == Path::new("")) || !is_executable(file) { + continue; + } + let shim_target = shim_dir.join(rest); // on windows we want to fall back to hardlinks. That might be problematic in