Issue with "demos/gtk-demo/geninclude.py"
I note that running geninclude.py
on some files that does not contain any
C comments (/* ... */
), this script goes into an infinite loop.
Since this never becomes True
:
line = f.readline().strip()
while not line.endswith('*/'):
...
This happens for demo4widget.c
and hsla.c
in my case.
I tried to fix it by adding /* */
at the end of these files.
But perhaps this patch is better?:
--- a/geninclude.py 2022-02-24 13:13:51
+++ b/geninclude.py 2023-04-14 08:15:02
@@ -52,13 +52,16 @@
with open(demo_file, 'r', encoding='utf-8') as f:
title = f.readline().replace("/*", "").strip()
keywords = set()
- line = f.readline().strip();
+ line = f.readline().strip()
while not line.endswith('*/'):
if line.startswith("* #Keywords:"):
keywords = keywords.union(set(map(wordify, line.replace ("* #Keywords:", "").strip().split(","))))
else:
keywords = keywords.union(set(filter(is_keyword, map(wordify, line.replace ("* ", "").split()))))
- line = f.readline().strip()
+ line = f.readline()
+ if not line:
+ break
+ line = line.strip()
file_output += "GtkWidget *do_" + demo_name + " (GtkWidget *do_widget);\n"
demos.append((demo_name, title, keywords, filename, "do_" + demo_name, -1))
(hope this issue gets through. Gitlab had big issues when I wrote this here).