File: py26compat.py

package info (click to toggle)
python-setuptools 33.1.1-1~bpo8%2B1
  • links: PTS
  • area: main
  • in suites: jessie-backports
  • size: 2,852 kB
  • sloc: python: 19,087; ansic: 195; makefile: 97; xml: 14
file content (16 lines) | stat: -rw-r--r-- 355 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import sys
import tarfile
import contextlib


def _tarfile_open_ex(*args, **kwargs):
    """
    Extend result as a context manager.
    """
    return contextlib.closing(tarfile.open(*args, **kwargs))


if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[:2] < (3, 2):
    tarfile_open = _tarfile_open_ex
else:
    tarfile_open = tarfile.open