scancode-toolkit icon indicating copy to clipboard operation
scancode-toolkit copied to clipboard

Update DatafileHandler default methods

Open JonoYang opened this issue 3 years ago • 1 comments
trafficstars

This PR updates DatafileHandler.assemble() and DatafileHandler.assemble_from_many() to yield Packages, Dependencies, and Resources before associating Packages to Resources using a package_adder. This is to help with using packagedcode Package handlers in scancode.io, where a Package needs to be created in scancode.io before it can be associated with a Resource.

JonoYang avatar Aug 04 '22 21:08 JonoYang

On second thought, it makes more sense to sort the assembly items after the fact in scancode.io than it is to mandate every .assembly() method yields Packages, Dependencies, and Resources in that order.

JonoYang avatar Aug 04 '22 22:08 JonoYang

@pombredanne

I've updated the rest of the assemble() methods to yield Packages before other assembly items. I tried sorting the output of the assemble() method in my code on scancode.io, but it doesn't seem that there is a way around reordering the logic in the different assemble() methods when we want to create a Package before associating it to a Resource.

JonoYang avatar Aug 11 '22 19:08 JonoYang