Closed Bug 892283 Opened 11 years ago Closed 2 years ago

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

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: k0scist, Unassigned)

Details

(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
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.