Skip to content

Commit 5b76ca7

Browse files
Adjust shiboken cleanup hook
1 parent 57484c3 commit 5b76ca7

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/rez_pip/plugins/shiboken6.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@
1919

2020

2121
@rez_pip.plugins.hookimpl
22-
def cleanup(dist: "importlib_metadata.Distribution", path: str) -> None:
22+
def cleanup(
23+
dist: "importlib_metadata.Distribution", path: str
24+
) -> typing.List[rez_pip.plugins.CleanupAction]:
2325
if packaging.utils.canonicalize_name(dist.name) != "shiboken6":
24-
return
26+
return []
2527

2628
# Remove PySide6 from shiboken6 packages...
2729
# shiboken6 >=6.3, <6.6.2 were shipping some PySide6 folders by mistake.
2830
# Not removing these extra folders would stop python from being able to import
2931
# the correct PySide6 (that lives in a separate rez package).
30-
path = os.path.join(path, "python", "PySide6")
31-
if os.path.exists(path):
32-
_LOG.debug(f"Removing {path!r}")
33-
shutil.rmtree(path)
32+
return [
33+
rez_pip.plugins.CleanupAction("remove", os.path.join(path, "python", "PySide6"))
34+
]

0 commit comments

Comments
 (0)