From 30728f107579f8706a4f3e644465d1bcc1a6504f Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Thu, 10 Dec 2020 17:33:38 +0100 Subject: Clean image folder and archive file before downloading/generating those This matters when reusing output folders (as binary factory does for example), as we then retain outdated screenshots and just keep adding files to an already existing fastlane archive. --- toolchain/generate-fastlane-metadata.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'toolchain/generate-fastlane-metadata.py') diff --git a/toolchain/generate-fastlane-metadata.py b/toolchain/generate-fastlane-metadata.py index fe7faca8..db09de74 100755 --- a/toolchain/generate-fastlane-metadata.py +++ b/toolchain/generate-fastlane-metadata.py @@ -15,6 +15,7 @@ import io import os import re import requests +import shutil import subprocess import sys import tempfile @@ -132,6 +133,7 @@ def downloadScreenshots(applicationName, data): basePath = arguments.output path = os.path.join(basePath, 'metadata', applicationName, 'en-US', 'images', 'phoneScreenshots') + shutil.rmtree(path, ignore_errors=True) os.makedirs(path, exist_ok=True) i = 0 @@ -148,7 +150,9 @@ def downloadScreenshots(applicationName, data): # into the F-Droid nightly repository def createMetadataArchive(applicationName): srcPath = os.path.join(arguments.output, 'metadata') - archive = zipfile.ZipFile(os.path.join(srcPath, 'fastlane-' + applicationName + '.zip'), 'w') + zipFileName = os.path.join(srcPath, 'fastlane-' + applicationName + '.zip') + os.unlink(zipFileName) + archive = zipfile.ZipFile(zipFileName, 'w') archive.write(os.path.join(srcPath, applicationName + '.yml'), applicationName + '.yml') oldcwd = os.getcwd() -- cgit v1.2.1