scancode-toolkit
scancode-toolkit copied to clipboard
Update DatafileHandler default methods
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.
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.
@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.