cpython: d1fd0f0f8e68 (original) (raw)

Mercurial > cpython

changeset 72039:d1fd0f0f8e68

#12191: add shutil.chown() to change user and/or group owner of a given path also specifying their names. [#12191]

Sandro Tosi sandro.tosi@gmail.com
date Mon, 22 Aug 2011 23:28:27 +0200
parents e3be2941c834
children a1267968f6ed
files Doc/library/os.rst Doc/library/shutil.rst Lib/shutil.py Lib/test/test_shutil.py Misc/NEWS
diffstat 5 files changed, 110 insertions(+), 0 deletions(-)[+] [-] Doc/library/os.rst 3 Doc/library/shutil.rst 14 Lib/shutil.py 31 Lib/test/test_shutil.py 59 Misc/NEWS 3

line wrap: on

line diff

--- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -1530,6 +1530,9 @@ Files and Directories Change the owner and group id of path to the numeric uid and gid. To leave one of the ids unchanged, set it to -1.

--- a/Doc/library/shutil.rst +++ b/Doc/library/shutil.rst @@ -183,6 +183,20 @@ Directory and files operations Availability: Unix, Windows. +.. function:: chown(path, user=None, group=None) +

+ .. exception:: Error This exception collects exceptions that are raised during a multi-file

--- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -790,3 +790,34 @@ elif os.name == 'nt': total, free = nt._getdiskusage(path) used = total - free return _ntuple_diskusage(total, used, free) + +def chown(path, user=None, group=None):

+

+

+

+

+

+

--- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -712,6 +712,65 @@ class TestShutil(unittest.TestCase): self.assertGreaterEqual(usage.total, usage.used) self.assertGreater(usage.total, usage.free)

+

+

+

+

+

+

+

+

+

+

+

+ class TestMove(unittest.TestCase):

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -1144,6 +1144,9 @@ Library