Skip to content

Commit

Permalink
Trac #16293: Fix sage-cleaner's rm_rf function on OS X
Browse files Browse the repository at this point in the history
On OS X, if you use `os.unlink` on a directory, you get an OSError,
"[Errno 1] Operation not permitted". We need to catch this so that
`sage-cleaner` works properly. (On linux machines, you seem to get
OSError, "[Errno 21] Is a directory".)

URL: http://trac.sagemath.org/16293
Reported by: jhpalmieri
Ticket author(s): John Palmieri
Reviewer(s): Leif Leonhardy
  • Loading branch information
Release Manager authored and vbraun committed May 6, 2014
2 parents bf8eae1 + a51436e commit 777a11b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bin/sage-cleaner
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def rm_rf(file_or_path):
try:
os.unlink(file_or_path)
except OSError as e:
if e.errno == errno.EISDIR:
if e.errno == errno.EISDIR or e.errno == errno.EPERM:
shutil.rmtree(file_or_path, ignore_errors=True)


Expand Down

0 comments on commit 777a11b

Please sign in to comment.