Skip to content

Commit cf2b2d5

Browse files
committed
Backport changes from #3315 to v31.2.6
Signed-off-by: Jono Yang <jyang@nexb.com>
1 parent fb0015c commit cf2b2d5

55 files changed

Lines changed: 5748 additions & 1167 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ chardet==5.0.0
99
charset-normalizer==2.1.0
1010
click==8.1.3
1111
colorama==0.4.5
12-
commoncode==31.0.0
12+
commoncode==31.0.2
1313
construct==2.10.68
1414
container-inspector==31.1.0
1515
cryptography==37.0.4
@@ -48,7 +48,7 @@ pefile==2022.5.30
4848
pip-requirements-parser==32.0.1
4949
pkginfo2==30.0.0
5050
pluggy==1.0.0
51-
plugincode==31.0.0
51+
plugincode==32.0.0
5252
ply==3.11
5353
publicsuffix2==2.20191221
5454
pyahocorasick==2.0.0b1

setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ install_requires =
6868
chardet >= 3.0.0
6969
click >= 6.7, !=7.0
7070
colorama >= 0.3.9
71-
commoncode >= 31.0.0
71+
commoncode >= 31.0.2
7272
container-inspector >= 31.0.0
7373
debian-inspector >= 31.0.0
7474
dparse2 >= 0.7.0
@@ -95,7 +95,7 @@ install_requires =
9595
pkginfo2 >= 30.0.0
9696
pip-requirements-parser >= 32.0.1
9797
pluggy >= 1.0.0
98-
plugincode >= 31.0.0
98+
plugincode >= 32.0.0
9999
publicsuffix2
100100
pyahocorasick >= 2.0.0b1
101101
pygmars >= 0.7.0
@@ -158,7 +158,6 @@ console_scripts =
158158
scancode_pre_scan =
159159
ignore = scancode.plugin_ignore:ProcessIgnore
160160
facet = summarycode.facet:AddFacet
161-
classify = summarycode.classify:FileClassifier
162161

163162

164163
# scancode_scan is the entry point for scan plugins that run a scan after the
@@ -190,6 +189,7 @@ scancode_post_scan =
190189
filter-clues = cluecode.plugin_filter_clues:RedundantCluesFilter
191190
consolidate = summarycode.plugin_consolidate:Consolidator
192191
licenses-reference = licensedcode.plugin_licenses_reference:LicensesReference
192+
classify = summarycode.classify:FileClassifier
193193

194194

195195
# scancode_output_filter is the entry point for filter plugins executed after

src/cluecode/plugin_copyright.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class CopyrightScanner(ScanPlugin):
2828
('authors',attr.ib(default=attr.Factory(list))),
2929
])
3030

31+
run_order = 4
3132
sort_order = 4
3233

3334
options = [

src/cluecode/plugin_email.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class EmailScanner(ScanPlugin):
2525
"""
2626
resource_attributes = dict(emails=attr.ib(default=attr.Factory(list)))
2727

28+
run_order = 8
2829
sort_order = 8
2930

3031
options = [

src/cluecode/plugin_filter_clues.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class RedundantCluesFilter(PostScanPlugin):
4141
Filter redundant clues (copyrights, authors, emails, and urls) that are
4242
already contained in a matched license text.
4343
"""
44+
run_order = 1
4445
sort_order = 1
4546

4647
options = [

src/cluecode/plugin_url.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class UrlScanner(ScanPlugin):
2626

2727
resource_attributes = dict(urls=attr.ib(default=attr.Factory(list)))
2828

29+
run_order = 10
2930
sort_order = 10
3031

3132
options = [

src/licensedcode/plugin_license.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class LicenseScanner(ScanPlugin):
8989
('percentage_of_license_text', attr.ib(default=0)),
9090
])
9191

92+
run_order = 2
9293
sort_order = 2
9394

9495
options = [

src/licensedcode/plugin_license_policy.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class LicensePolicy(PostScanPlugin):
2828

2929
resource_attributes = dict(license_policy=attr.ib(default=attr.Factory(dict)))
3030

31+
run_order = 9
3132
sort_order = 9
3233

3334
options = [

src/packagedcode/maven.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,21 @@ def assign_package_to_resources(cls, package, resource, codebase, package_adder)
155155
def compute_normalized_license(cls, package):
156156
return compute_normalized_license(declared_license=package.declared_license)
157157

158+
@classmethod
159+
def get_top_level_resources(cls, manifest_resource, codebase):
160+
"""
161+
Yield Resources that are top-level based on a JAR's directory structure
162+
"""
163+
if 'META-INF' in manifest_resource.path:
164+
path_segments = manifest_resource.path.split('META-INF')
165+
leading_segment = path_segments[0].strip()
166+
meta_inf_dir_path = f'{leading_segment}/META-INF'
167+
meta_inf_resource = codebase.get_resource(meta_inf_dir_path)
168+
if meta_inf_resource:
169+
yield meta_inf_resource
170+
yield from meta_inf_resource.walk(codebase)
171+
172+
158173
# TODO: assemble with its pom!!
159174
class MavenPomPropertiesHandler(models.NonAssemblableDatafileHandler):
160175
datasource_id = 'maven_pom_properties'

src/packagedcode/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,13 @@ def create_default_package_data(cls, **kwargs):
12011201
**kwargs,
12021202
)
12031203

1204+
@classmethod
1205+
def get_top_level_resources(cls, manifest_resource, codebase):
1206+
"""
1207+
Yield Resources that are considered top-level for a Package type.
1208+
"""
1209+
pass
1210+
12041211

12051212
class NonAssemblableDatafileHandler(DatafileHandler):
12061213
"""

0 commit comments

Comments
 (0)