[FIX] cloc: empty string in demo(_xml) or cloc_exclude

Before this commit:
calling `odoo-bin cloc -P <path_to_a_module>` when the manifest of a
module includes an empty string in the demo, demo_xml or cloc_exclude
entries, would result in a crash because an empty string is not an
acceptable pattern for Path.glob

to note: an empty string in those entries is technically wrong and will
cause issue during module install, but that shouldn't prevent the cloc
from giving correct results.

closes odoo/odoo#90650

X-original-commit: 93318b22fc8b7cf6344f789d2c45fc3f5b3269eb
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: Thibault Francois <tfr@odoo.com>
This commit is contained in:
Moens Alexandre
2022-05-09 11:25:24 +02:00
parent fe918d40b1
commit 06964fee08
+1 -1
View File
@@ -123,7 +123,7 @@ class Cloc(object):
pass
if not exclude:
exclude = set()
for i in exclude_list:
for i in filter(None, exclude_list):
exclude.update(str(p) for p in pathlib.Path(path).glob(i))
module_name = os.path.basename(path)