From ba99c18fc90d7f7af5735a74014d7122290d2fc4 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 19 Sep 2019 14:08:13 -0700 Subject: [PATCH] Explicitly set permissions of the files and folders in the source tarball --- build.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build.py b/build.py index a23a3f64..c75458bb 100755 --- a/build.py +++ b/build.py @@ -915,6 +915,17 @@ def do_regenerate_sysconfig(): del pwd +def _setTarItemPerms(tarinfo): + """ + Used to set permissions of the files and fodlers in the source tarball + """ + if tarinfo.isdir(): + tarinfo.mode = 0o755 + else: + tarinfo.mode = 0o644 + return tarinfo + + #--------------------------------------------------------------------------- # Command functions and helpers #--------------------------------------------------------------------------- @@ -2018,7 +2029,7 @@ def cmd_sdist(options, args): tarball = tarfile.open(name=tarfilename, mode="w:gz") pwd = pushDir(PDEST) for name in glob.glob('*'): - tarball.add(name, os.path.join(rootname, name)) + tarball.add(name, os.path.join(rootname, name), filter=_setTarItemPerms) tarball.close() msg('Cleaning up...') del pwd