This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年05月10日 19:26 by brian.curtin, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| shutil_return_values.diff | brian.curtin, 2012年05月10日 19:26 | review | ||
| issue14772.diff | brian.curtin, 2012年05月10日 20:27 | review | ||
| issue14772_v2.diff | brian.curtin, 2012年05月10日 20:41 | review | ||
| Messages (12) | |||
|---|---|---|---|
| msg160363 - (view) | Author: Brian Curtin (brian.curtin) * (Python committer) | Date: 2012年05月10日 19:26 | |
Attached is a patch to return the final destination of files or directories sent through shutil's copy, copy2, and move functions. This removes the need to construct the destination path on your own. This is especially useful for copy/copy2 where you copy a file into a directory and need to know that resulting path. Rather than calling os.path.join(dest, os.path.basename(source)) you could get that path from copy/copy2 (which does that join internally). Patch has docs and tests. |
|||
| msg160370 - (view) | Author: Brian Curtin (brian.curtin) * (Python committer) | Date: 2012年05月10日 20:27 | |
Here's a patch that fixes the trailing whitespace Hynek noticed as well as adds an additional test case for copy/copy2. |
|||
| msg160371 - (view) | Author: Brian Curtin (brian.curtin) * (Python committer) | Date: 2012年05月10日 20:41 | |
Added another test using move as renaming the destination file. |
|||
| msg160372 - (view) | Author: Hynek Schlawack (hynek) * (Python committer) | Date: 2012年05月10日 20:45 | |
Code LGTM, a deeper discussion happened on IRC. :) I'd still suggest for the sake of consistency to return the destination from copytree() too, but that can be done separately. |
|||
| msg160386 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年05月10日 23:45 | |
packaging/distutils2 definitely needs that; the similar functions in distutils.file_util used to return the file paths, this was lost in the conversion to shutil, and there is at least one open bug that needs it back. |
|||
| msg160387 - (view) | Author: Brian Curtin (brian.curtin) * (Python committer) | Date: 2012年05月10日 23:48 | |
When you say "needs that", do you mean the patch as-is, or Hynek's suggestion to return consistently? |
|||
| msg160390 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年05月10日 23:57 | |
I meant that packaging needs some shutil functions to return the destination, but haven’t checked to see if that includes copytree. |
|||
| msg160408 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年05月11日 11:40 | |
In distutils, both copy_file and copy_tree return the destination path(s), which is needed by many commands. In packaging there is code to compute and return those paths, as shutil functions return None; I’d love to remove that code. The bug I was thinking about is actually about copy(_)file parameters, not return value: #13336. |
|||
| msg160853 - (view) | Author: Hynek Schlawack (hynek) * (Python committer) | Date: 2012年05月16日 12:45 | |
Brian, are you going to update that patch so we can close this? :) |
|||
| msg163129 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年06月18日 23:41 | |
New changeset 8281233ec648 by Brian Curtin in branch 'default': Fix #14772: Return the destination from some shutil functions. http://hg.python.org/cpython/rev/8281233ec648 |
|||
| msg163176 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年06月19日 15:03 | |
New changeset e8ea27ab9fa6 by Brian Curtin in branch 'default': Add versionchanged tags for #14772 changes http://hg.python.org/cpython/rev/e8ea27ab9fa6 |
|||
| msg163725 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2012年06月24日 06:28 | |
Thanks! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:30 | admin | set | github: 58977 |
| 2012年06月24日 06:28:19 | eric.araujo | set | messages: + msg163725 |
| 2012年06月19日 15:03:32 | python-dev | set | messages: + msg163176 |
| 2012年06月18日 23:45:27 | brian.curtin | set | status: open -> closed resolution: fixed stage: commit review -> resolved |
| 2012年06月18日 23:41:45 | python-dev | set | nosy:
+ python-dev messages: + msg163129 |
| 2012年05月16日 12:45:05 | hynek | set | messages: + msg160853 |
| 2012年05月11日 11:40:54 | eric.araujo | set | messages: + msg160408 |
| 2012年05月10日 23:57:09 | eric.araujo | set | messages: + msg160390 |
| 2012年05月10日 23:48:19 | brian.curtin | set | messages: + msg160387 |
| 2012年05月10日 23:45:42 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg160386 |
| 2012年05月10日 20:45:52 | hynek | set | messages:
+ msg160372 stage: patch review -> commit review |
| 2012年05月10日 20:41:50 | brian.curtin | set | files:
+ issue14772_v2.diff messages: + msg160371 |
| 2012年05月10日 20:27:51 | brian.curtin | set | files:
+ issue14772.diff messages: + msg160370 |
| 2012年05月10日 19:30:54 | hynek | set | nosy:
+ hynek |
| 2012年05月10日 19:26:27 | brian.curtin | create | |