Explain where you might use mozfile.remove instead of shutil.rmtree or distutils.dir_util.remove_tree

NEW
Unassigned

Status

5 years ago
a year ago

People

(Reporter: k0scist, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
(mozbase)│python -c 'import this' | grep 'one--'
There should be one-- and preferably only one --obvious way to do it.

Sadly, however, there are two stdlib library functions that do this:

- shutil.rmtree:
  http://docs.python.org/2/library/shutil.html#shutil.rmtree

- distutils.dir_util.remove_tree:
  http://docs.python.org/2/distutils/apiref.html#distutils.dir_util.remove_tree

Currently, mozfile doesn't try either of these functions; perhaps it
should try either/or both and then fallback to an internal function?

In any case, we haven't really documented the advantage of
mozfile.rmtree over either of these functions; in a world where this
was important, these would be documented and tests would exist for
each case.

See bug 859422
Whiteboard: [good first bug][mentor=jmaher][lang=python]
I agree on adding some documentation on where mozfile.rmtree might be useful (and how it compares to the two functions mentioned above). I would be opposed to any change to mozfile.rmtree at this point. Many things depend on it at this point and making large scale changes to it is likely to cause problems (for no clear benefit).
would you like to resolve this as wontfix?
(In reply to Joel Maher (:jmaher) from comment #2)
> would you like to resolve this as wontfix?

May as well update the documentation since we noticed the problem and it'll take 5 minutes. I don't think this is a good first bug though.
Assignee: nobody → wlachance
Summary: consider using shutil.rmtree and/or distutils remove_tree for mozfile → Explain where you might use mozfile.remove instead of shutil.rmtree or distutils.dir_util.remove_tree
Whiteboard: [good first bug][mentor=jmaher][lang=python]
Assignee: wlachance → nobody
You need to log in before you can comment on or make changes to this bug.