forked from qt-creator/qt-creator
Filter debug info out when creating macOS disk image
Move the script to Python for that, for code sharing Change-Id: I1a0b1ed7fe3ed4413045d478c82621d75800520e Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
This commit is contained in:
@@ -45,28 +45,13 @@ def parse_arguments():
|
||||
parser.add_argument('source_directory', help='source directory with the Qt Creator installation')
|
||||
return parser.parse_args()
|
||||
|
||||
def is_debug_file(filepath):
|
||||
if common.is_mac_platform():
|
||||
return filepath.endswith('.dSYM') or '.dSYM/' in filepath
|
||||
elif common.is_linux_platform():
|
||||
return filepath.endswith('.debug')
|
||||
else:
|
||||
return filepath.endswith('.pdb')
|
||||
|
||||
def is_debug(path, filenames):
|
||||
return [fn for fn in filenames if is_debug_file(os.path.join(path, fn))]
|
||||
|
||||
def is_not_debug(path, filenames):
|
||||
files = [fn for fn in filenames if os.path.isfile(os.path.join(path, fn))]
|
||||
return [fn for fn in files if not is_debug_file(os.path.join(path, fn))]
|
||||
|
||||
def main():
|
||||
arguments = parse_arguments()
|
||||
tempdir_base = tempfile.mkdtemp()
|
||||
tempdir = os.path.join(tempdir_base, os.path.basename(arguments.source_directory))
|
||||
try:
|
||||
common.copytree(arguments.source_directory, tempdir, symlinks=True,
|
||||
ignore=(is_not_debug if arguments.debug else is_debug))
|
||||
ignore=(common.is_not_debug if arguments.debug else common.is_debug))
|
||||
zip_source = os.path.join(tempdir, '*') if arguments.exclude_toplevel else tempdir
|
||||
subprocess.check_call([arguments.sevenzip, 'a', '-mx9',
|
||||
arguments.target_archive, zip_source])
|
||||
|
||||
Reference in New Issue
Block a user