|
50 | 50 | - in manifest file proper (such as a Maven POM, NPM package.json and many others) |
51 | 51 | - in binaries (such as an Elf or LKM, Windows PE or RPM header). |
52 | 52 | - in code (JavaDoc tags or Python __copyright__ magic) |
| 53 | +
|
53 | 54 | There are collectively named "manifests" in ScanCode. |
54 | 55 |
|
55 | 56 | We handle package information at two levels: |
|
60 | 61 |
|
61 | 62 | The second requires the first to be computed. |
62 | 63 |
|
63 | | -Class Hierarchy: |
64 | | -
|
65 | | -Base Classes: (Classes to be inherited) |
| 64 | +These are case classes to extend: |
66 | 65 |
|
67 | 66 | - Package: |
68 | | - Base Data class with package data |
| 67 | + Base class with shared package attributes and methods. |
69 | 68 | - PackageManifest: |
70 | | - Mixin class with manifest specific data and methods |
| 69 | + Mixin class that represents a specific package manifest file. |
71 | 70 | - PackageInstance: |
72 | | - Mixin class with package instance specific data and methods |
73 | | -
|
74 | | -- Package Ecosystem: (Classes which would have object instances) |
75 | | -
|
76 | | -- EcosystemPackage(Package): |
77 | | - A class with ecosystem specific data (and data specific methods) |
78 | | -- EcosystemPackageManifest(EcosystemPackage, PackageManifest): |
79 | | - A class that overides and implements package manifest methods for that ecosystem |
80 | | -- EcosystemPackageInstance(EcosystemPackage, PackageInstance): |
81 | | - A class that overrides and implements package instance methods for that ecosystem |
| 71 | + Mixin class that represents a package that's constructed from one or more |
| 72 | + package manifests. It also tracks package files. |
| 73 | +
|
| 74 | +Here is an example of the classes that would need to exist to support a new fictitious |
| 75 | +package type or ecosystem `dummy`. |
| 76 | +
|
| 77 | +- DummyPackage(Package): |
| 78 | + This class provides type wide defaults and basic implementation for type specific methods. |
| 79 | +- DummyManifest(DummyPackage, PackageManifest): |
| 80 | + This class provides methods to recognize and parse a package manifest file format. |
| 81 | +- DummyPackageInstance(DummyPackage, PackageInstance): |
| 82 | + This class provides methods to create package instances for one or more manifests and to |
| 83 | + collect package file paths. |
82 | 84 | """ |
83 | 85 |
|
84 | 86 | SCANCODE_DEBUG_PACKAGE_API = os.environ.get('SCANCODE_DEBUG_PACKAGE_API', False) |
@@ -685,7 +687,8 @@ class PackageManifest: |
685 | 687 | """ |
686 | 688 | A mixin for package manifest that can be recognized. |
687 | 689 |
|
688 | | - Subclasses must extend a Package subclass for a given ecosystem. |
| 690 | + When creating a new package manifest, a class should be created that extends |
| 691 | + both PackageManifest and Package. |
689 | 692 | """ |
690 | 693 |
|
691 | 694 | # class-level attributes used to recognize a package |
@@ -828,25 +831,6 @@ class JBossSar(Package, PackageManifest): |
828 | 831 | default_primary_language = 'Java' |
829 | 832 |
|
830 | 833 |
|
831 | | -@attr.s() |
832 | | -class IvyJar(JavaJar): |
833 | | - file_patterns = ('ivy.xml',) |
834 | | - default_type = 'ivy' |
835 | | - default_primary_language = 'Java' |
836 | | - |
837 | | - |
838 | | -# FIXME: move to bower.py |
839 | | -@attr.s() |
840 | | -class BowerPackage(Package, PackageManifest): |
841 | | - file_patterns = ('bower.json',) |
842 | | - default_type = 'bower' |
843 | | - default_primary_language = 'JavaScript' |
844 | | - |
845 | | - @classmethod |
846 | | - def get_package_root(cls, manifest_resource, codebase): |
847 | | - return manifest_resource.parent(codebase) |
848 | | - |
849 | | - |
850 | 834 | @attr.s() |
851 | 835 | class MeteorPackage(Package, PackageManifest): |
852 | 836 | file_patterns = ('package.js',) |
|
0 commit comments