Fix tarfile issues by using GNU_FORMAT with Python 3.8 (see issue #2856)
This commit is contained in:
parent
53b98a5022
commit
c629c5bb59
|
@ -44,6 +44,10 @@ def create_tar_archive(input_dir, format):
|
||||||
# Supported formats include "gz" and "bz2".
|
# Supported formats include "gz" and "bz2".
|
||||||
tar_file = input_dir + '.tar.' + format
|
tar_file = input_dir + '.tar.' + format
|
||||||
tf = tarfile.open(tar_file, "w:" + format)
|
tf = tarfile.open(tar_file, "w:" + format)
|
||||||
|
# The default tar format changed from GNU_FORMAT to PAX_FORMAT in Python 3.8.
|
||||||
|
# However, PAX_FORMAT generates additional @PaxHeader entries and truncates file
|
||||||
|
# names on Windows, so we'll stick with the previous default.
|
||||||
|
tf.format = tarfile.GNU_FORMAT
|
||||||
tf.add(input_dir, arcname=os.path.basename(input_dir))
|
tf.add(input_dir, arcname=os.path.basename(input_dir))
|
||||||
tf.close()
|
tf.close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue