diff --git a/gen_packed_apilevels.py b/gen_packed_apilevels.py index 0002ef62e05..ede5009cf10 100644 --- a/gen_packed_apilevels.py +++ b/gen_packed_apilevels.py @@ -69,9 +69,10 @@ def compress_tar_xz(inputs): for input in inputs: logging.info("Adding %s", input) - info = tar.gettarinfo(input) - info.name = os.path.basename(input) + # In case the inputs are symlinks, it's better to work with the file + # object outright. with open(input, "rb") as f: + info = tar.gettarinfo(arcname=os.path.basename(input), fileobj=f) tar.addfile(info, fileobj=f) tar.close() diff --git a/gen_simple_module.py b/gen_simple_module.py index 40888160575..6afe6027f00 100644 --- a/gen_simple_module.py +++ b/gen_simple_module.py @@ -69,9 +69,10 @@ def compress_tar_xz(inputs): for input in inputs: logging.info("Adding %s", input) - info = tar.gettarinfo(input) - info.name = os.path.basename(input) + # In case the inputs are symlinks, it's better to work with the file + # object outright. with open(input, "rb") as f: + info = tar.gettarinfo(arcname=os.path.basename(input), fileobj=f) tar.addfile(info, fileobj=f) tar.close()