# now create another tarball using `tar`
tarball2 = os.path.join(root_dir, 'archive2.tar')
tar_cmd = ['tar', '-cf', 'archive2.tar', base_dir]
+ if sys.platform == 'darwin':
+ # macOS tar can include extended attributes,
+ # ACLs and other mac specific metadata into the
+ # archive (an recentish version of the OS).
+ #
+ # This feature can be disabled with the
+ # '--no-mac-metadata' option on macOS 11 or
+ # later.
+ import platform
+ if int(platform.mac_ver()[0].split('.')[0]) >= 11:
+ tar_cmd.insert(1, '--no-mac-metadata')
subprocess.check_call(tar_cmd, cwd=root_dir,
stdout=subprocess.DEVNULL)