4
4
that sort of thing)."""
5
5
6
6
import os
7
- import sys
8
- from warnings import warn
9
7
10
8
try :
11
9
import zipfile
@@ -67,8 +65,7 @@ def make_tarball(
67
65
"""Create a (possibly compressed) tar file from all the files under
68
66
'base_dir'.
69
67
70
- 'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or
71
- None. ("compress" will be deprecated in Python 3.2)
68
+ 'compress' must be "gzip" (the default), "bzip2", "xz", or None.
72
69
73
70
'owner' and 'group' can be used to define an owner and a group for the
74
71
archive that is being built. If not provided, the current owner and group
@@ -84,20 +81,17 @@ def make_tarball(
84
81
'bzip2' : 'bz2' ,
85
82
'xz' : 'xz' ,
86
83
None : '' ,
87
- 'compress' : '' ,
88
84
}
89
- compress_ext = {'gzip' : '.gz' , 'bzip2' : '.bz2' , 'xz' : '.xz' , 'compress' : '.Z' }
85
+ compress_ext = {'gzip' : '.gz' , 'bzip2' : '.bz2' , 'xz' : '.xz' }
90
86
91
87
# flags for compression program, each element of list will be an argument
92
88
if compress is not None and compress not in compress_ext .keys ():
93
89
raise ValueError (
94
- "bad value for 'compress': must be None, 'gzip', 'bzip2', "
95
- "'xz' or 'compress'"
90
+ "bad value for 'compress': must be None, 'gzip', 'bzip2', 'xz'"
96
91
)
97
92
98
93
archive_name = base_name + '.tar'
99
- if compress != 'compress' :
100
- archive_name += compress_ext .get (compress , '' )
94
+ archive_name += compress_ext .get (compress , '' )
101
95
102
96
mkpath (os .path .dirname (archive_name ), dry_run = dry_run )
103
97
@@ -125,18 +119,6 @@ def _set_uid_gid(tarinfo):
125
119
finally :
126
120
tar .close ()
127
121
128
- # compression using `compress`
129
- if compress == 'compress' :
130
- warn ("'compress' is deprecated." , DeprecationWarning )
131
- # the option varies depending on the platform
132
- compressed_name = archive_name + compress_ext [compress ]
133
- if sys .platform == 'win32' :
134
- cmd = [compress , archive_name , compressed_name ]
135
- else :
136
- cmd = [compress , '-f' , archive_name ]
137
- spawn (cmd , dry_run = dry_run )
138
- return compressed_name
139
-
140
122
return archive_name
141
123
142
124
0 commit comments