Opened 15 years ago

Closed 15 years ago

#171 closed defect (fixed)

Uninstall activities that use symlinks

Reported by: erikos Owned by: erikos
Priority: major Milestone:
Component: Sugar Version: Git as of bugdate
Severity: Keywords: r+
Cc: tomeu Distribution/OS:
Bug Status:

Description

This is a follow up on #95. The activity bundle http://dev.laptop.org/~bemasc/ACBLSCOR-1.xo contains symlinks that point to a directory and are therefore returned by os.walk as directories. As the directories are removed in any case we must remove the symlink.


diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
index ed0360d..a1b2686 100644
--- a/src/sugar/bundle/bundle.py
+++ b/src/sugar/bundle/bundle.py
@@ -191,5 +191,9 @@ class Bundle(object):
             for name in files:
                 os.remove(os.path.join(root, name))
             for name in dirs:
-                os.rmdir(os.path.join(root, name))
+                path = os.path.join(root, name)
+                if os.path.islink(path):
+                    os.remove(path)
+                else:
+                    os.rmdir(path)
         os.rmdir(install_path)

Change History (4)

comment:1 Changed 15 years ago by erikos

  • Cc tomeu added

comment:2 Changed 15 years ago by erikos

  • Owner changed from marcopg to erikos
  • Status changed from new to assigned

comment:3 Changed 15 years ago by tomeu

  • Keywords r+ added; r? removed

Sounds good to me.

comment:4 Changed 15 years ago by erikos

  • Resolution set to fixed
  • Status changed from assigned to closed

Thanks for the review - pushed to git sugar-toolkit

Note: See TracTickets for help on using tickets.