Skip to content

Commit 703d7cc

Browse files
committed
update: package models have license_clarity_score only if package-summary as Postscan Plugin
Signed-off-by: swastik <swastkk@gmail.com>
1 parent 0c93d6d commit 703d7cc

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/packagedcode/plugin_package.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,6 @@ class PackageScanner(ScanPlugin):
184184
help='Show the list of supported package manifest parsers and exit.',
185185
help_group=DOC_GROUP,
186186
),
187-
PluggableCommandLineOption(
188-
('--package-summary',),
189-
is_flag=True,
190-
default=False,
191-
help='Generate Package Level summary',
192-
help_group=POST_SCAN_GROUP,
193-
),
194187
]
195188

196189
def is_enabled(self, package, system_package, package_only, **kwargs):
@@ -209,7 +202,7 @@ def get_scanner(self, package=True, system_package=False, package_only=False, **
209202
package_only=package_only,
210203
)
211204

212-
def process_codebase(self, codebase, strip_root=False, package_only=False, **kwargs):
205+
def process_codebase(self, codebase, strip_root=False, package_only=False, package_summary=False, **kwargs):
213206
"""
214207
Populate the ``codebase`` top level ``packages`` and ``dependencies``
215208
with package and dependency instances, assembling parsed package data
@@ -269,7 +262,7 @@ def process_codebase(self, codebase, strip_root=False, package_only=False, **kwa
269262
logger_debug(f'packagedcode: process_codebase: add_license_from_sibling_file: modified: {modified}')
270263

271264
# Create codebase-level packages and dependencies
272-
create_package_and_deps(codebase, strip_root=strip_root, **kwargs)
265+
create_package_and_deps(codebase, package_summary, strip_root=strip_root, **kwargs)
273266
#raise Exception()
274267

275268
if has_licenses:
@@ -288,7 +281,7 @@ class PackageSummary(PostScanPlugin):
288281
"""
289282
run_order = 8
290283
sort_order= 8
291-
284+
292285
options = [
293286
PluggableCommandLineOption(('--package-summary',),
294287
is_flag=True, default=False,
@@ -305,6 +298,7 @@ def process_codebase(self, codebase, package_summary, **kwargs):
305298
"""
306299
if not self.is_enabled(package_summary):
307300
return
301+
308302

309303
def add_license_from_file(resource, codebase):
310304
"""
@@ -385,7 +379,7 @@ def get_installed_packages(root_dir, processes=2, **kwargs):
385379
yield from packages_by_uid.values()
386380

387381

388-
def create_package_and_deps(codebase, package_adder=add_to_package, strip_root=False, **kwargs):
382+
def create_package_and_deps(codebase, package_summary ,package_adder=add_to_package, strip_root=False, **kwargs):
389383
"""
390384
Create and save top-level Package and Dependency from the parsed
391385
package data present in the codebase.
@@ -397,7 +391,7 @@ def create_package_and_deps(codebase, package_adder=add_to_package, strip_root=F
397391
**kwargs
398392
)
399393

400-
codebase.attributes.packages.extend(package.to_dict() for package in packages)
394+
codebase.attributes.packages.extend(package.to_dict(package_summary) for package in packages)
401395
codebase.attributes.dependencies.extend(dep.to_dict() for dep in dependencies)
402396

403397

0 commit comments

Comments
 (0)