[2.7] bpo-34260, shutil: fix copy2 and copystat documentation (GH-852… · python/cpython@4a59c96 (original) (raw)

`@@ -105,7 +105,13 @@ def copymode(src, dst):

`

105

105

`os.chmod(dst, mode)

`

106

106

``

107

107

`def copystat(src, dst):

`

108

``

`-

"""Copy all stat info (mode bits, atime, mtime, flags) from src to dst"""

`

``

108

`+

"""Copy file metadata

`

``

109

+

``

110

`+

Copy the permission bits, last access time, last modification time, and

`

``

111

`` +

flags from src to dst. On Linux, copystat() also copies the "extended

``

``

112

`+

attributes" where possible. The file contents, owner, and group are

`

``

113

`` +

unaffected. src and dst are path names given as strings.

``

``

114

`+

"""

`

109

115

`st = os.stat(src)

`

110

116

`mode = stat.S_IMODE(st.st_mode)

`

111

117

`if hasattr(os, 'utime'):

`

`@@ -134,7 +140,10 @@ def copy(src, dst):

`

134

140

`copymode(src, dst)

`

135

141

``

136

142

`def copy2(src, dst):

`

137

``

`-

"""Copy data and all stat info ("cp -p src dst").

`

``

143

`+

"""Copy data and metadata. Return the file's destination.

`

``

144

+

``

145

`+

Metadata is copied with copystat(). Please see the copystat function

`

``

146

`+

for more information.

`

138

147

``

139

148

` The destination may be a directory.

`

140

149

``