From e621255052a2a679014c49e417d0c13ad824dc9e Mon Sep 17 00:00:00 2001 From: Keshav Priyadarshi Date: Mon, 18 Mar 2024 21:30:14 +0530 Subject: [PATCH] Run ctags and xgettext only on source code files Signed-off-by: Keshav Priyadarshi --- setup.cfg | 1 + src/source_inspector/strings_xgettext.py | 4 ++++ src/source_inspector/symbols_ctags.py | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/setup.cfg b/setup.cfg index 5efcbdc..27c34aa 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,6 +44,7 @@ install_requires = scancode-toolkit plugincode commoncode + typecode [options.packages.find] where = src diff --git a/src/source_inspector/strings_xgettext.py b/src/source_inspector/strings_xgettext.py index d6f13c9..4887787 100644 --- a/src/source_inspector/strings_xgettext.py +++ b/src/source_inspector/strings_xgettext.py @@ -17,6 +17,7 @@ from commoncode.cliutils import PluggableCommandLineOption from plugincode.scan import ScanPlugin from plugincode.scan import scan_impl +from typecode.contenttype import Type """ Extract strinsg from source code files with xgettext. @@ -67,6 +68,9 @@ def collect_strings(location, clean=True): if not is_xgettext_installed(): return + if not Type(location).is_source: + return + rc, result, err = command.execute( cmd_loc="xgettext", args=[ diff --git a/src/source_inspector/symbols_ctags.py b/src/source_inspector/symbols_ctags.py index 0760c6e..d5d6872 100644 --- a/src/source_inspector/symbols_ctags.py +++ b/src/source_inspector/symbols_ctags.py @@ -17,6 +17,7 @@ from commoncode.cliutils import PluggableCommandLineOption from plugincode.scan import ScanPlugin from plugincode.scan import scan_impl +from typecode.contenttype import Type """ Extract symbols information from source code files with ctags. @@ -67,6 +68,9 @@ def collect_symbols(location): if not is_ctags_installed(): return + if not Type(location).is_source: + return + rc, result, err = command.execute( cmd_loc="ctags", args=["--output-format=json", "-f", "-", location],