WIP: #77837: fix removing directories on WIN32 #125864

Closed
Campbell Barton wants to merge 1 commits from ideasman42/blender:pr-77837-fix into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

No response

_No response_
Campbell Barton added 3 commits 2024-08-04 14:31:35 +02:00
Regression from [0], removed the fix for #123827.

[0]: 08b75549e3
Resolve error when overwriting existing Python modules would attempt
to recursively remove a symlink which raised an error.

Related to #123827, same error but for extensions.
Fix #77837: Removing addons/extension/wheels failed on WIN32
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
b5959b42bf
When deleting files on WIN32, open files cannot be removed.
This is especially a problem for compiled Python modules which
remain open once imported.

Previously it was not so common for add-ons to include compiled Python
modules however with extensions supporting Python-wheels, it's
increasingly likely users run into this.

Workaround the problem by:
- Scheduling the files for removal next time Blender starts.
- Renaming to prevent collisions if the same paths need to be reused
  (in if the extension is re-installed for example).

This is supported for:

- Extensions.
- Python wheels.
- Legacy user add-ons.
- App-templates.

Details:

- On startup, a file exists that indicates cleanup is needed.
  In the common case the file doesn't exist.
  Otherwise module paths are scanned for files to remove.

- Since errors resolving paths to remove could result in user data loss,
  ensure the paths are always within the (extension/addon/app-template)
  directory.

- File locking isn't used, if multiple Blender instances start at the
  same time and try to remove the same files, this won't cause errors.
  Even so, the file that causes cleanup on startup is immediately
  removed to avoid unnecessary overhead to avoid any unnecessary
  file-system operation for other Blender instances.

Also resolves #125049.
Author
Owner

@blender-bot build

@blender-bot build
Campbell Barton closed this pull request 2024-08-06 05:26:52 +02:00
Some checks failed
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#125864
No description provided.