correctly handle pax_global_header for untar on python < 2.6

This commit is contained in:
Ronny Pfannschmidt 2010-09-07 19:26:13 +02:00
parent d921b1dc55
commit 8bc74a9261
3 changed files with 15 additions and 1 deletions

View File

@ -400,9 +400,15 @@ def untar_file(filename, location):
mode = 'r:*'
tar = tarfile.open(filename, mode)
try:
leading = has_leading_dir([member.name for member in tar.getmembers()])
# note: python<=2.5 doesnt seem to know about pax headers, filter them
leading = has_leading_dir([
member.name for member in tar.getmembers()
if member.name != 'pax_global_header'
])
for member in tar.getmembers():
fn = member.name
if fn=='pax_global_header':
continue
if leading:
fn = split_leading_dir(fn)[1]
path = os.path.join(location, fn)

Binary file not shown.

View File

@ -380,6 +380,14 @@ def test_install_global_option():
assert '0.1\n' in result.stdout
def test_install_with_pax_header():
"""
test installing from a tarball with pax header for python<2.6
"""
reset_env()
run_from = abspath(join(here, 'packages'))
result = run_pip('install', 'paxpkg.tar.bz2', cwd=run_from)
def test_install_using_install_option_and_editable():
"""
Test installing a tool using -e and --install-option