Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue14772] Return destination values in some shutil functions

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

May 10, 2012, 12:26 PM

Post #1 of 10 (193 views)
Permalink
[issue14772] Return destination values in some shutil functions

New submission from Brian Curtin <brian [at] python>:

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.

----------
assignee: brian.curtin
components: Library (Lib)
files: shutil_return_values.diff
keywords: needs review, patch
messages: 160363
nosy: brian.curtin
priority: normal
severity: normal
stage: patch review
status: open
title: Return destination values in some shutil functions
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25522/shutil_return_values.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 10, 2012, 12:30 PM

Post #2 of 10 (187 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Changes by Hynek Schlawack <hs [at] ox>:


----------
nosy: +hynek

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 10, 2012, 1:27 PM

Post #3 of 10 (187 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Brian Curtin <brian [at] python> added the comment:

Here's a patch that fixes the trailing whitespace Hynek noticed as well as adds an additional test case for copy/copy2.

----------
Added file: http://bugs.python.org/file25526/issue14772.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 10, 2012, 1:41 PM

Post #4 of 10 (187 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Brian Curtin <brian [at] python> added the comment:

Added another test using move as renaming the destination file.

----------
Added file: http://bugs.python.org/file25527/issue14772_v2.diff

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 10, 2012, 1:45 PM

Post #5 of 10 (189 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Hynek Schlawack <hs [at] ox> added the comment:

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.

----------
stage: patch review -> commit review

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 10, 2012, 4:45 PM

Post #6 of 10 (179 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Éric Araujo <merwok [at] netwok> added the comment:

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.

----------
nosy: +eric.araujo

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 10, 2012, 4:48 PM

Post #7 of 10 (179 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Brian Curtin <brian [at] python> added the comment:

When you say "needs that", do you mean the patch as-is, or Hynek's suggestion to return consistently?

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 10, 2012, 4:57 PM

Post #8 of 10 (179 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Éric Araujo <merwok [at] netwok> added the comment:

I meant that packaging needs some shutil functions to return the destination, but haven’t checked to see if that includes copytree.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 11, 2012, 4:40 AM

Post #9 of 10 (179 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Éric Araujo <merwok [at] netwok> added the comment:

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.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 16, 2012, 5:45 AM

Post #10 of 10 (168 views)
Permalink
[issue14772] Return destination values in some shutil functions [In reply to]

Hynek Schlawack <hs [at] ox> added the comment:

Brian, are you going to update that patch so we can close this? :)

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14772>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.