Commits

Ronny Pfannschmidt committed 9574151

correctly handle pax_global_header for untar on python < 2.6

Comments (0)

Files changed (3)

         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)

tests/packages/paxpkg.tar.bz2

Binary file added.

tests/test_basic.py

     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