I saw the recent change to 'tools/make-dissector-reg.py' to allow
reading list of files from a file; the argument "dissectorsinfile". I find this
a bit awkward. Isn't it better to use the more familiar response-file syntax?
So the command to generate register.c would be something like:
@$(PYTHON) "../../tools/make-dissector-reg.py" . dissectors \
@$(some_temp_file_with_all_dissectors_src)
Not sure how to best produce this temp_file. But certainly not one
file per line as the snippet:
files = [line.rstrip() for line in dissector_f]
indicates. 'dissector_f.read().split()' would be more robust I think.
So what about this patch:
--- orig/tools/make-dissector-reg.py 2013-12-10 21:58:26 +0000
+++ tools/make-dissector-reg.py 2013-12-11 13:00:59 +0000
@@ -42,7 +42,7 @@
* Generated automatically from %s.
*/
""" % (sys.argv[0])
-elif registertype in ("dissectors", "dissectorsinfile"):
+elif registertype == "dissectors":
final_filename = "register.c"
cache_filename = "register-cache.pkl"
preamble = """\
@@ -65,16 +65,18 @@
#
# All subsequent arguments are the files to scan
-# or the name of a file containing the files to scan
+# or the name of a '@response-file' containing the files to scan
#
-if registertype == "dissectorsinfile":
+if sys.argv[3][0] == '@':
+ resp_file = sys.argv[3][1:]
try:
- dissector_f = open(sys.argv[3])
+ file = open(resp_file)
except IOError:
- print(("Unable to open input file '%s'" % sys.argv[3]))
+ print(("Unable to open response-file '%s'" % resp_file))
sys.exit(1)
-
- files = [line.rstrip() for line in dissector_f]
+ files = file.read().split()
+ file.close()
else:
files = sys.argv[3:]
--------------
BTW. You forgot a 'dissector_f.close()'.
--gv