On Thu, Dec 29, 2011 at 11:55, antoine.pitrou <python-check...@python.org> wrote: > http://hg.python.org/cpython/rev/cf57ef65bcd0 > changeset: 74194:cf57ef65bcd0 > user: Antoine Pitrou <solip...@pitrou.net> > date: Thu Dec 29 18:54:15 2011 +0100 > summary: > Issue #12715: Add an optional symlinks argument to shutil functions > (copyfile, copymode, copystat, copy, copy2). > When that parameter is true, symlinks aren't dereferenced and the operation > instead acts on the symlink itself (or creates one, if relevant). > > Patch by Hynek Schlawack. > > files: > Doc/library/shutil.rst | 46 ++++- > Lib/shutil.py | 101 +++++++++--- > Lib/test/test_shutil.py | 219 ++++++++++++++++++++++++++++ > Misc/NEWS | 5 + > 4 files changed, 333 insertions(+), 38 deletions(-) > > > diff --git a/Doc/library/shutil.rst b/Doc/library/shutil.rst > --- a/Doc/library/shutil.rst > +++ b/Doc/library/shutil.rst > @@ -45,7 +45,7 @@ > be copied. > > > -.. function:: copyfile(src, dst) > +.. function:: copyfile(src, dst[, symlinks=False]) > > Copy the contents (no metadata) of the file named *src* to a file named > *dst*. > *dst* must be the complete target file name; look at :func:`copy` for a > copy that > @@ -56,37 +56,56 @@ > such as character or block devices and pipes cannot be copied with this > function. *src* and *dst* are path names given as strings. > > + If *symlinks* is true and *src* is a symbolic link, a new symbolic link > will > + be created instead of copying the file *src* points to. > + > .. versionchanged:: 3.3 > :exc:`IOError` used to be raised instead of :exc:`OSError`. > + Added *symlinks* argument.
Can we expect that readers on Windows know how os.symlink works, or should the stipulations of os.symlink usage also be laid out or at least linked to from there? Basically, almost everyone is going to get an OSError if they call this on Windows. You have to be on Windows Vista or beyond *and* the calling process has to have the proper privileges (typically gained through elevation - "Run as Administrator"). _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com