Skip to content

Conversation

chennes
Copy link
Member

@chennes chennes commented Aug 24, 2025

Fixes #8

@Copilot Copilot AI review requested due to automatic review settings August 24, 2025 03:54
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds the --break-system-packages flag to pip commands when installing to a specific target directory outside of system containers. The change addresses pip's restriction on installing packages to custom directories when not in a virtual environment.

  • Adds conditional logic to append --break-system-packages when --target or --path options are present
  • Only applies this flag when not using system pip installation locations (i.e., outside containers/virtual environments)

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +587 to +593
elif "--target" in args or "--path" in args:
# If we are not running in some sort of container, and are instead trying to install to a
# specific directory, pip will complain because it doesn't know that we're effectively
# using this as a virtual env: it's not accessible to non-FreeCAD installations (at least,
# not without some extra work on the user's part). So add the --break-system-packages flag
# so pip will allow us to write to the --target directory
args.append("--break-system-packages")
Copy link
Preview

Copilot AI Aug 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --break-system-packages flag is being added even if it already exists in the args list, which could result in duplicate flags. Consider checking if the flag is already present before appending it.

Suggested change
elif "--target" in args or "--path" in args:
# If we are not running in some sort of container, and are instead trying to install to a
# specific directory, pip will complain because it doesn't know that we're effectively
# using this as a virtual env: it's not accessible to non-FreeCAD installations (at least,
# not without some extra work on the user's part). So add the --break-system-packages flag
# so pip will allow us to write to the --target directory
args.append("--break-system-packages")
if "--break-system-packages" not in args:
args.append("--break-system-packages")

Copilot uses AI. Check for mistakes.

@chennes chennes merged commit 63848fe into FreeCAD:dev Aug 24, 2025
11 checks passed
@chennes chennes deleted the breakSystemPackages branch August 24, 2025 03:56
@chennes chennes added the release to main Trigger an Action to create a PR backporting to `main` label Aug 24, 2025
Copy link

Successfully created backport PR for main:

Copy link

Backport failed for main, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin main
git worktree add -d .worktree/backport-218-to-main origin/main
cd .worktree/backport-218-to-main
git switch --create backport-218-to-main
git cherry-pick -x 48a0e1f9d6f90bd3cef82c4ea45d1a44e3abaaff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release to main Trigger an Action to create a PR backporting to `main`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AddonManager: dependency installation mechanism is deprecated
1 participant