Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
89efd09
Collect package_data_fields correctly in CSV
pombredanne Apr 22, 2022
3558de4
Streamline get_package_data() API
pombredanne Apr 22, 2022
affa5a9
Pass the Resource.id to scanner functions
pombredanne Apr 22, 2022
f3cdfb4
Remove package and dependency uuid from tests
pombredanne Apr 22, 2022
6ab3565
Refine package models
pombredanne Apr 22, 2022
2dd374f
Adopt new handler design for ABOUT files
pombredanne Apr 23, 2022
472fc31
Update testing utilities for package handlers
pombredanne Apr 23, 2022
fbdba2e
Adopt new handler design for Alpine Linux
pombredanne Apr 23, 2022
0752827
Adopt new handler design for Bower
pombredanne Apr 23, 2022
ba0ed20
Adopt new handler design for build scripts
pombredanne Apr 23, 2022
229d945
Adopt new handler design for Gradle build scripts
pombredanne Apr 23, 2022
66216d4
Adopt new handler design for Rust Cargo
pombredanne Apr 23, 2022
2813a7f
Adopt new handler design for chef cookbooks
pombredanne Apr 23, 2022
acd10b6
Adopt new handler design for Cocoapods
pombredanne Apr 23, 2022
c8ec5d1
Adopt new handler design for Conda
pombredanne Apr 23, 2022
f1a2cfa
Adopt new handler design for CRAN
pombredanne Apr 23, 2022
2c416c0
Adopt new handler design for Debian
pombredanne Apr 23, 2022
068b86d
Adopt new handler design for FreeBSD
pombredanne Apr 23, 2022
78523fc
Adopt new handler design for Conda
pombredanne Apr 23, 2022
8e84c6f
Modernize code for parsing Gemfile.lock
pombredanne Apr 23, 2022
2ccba8a
Adopt new handler design for Haxe
pombredanne Apr 23, 2022
2ad6761
Adopt new handler design for Maven and JARS
pombredanne Apr 23, 2022
b131074
Adopt new handler design for Windows packages
pombredanne Apr 23, 2022
fb93891
Adopt new handler design for Rubygems packages
pombredanne Apr 23, 2022
494b87d
Adopt new handler design for npm packages
pombredanne Apr 23, 2022
5a0650c
Adopt new handler design for OCaml OPAM
pombredanne Apr 23, 2022
8d67fd8
Adopt new handler design for npm packages
pombredanne Apr 23, 2022
1af5648
Adopt new handler design for RPMs
pombredanne Apr 23, 2022
3dc5dd8
Adopt new handler design for PyPI packages
pombredanne Apr 23, 2022
adc0862
Adopt new handler design for Dart pub packages
pombredanne Apr 23, 2022
2cd448c
Adopt new handler design for README files
pombredanne Apr 23, 2022
0db6803
Add new handler for etc/os-release files
pombredanne Apr 23, 2022
296176a
Improve package handling
pombredanne Apr 23, 2022
b5a126a
Align CLI and summary code with packagedcode
pombredanne Apr 23, 2022
ba7dd22
Remove skeleton test suite
pombredanne Apr 23, 2022
8e07301
Add doc on expected test file regeneration
pombredanne Apr 23, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
23 changes: 23 additions & 0 deletions docs/source/contribute/contrib_dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,30 @@ These are enabled by adding a ``--test-suite`` option to the pytest command.
extensive data-driven and data validations (for package, copyright and license
detection)

In some cases we need to regenerate test data when expected behavious/result data
structures change, and we have an environement variable to regenerate test data.
`SCANCODE_REGEN_TEST_FIXTURES` is present in `scancode_config` and this can be
set to regenerate test data for specific tests like this:

``SCANCODE_REGEN_TEST_FIXTURES=yes pytest -vvs tests/packagedcode/test_package_models.py``

This command will only regenerate test data for only the tests in `test_package_models.py`,
and we can further specify the tests to regen by using more pytest options like `--lf` and
`-k test_instances`.

If test data is regenerated, it is important to review the diff for test files and
carefully go through all of it to make sure there are no unintended changes there,
and then commit all the regenerated test data.

To help debug in scancode, we use logging. There are different environement variables
you need to set to turn on logging. In packagedcode::

``SCANCODE_DEBUG_PACKAGE=yes pytest -vvs tests/packagedcode/ --lf``

Or set the ``TRACE`` variable to ``True``. This enables ``logger_debug`` functions
logging variables and shows code execution paths by logging and printing the logs
in the terminal. If debugging full scans run by click, you have to raise exceptions
in addition to setting the TRACE to enable logging.

