aboutsummaryrefslogtreecommitdiffstats
path: root/jython-tosca-parser/src/main/resources/Lib/site-packages/setuptools/tests/py26compat.py
blob: c56808816e7b8435acb0b86e7ad59c923cde3d36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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