Skip to content

Switch main installation and update method to Zip#156

Merged
chennes merged 1 commit intoFreeCAD:mainfrom
chennes:switchToZip
Aug 5, 2025
Merged

Switch main installation and update method to Zip#156
chennes merged 1 commit intoFreeCAD:mainfrom
chennes:switchToZip

Conversation

@chennes
Copy link
Copy Markdown
Member

@chennes chennes commented Aug 4, 2025

Migrate main installation mechanic to Zip (from git) and update progress monitoring to display the additional information about the download progress that this gains us. This does not change much about the zip handling itself: it is left as future work to support resuming interrupted downloads.

Fixes #132 .

Copilot AI review requested due to automatic review settings August 4, 2025 22:34

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor

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 migrates the Addon Manager from a Git-first installation approach to using Zip downloads as the primary method. The change aims to improve download progress monitoring while maintaining Git support as an opt-in feature for specific repositories.

  • Replaces Git as the default installation method with Zip downloads
  • Enhances progress tracking with detailed download size and progress information
  • Adds migration logic to backup existing Git installations before switching to Zip
  • Removes obsolete configuration options and UI elements related to Git preferences

Reviewed Changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
progress.ui Adds new progress dialog UI for installation/update operations
package_list.py Removes filtering logic for Python 2, obsolete packages, and newer FreeCAD requirements
package.xml Updates version number and date
addonmanager_workers_startup.py Adds import for MissingDependencies and PythonPackageListModel
addonmanager_utilities.py Removes get_metadata_url function
addonmanager_update_all_gui.py Implements new progress tracking and Git migration logic
addonmanager_preferences_defaults.json Removes Git-related preferences and adds force_git_in_repos setting
addonmanager_installer_gui.py Updates installer GUI to use new progress dialog
addonmanager_installer.py Changes installation method preference from Git to Zip
addonmanager_git.py Removes Git executable preference handling
NetworkManager.py Adds support for HEAD requests and content-length queries
AddonManagerOptions.ui Removes Git-related UI options
AddonManager.py Removes automatic update checking functionality
Addon.py Adds get_zip_url method and improves display name sanitization

Comment thread addonmanager_update_all_gui.py Outdated
def _update_progress_update(self, progress: int, total: int) -> None:
"""Calculate total progress and emit the signal"""
if 0 < self.currentIndex <= len(self.downloaded_sizes):
self.downloaded_sizes[self.currentIndex - 1] = progress
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

Array bounds check is needed. If currentIndex is 0, this will access index -1, which wraps to the last element. Should check if currentIndex > 0 before array access.

Copilot uses AI. Check for mistakes.
Comment thread addonmanager_update_all_gui.py Outdated

def _update_progress_update(self, progress: int, total: int) -> None:
"""Calculate total progress and emit the signal"""
if 0 < self.currentIndex <= len(self.downloaded_sizes):
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The condition allows currentIndex to equal len(self.downloaded_sizes), but arrays are 0-indexed, so valid indices are 0 to len-1. This should be < len(self.downloaded_sizes) instead of <= len(self.downloaded_sizes).

Suggested change
if 0 < self.currentIndex <= len(self.downloaded_sizes):
if 0 < self.currentIndex < len(self.downloaded_sizes):

Copilot uses AI. Check for mistakes.
Comment thread addonmanager_installer.py

# Finished: regardless of the outcome, this is emitted when all work that is going to be done
# is done (i.e. whatever thread this is running in can quit).
# is done (i.e., whatever thread this is running in can quit).
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

[nitpick] Inconsistent punctuation style. The comment uses 'i.e.,' but the original comment used 'i.e.' without the comma. This change doesn't improve readability.

Suggested change
# is done (i.e., whatever thread this is running in can quit).
# is done (i.e. whatever thread this is running in can quit).

Copilot uses AI. Check for mistakes.
Comment thread addonmanager_git.py
@@ -412,17 +412,11 @@ def migrate_branch(self, local_path: str, old_branch: str, new_branch: str) -> N
os.chdir(old_dir)

def _find_git(self):
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

The method comment describing the preference order for finding Git was removed, but the logic still follows some of that order. The comment should be updated to reflect the current behavior rather than completely removed.

Suggested change
def _find_git(self):
def _find_git(self):
"""
Locate the git executable using the following order of preference:
1. Check for a bundled git in the FreeCAD home directory (fc_dir/bin/git[.exe]).
2. On macOS, ensure the system git is not a placeholder (xcode-select prompt).
3. If not found, fall back to searching the system PATH using shutil.which("git").
If a valid git executable is found, set self.git_exe; otherwise, leave it as None.
"""

Copilot uses AI. Check for mistakes.
Comment thread Addon.py
Comment on lines +317 to +322
self.display_name = (
str(metadata.name)
.replace("\n", " ")
.replace("\r", " ")
.replace("{", "")
.replace("}", "")
Copy link

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

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

[nitpick] The display name sanitization removes curly braces unconditionally. This could potentially break legitimate display names that use braces for formatting. Consider a more targeted approach or document why these characters need to be removed.

Suggested change
self.display_name = (
str(metadata.name)
.replace("\n", " ")
.replace("\r", " ")
.replace("{", "")
.replace("}", "")
# Only sanitize newlines and carriage returns; allow curly braces in display names.
self.display_name = (
str(metadata.name)
.replace("\n", " ")
.replace("\r", " ")

Copilot uses AI. Check for mistakes.
Comment thread AddonManagerTest/gui/test_update_all_gui.py Fixed
Comment thread addonmanager_installer.py Fixed
Comment thread addonmanager_update_all_gui.py Fixed
Comment thread addonmanager_update_all_gui.py Fixed
Comment thread addonmanager_update_all_gui.py Fixed
Comment thread addonmanager_workers_startup.py Fixed
Comment thread addonmanager_workers_startup.py Fixed
@chennes chennes merged commit 02ef5b1 into FreeCAD:main Aug 5, 2025
11 checks passed
@chennes chennes deleted the switchToZip branch August 5, 2025 16:36
@amreo
Copy link
Copy Markdown

amreo commented Aug 6, 2025

Thanks @chennes ❤️

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.

AddonManager: Unable to install some addon: git premature EOF

4 participants