.. _scancode_toolkit_development_thirdparty_libraries:

Expand Down
12 changes: 6 additions & 6 deletions setup-mini.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ install_requires =
chardet >= 3.0.0
click >= 6.7, !=7.0
colorama >= 0.3.9
commoncode >= 30.0.0
commoncode >= 30.1.1
container-inspector >= 30.0.0
debian-inspector >= 30.0.0
dparse2 >= 0.6.0
fasteners
Expand Down Expand Up @@ -175,14 +176,13 @@ scancode_scan =
# module for details and doc.
scancode_post_scan =
summary = summarycode.summarizer:ScanSummary
summary2 = summarycode.summarizer2:ScanSummary
summary-keeping-details = summarycode.summarizer:ScanSummaryWithDetails
summary-key-files = summarycode.summarizer:ScanKeyFilesSummary
summary-by-facet = summarycode.summarizer:ScanByFacetSummary
tallies = summarycode.tallies:Tallies
tallies-with-details = summarycode.tallies:TalliesWithDetails
tallies-key-files = summarycode.tallies:KeyFilesTallies
tallies-by-facet = summarycode.tallies:FacetTallies
license-clarity-score = summarycode.score:LicenseClarityScore
license-policy = licensedcode.plugin_license_policy:LicensePolicy
mark-source = scancode.plugin_mark_source:MarkSource
classify-package = summarycode.classify:PackageTopAndKeyFilesTagger
is-license-text = licensedcode.plugin_license_text:IsLicenseText
filter-clues = cluecode.plugin_filter_clues:RedundantCluesFilter
consolidate = summarycode.plugin_consolidate:Consolidator
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ install_requires =
click >= 6.7, !=7.0
colorama >= 0.3.9
commoncode >= 30.1.1
container-inspector >= 30.0.0
debian-inspector >= 30.0.0
dparse2 >= 0.6.0
fasteners
Expand Down Expand Up @@ -184,7 +185,6 @@ scancode_post_scan =
license-clarity-score = summarycode.score:LicenseClarityScore
license-policy = licensedcode.plugin_license_policy:LicensePolicy
mark-source = scancode.plugin_mark_source:MarkSource
classify-package = summarycode.classify:PackageTopAndKeyFilesTagger
is-license-text = licensedcode.plugin_license_text:IsLicenseText
filter-clues = cluecode.plugin_filter_clues:RedundantCluesFilter
consolidate = summarycode.plugin_consolidate:Consolidator
Expand Down
5 changes: 4 additions & 1 deletion src/formattedcode/output_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#
import attr
import csv

import saneyaml
Expand Down Expand Up @@ -231,6 +232,8 @@ def get_package_columns(_columns=set()):

from packagedcode.models import PackageData

package_data_fields = [field.name for field in attr.fields(PackageData)]

# exclude some columns for now that contain list of items
excluded_columns = {
# list of strings
Expand All @@ -252,7 +255,7 @@ def get_package_columns(_columns=set()):
'notice_url',
]

fields = PackageData.fields() + extra_columns
fields = package_data_fields + extra_columns
_columns = set(f for f in fields if f not in excluded_columns)
return _columns

Expand Down
11 changes: 8 additions & 3 deletions src/packagedcode/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,24 @@ Taking Python as a main example a package can exist in multiple forms:
file type with metadata such as Windows DLLs. Additional markers may also include
"namespaces" such as Java or Python imports, C/C++ namespace declarations.

2. **parse and collect the package manifest(s)** metadata. For Python, this means
2. **parse and collect the package datafile or manifest(s)** metadata. For Python, this means
extracting name, version, authorship, declared licensing and declared dependencies as
found in the any of the package descriptor files (e.g. a `setup.py` file,
`requirements` file(s) or any of the `*-dist-info` or `*-egg-info` dir files such as
a `metadata.json`). Other package formats have their own metatada that may be more or
a `metadata.json`). Other package datafile formats have their own metatada that may be more or
less comprehensive in the breadth and depth of information they offer (e.g.
`.nuspec`, `package.json`, `bower.json`, Godeps, etc...). These metadata include the
declared dependencies (and in some cases the fully resolved dependencies too such as
with Gemfile.lock). Finally, all the different packages formats and data are
normalized and stored in a common data structure abstracting the small differences of
naming and semantics that may exists between all the different package formats.

Once collected, these data are then injected in the `packages` section of the scan.
Once collected, these data are then injected in the `package_data` section of a file scan
for each recognized package datafile.

3. **assemble multiple package datafile** as top level packages.



What code in `packagedcode` is not meant to do:

Expand Down
Loading