Skip to content

[Backport main] Fix: Addon Manager Python dependency update detection in Flatpak#362

Open
github-actions[bot] wants to merge 6 commits intomainfrom
backport-308-to-main
Open

[Backport main] Fix: Addon Manager Python dependency update detection in Flatpak#362
github-actions[bot] wants to merge 6 commits intomainfrom
backport-308-to-main

Conversation

@github-actions
Copy link

Description

Backport of #308 to main.

omkarrr2533 and others added 6 commits February 20, 2026 00:33
When updating Python dependencies with pip using --target directory,
old package version metadata (.dist-info directories) are not always
removed. This causes FreeCAD to detect the old version instead of the
newly installed version, particularly in Flatpak installations.

This fix adds cleanup logic to remove old package version metadata
after a successful update, keeping only the newest version of each
package.

Fixes #26510

(cherry picked from commit 96800d7)
for more information, see https://pre-commit.ci

(cherry picked from commit 3ab0ce7)
Added unit tests covering:
- Removal of old versions while keeping newest
- Single version packages (no removal)
- Empty and nonexistent directories
- Permission error handling
- PEP 503 package name normalization
- Non-.dist-info directory filtering
- Invalid version format handling

Tests use proper mocking to avoid filesystem operations and follow
existing test patterns in the codebase.

These tests verify the cleanup logic works correctly across various
scenarios including edge cases like permission errors and malformed directory names. All tests use mocks to ensure fast, reliable execution without touching the actual filesystem.

(cherry picked from commit 7079ecb)
for more information, see https://pre-commit.ci

(cherry picked from commit bd1b6ac)
- Use os.path.join() for all path construction to ensure Windows compatibility
- Remove logging count assertion as suggested in review
- Tests now work across all platforms (Windows, Linux, macOS)

(cherry picked from commit b6cf067)
for more information, see https://pre-commit.ci

(cherry picked from commit f3cd818)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments