File licenses.py-FileNotFoundError.patch of Package nodejs-electron

[154/40125] python3 ../../tools/licenses/licenses.py --target-os=linux --depfile gen/components/resources/about_credits.d credits gen/components/resources/about_credits.html
FAILED: gen/components/resources/about_credits.html 
python3 ../../tools/licenses/licenses.py --target-os=linux --depfile gen/components/resources/about_credits.d credits gen/components/resources/about_credits.html
Traceback (most recent call last):
  File "/home/abuild/rpmbuild/BUILD/src/out/Release/../../tools/licenses/licenses.py", line 1445, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/abuild/rpmbuild/BUILD/src/out/Release/../../tools/licenses/licenses.py", line 1428, in main
    if not GenerateCredits(
           ^^^^^^^^^^^^^^^^
  File "/home/abuild/rpmbuild/BUILD/src/out/Release/../../tools/licenses/licenses.py", line 1069, in GenerateCredits
    directory_metadata, _ = ParseDir(path,
                            ^^^^^^^^^^^^^^
  File "/home/abuild/rpmbuild/BUILD/src/out/Release/../../tools/licenses/licenses.py", line 670, in ParseDir
    if not os.listdir(os.path.join(root, path)):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/home/abuild/rpmbuild/BUILD/src/third_party/angle/src/common/third_party/xxhash'


--- src/tools/licenses/licenses.py.orig	2024-05-29 12:20:01.514877976 +0200
+++ src/tools/licenses/licenses.py	2024-05-29 22:54:04.691863557 +0200
@@ -667,7 +667,10 @@ def ParseDir(path,
     return [], []
 
   # gclient creates empty directories for conditionally downloaded submodules.
-  if not os.listdir(os.path.join(root, path)):
+  try:
+    if not os.listdir(os.path.join(root, path)):
+      return [], []
+  except FileNotFoundError: #This gets thrown if directory is missing instead of empty.
     return [], []
 
   # Get the metadata values, from
openSUSE Build Service is sponsored by