Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
windows/packaging py: Use os.walk
Freya Lupenb4795388cb33
diff --git a/build-tools/ci-scripts/sign-windows-package-at-notary-service.py b/build-tools/ci-scripts/sign-windows-package-at-notary-service.pyindex 9b13d56b21..7c8770caa4 100644--- a/build-tools/ci-scripts/sign-windows-package-at-notary-service.py+++ b/build-tools/ci-scripts/sign-windows-package-at-notary-service.py@@ -24,10 +24,11 @@ if not os.path.isfile(KRITACI_WINDOWS_SIGN_CONFIG):exit(1)with open("files-to-sign.txt", 'w') as toSign:- with os.scandir(pkg_root) as pkg_files:- for entry in pkg_files:- if entry.is_file() and entry.name.endswith(('.exe', '.com', '.dll', '.pyd')):- print(entry.path, file=toSign)+ for rootPath, dirs, files in os.walk(pkg_root):+ for fileName in files:+ if fileName.endswith(('.exe', '.com', '.dll', '.pyd')):+ filePath = os.path.join(rootPath, fileName)+ print(filePath, file=toSign)commandToRun = "python.exe -u ci-notary-service/signwindowsbinaries.py --config %KRITACI_WINDOWS_SIGN_CONFIG% --files-from files-to-sign.txt"subprocess.check_call(commandToRun, stdout=sys.stdout, stderr=sys.stderr, shell=True )diff --git a/packaging/windows/msix/build_msix.py b/packaging/windows/msix/build_msix.pyindex 7c1f37d600..536c871f2a 100644--- a/packaging/windows/msix/build_msix.py+++ b/packaging/windows/msix/build_msix.py@@ -193,12 +193,16 @@ print(fr'"{environ['SCRIPT_DIR']}manifest.xml" "AppxManifest.xml"', file=OUT_TEMprint(fr'"{environ['OUTPUT_DIR']}\resources.pri" "Resources.pri"', file=OUT_TEMP)# Krita application files:-for f in os.scandir(environ['KRITA_DIR']):- print(fr'"{f}" "krita\{os.path.relpath(f, environ['KRITA_DIR'])}"', file=OUT_TEMP)+for root, dirs, files in os.walk(environ['KRITA_DIR']):+ for file in files:+ f = os.path.join(root, file)+ print(fr'"{f}" "krita\{os.path.relpath(f, environ['KRITA_DIR'])}"', file=OUT_TEMP)# Assets:-for f in os.scandir(environ['ASSETS_DIR']):- print(fr'"{f}" "Assets\{os.path.relpath(f, environ['ASSETS_DIR'])}"', file=OUT_TEMP)+for root, dirs, files in os.walk(environ['ASSETS_DIR']):+ for file in files:+ f = os.path.join(root, file)+ print(fr'"{f}" "Assets\{os.path.relpath(f, environ['ASSETS_DIR'])}"', file=OUT_TEMP)shutil.copy(OUT_TEMP, environ['MAPPING_OUT'])os.remove(OUT_TEMP)diff --git a/packaging/windows/sign-package.py b/packaging/windows/sign-package.pyindex a90d4d4f43..10b7f23a1b 100644--- a/packaging/windows/sign-package.py+++ b/packaging/windows/sign-package.py@@ -40,21 +40,22 @@ if not os.path.isdir(pkg_root):print(f"ERROR: No packaging dir {pkg_root}")exit(1)-with os.scandir(pkg_root) as pkg_files:- for entry in pkg_files:- if entry.is_file() and entry.name.endswith(('.exe', '.com', '.dll', '.pyd')):+for rootPath, dirs, files in os.walk(pkg_root):+ for fileName in files:+ if fileName.endswith(('.exe', '.com', '.dll', '.pyd')):+ filePath = os.path.join(rootPath, fileName)# Check for existing signature- commandToRun = f'"%SIGNTOOL%" verify /q /pa "{entry.name}"'+ commandToRun = f'"%SIGNTOOL%" verify /q /pa "{filePath}"'try:subprocess.check_call(commandToRun, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, shell=True)except subprocess.CalledProcessError as status:if status.returncode == 1:- print(f"Signing {entry.path}")+ print(f"Signing {filePath}")try:- commandToRun = f'"%SIGNTOOL%" sign %SIGNTOOL_SIGN_FLAGS% "{entry.path}"'+ commandToRun = f'"%SIGNTOOL%" sign %SIGNTOOL_SIGN_FLAGS% "{filePath}"'subprocess.check_call(commandToRun, stdout=sys.stdout, stderr=sys.stderr, shell=True)except subprocess.CalledProcessError as status:print(f"ERROR: Got exit code {status.returncode} from signtool!")exit(1)else:- print(f"Not signing {entry.path} - file already signed")+ print(f"Not signing {filePath} - file already signed")