Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
832dd5f0
Commit
832dd5f0
authored
Feb 10, 2015
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #23421: Fixed compression in tarfile CLI. Patch by wdv4758h.
parent
22ef9f72
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
8 deletions
+26
-8
Lib/tarfile.py
Lib/tarfile.py
+8
-8
Lib/test/test_tarfile.py
Lib/test/test_tarfile.py
+15
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/tarfile.py
View file @
832dd5f0
...
...
@@ -2491,16 +2491,16 @@ def main():
_, ext = os.path.splitext(tar_name)
compressions = {
# gz
'gz': 'gz',
'tgz': 'gz',
'
.
gz': 'gz',
'
.
tgz': 'gz',
# xz
'xz': 'xz',
'txz': 'xz',
'
.
xz': 'xz',
'
.
txz': 'xz',
# bz2
'bz2': 'bz2',
'tbz': 'bz2',
'tbz2': 'bz2',
'tb2': 'bz2',
'
.
bz2': 'bz2',
'
.
tbz': 'bz2',
'
.
tbz2': 'bz2',
'
.
tb2': 'bz2',
}
tar_mode = 'w:' + compressions[ext] if ext in compressions else 'w'
tar_files = args.create
...
...
Lib/test/test_tarfile.py
View file @
832dd5f0
...
...
@@ -1994,6 +1994,21 @@ class CommandLineTest(unittest.TestCase):
finally
:
support
.
unlink
(
tar_name
)
def
test_create_command_compressed
(
self
):
files
=
[
support
.
findfile
(
'tokenize_tests.txt'
),
support
.
findfile
(
'tokenize_tests-no-coding-cookie-'
'and-utf8-bom-sig-only.txt'
)]
for
filetype
in
(
GzipTest
,
Bz2Test
,
LzmaTest
):
if
not
filetype
.
open
:
continue
try
:
tar_name
=
tmpname
+
'.'
+
filetype
.
suffix
out
=
self
.
tarfilecmd
(
'-c'
,
tar_name
,
*
files
)
with
filetype
.
taropen
(
tar_name
)
as
tar
:
tar
.
getmembers
()
finally
:
support
.
unlink
(
tar_name
)
def
test_extract_command
(
self
):
self
.
make_simple_tarfile
(
tmpname
)
for
opt
in
'-e'
,
'--extract'
:
...
...
Misc/NEWS
View file @
832dd5f0
...
...
@@ -13,8 +13,11 @@ Core and Builtins
Library
-------
- Issue #23421: Fixed compression in tarfile CLI. Patch by wdv4758h.
- Issue #23361: Fix possible overflow in Windows subprocess creation code.
What'
s
New
in
Python
3.4.3
rc1
?
==============================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment