Skip to contentSkip to conversation

license_image.bbclass: close package.manifest file

PATCH New Martin Jansa 1 participant 1 message Apr 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 license_image.bbclass: close package.manifest file

* fixes:
NOTE: Executing write_package_manifest ...
DEBUG: Executing python function write_package_manifest
/OE/build/oe-core/openembedded-core/meta/classes/license_image.bbclass:23: ResourceWarning: unclosed file <_io.TextIOWrapper name='/OE/build/oe-core/tmp-glibc/deploy/licenses/core-image-minimal-qemux86-64/package.manifest' mode='w+' encoding='UTF-8'>

    'w+').write(output)

ResourceWarning: Enable tracemalloc to get the object allocation traceback
DEBUG: Python function write_package_manifest finished

[YOCTO #14772]

---
 meta/classes/license_image.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/license_image.bbclass +2 -2
index 0a5ea0a2fb..7e1d0e08a9 100644
@@ -19,8 +19,8 @@ python write_package_manifest() {
 
     pkgs = image_list_installed_packages(d)
     output = format_pkg_list(pkgs)
-    open(os.path.join(license_image_dir, 'package.manifest'),
-        'w+').write(output)
+    with open(os.path.join(license_image_dir, 'package.manifest'), "w+") as package_manifest:
+        package_manifest.write(output)
 }
 
 python license_create_manifest() {
Signature · 1 line
2.35.1