diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-13 11:25:24 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2017-01-13 11:25:24 (GMT) |
commit | 4f76fb16b7e00dac91ea4089a28e06e8720e3294 (patch) | |
tree | bdce75f793f61b363952cd01355427953aa054bb /Lib/tarfile.py | |
parent | 62db0db5cb1ceadba7e47791f010582a4c577d9c (diff) | |
download | cpython-4f76fb16b7e00dac91ea4089a28e06e8720e3294.zip cpython-4f76fb16b7e00dac91ea4089a28e06e8720e3294.tar.gz cpython-4f76fb16b7e00dac91ea4089a28e06e8720e3294.tar.bz2 |
Issue #29210: Removed support of deprecated argument "exclude" in
tarfile.TarFile.add().
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-x | Lib/tarfile.py | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 5d4c86c..c3777ff 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1897,13 +1897,12 @@ class TarFile(object): _safe_print("link to " + tarinfo.linkname) print() - def add(self, name, arcname=None, recursive=True, exclude=None, *, filter=None): + def add(self, name, arcname=None, recursive=True, *, filter=None): """Add the file `name' to the archive. `name' may be any type of file (directory, fifo, symbolic link, etc.). If given, `arcname' specifies an alternative name for the file in the archive. Directories are added recursively by default. This can be avoided by - setting `recursive' to False. `exclude' is a function that should - return True for each filename to be excluded. `filter' is a function + setting `recursive' to False. `filter' is a function that expects a TarInfo object argument and returns the changed TarInfo object, if it returns None the TarInfo object will be excluded from the archive. @@ -1913,15 +1912,6 @@ class TarFile(object): if arcname is None: arcname = name - # Exclude pathnames. - if exclude is not None: - import warnings - warnings.warn("use the filter argument instead", - DeprecationWarning, 2) - if exclude(name): - self._dbg(2, "tarfile: Excluded %r" % name) - return - # Skip if somebody tries to archive the archive... if self.name is not None and os.path.abspath(name) == self.name: self._dbg(2, "tarfile: Skipped %r" % name) @@ -1953,7 +1943,7 @@ class TarFile(object): if recursive: for f in os.listdir(name): self.add(os.path.join(name, f), os.path.join(arcname, f), - recursive, exclude, filter=filter) + recursive, filter=filter) else: self.addfile(tarinfo) |