Skip to content

Commit 477a0f4

Browse files
authored
Merge pull request #2933 from nexB/single-package-data-file
Process single package data file correctly
2 parents b5fa441 + c547ae0 commit 477a0f4

File tree

7 files changed

+406
-5
lines changed

7 files changed

+406
-5
lines changed

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ chardet==4.0.0
99
charset-normalizer==2.0.12
1010
click==8.0.4
1111
colorama==0.4.4
12-
commoncode==30.1.1
12+
commoncode==30.1.2
1313
construct==2.10.68
1414
cryptography==36.0.1
1515
debian-inspector==30.0.0

setup-mini.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ install_requires =
6969
chardet >= 3.0.0
7070
click >= 6.7, !=7.0
7171
colorama >= 0.3.9
72-
commoncode >= 30.1.1
72+
commoncode >= 30.1.2
7373
container-inspector >= 30.0.0
7474
debian-inspector >= 30.0.0
7575
dparse2 >= 0.6.0

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ install_requires =
6969
chardet >= 3.0.0
7070
click >= 6.7, !=7.0
7171
colorama >= 0.3.9
72-
commoncode >= 30.1.1
72+
commoncode >= 30.1.2
7373
container-inspector >= 30.0.0
7474
debian-inspector >= 30.0.0
7575
dparse2 >= 0.6.0

src/packagedcode/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@
108108
TRACE = SCANCODE_DEBUG_PACKAGE_API
109109
TRACE_UPDATE = SCANCODE_DEBUG_PACKAGE_API
110110

111+
111112
def logger_debug(*args):
112113
pass
113114

115+
114116
logger = logging.getLogger(__name__)
115117

116118
if TRACE or TRACE_UPDATE:
@@ -1081,7 +1083,10 @@ def assemble_from_many_datafiles(cls, datafile_name_patterns, directory, codebas
10811083
if not codebase.has_single_resource:
10821084
siblings = list(directory.children(codebase))
10831085
else:
1084-
siblings = [directory]
1086+
if directory:
1087+
siblings = [directory]
1088+
else:
1089+
siblings = []
10851090

10861091
pkgdata_resources = []
10871092

Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
Metadata-Version: 2.1
2+
Name: scancode-toolkit
3+
Version: 31.0.0b1
4+
Summary: ScanCode is a tool to scan code for license, copyright, package and their documented dependencies and other interesting facts.
5+
Home-page: https://github.com/nexB/scancode-toolkit
6+
Author: nexB. Inc. and others
7+
Author-email: info@aboutcode.org
8+
License: Apache-2.0 AND CC-BY-4.0 AND LicenseRef-scancode-other-permissive AND LicenseRef-scancode-other-copyleft
9+
Keywords: open source,scan,license,package,dependency,copyright,filetype,author,extract,licensing,scan,sca,SBOM,spdx,cyclonedx
10+
Platform: UNKNOWN
11+
Classifier: Development Status :: 5 - Production/Stable
12+
Classifier: Intended Audience :: Developers
13+
Classifier: Programming Language :: Python :: 3
14+
Classifier: Programming Language :: Python :: 3 :: Only
15+
Classifier: Programming Language :: Python :: 3.6
16+
Classifier: Programming Language :: Python :: 3.7
17+
Classifier: Programming Language :: Python :: 3.8
18+
Classifier: Programming Language :: Python :: 3.9
19+
Classifier: Programming Language :: Python :: 3.10
20+
Classifier: Topic :: Software Development
21+
Classifier: Topic :: Utilities
22+
Requires-Python: >=3.6.*
23+
Description-Content-Type: text/x-rst
24+
Provides-Extra: full
25+
Provides-Extra: testing
26+
Provides-Extra: docs
27+
Provides-Extra: packages
28+
License-File: apache-2.0.LICENSE
29+
License-File: NOTICE
30+
License-File: AUTHORS.rst
31+
License-File: CHANGELOG.rst
32+
License-File: CODE_OF_CONDUCT.rst
33+
License-File: cc-by-4.0.LICENSE
34+
35+
================
36+
ScanCode toolkit
37+
================
38+
39+
A typical software project often reuses hundreds of third-party packages.
40+
License and origin information is not always easy to find and not normalized:
41+
ScanCode discovers and normalizes this data for you.
42+
43+
Read more about ScanCode here: `scancode-toolkit.readthedocs.io
44+
<https://scancode-toolkit.readthedocs.io/>`_.
45+
46+
Check out the code at https://github.com/nexB/scancode-toolkit
47+
48+
49+
Why use ScanCode?
50+
=================
51+
52+
- As a **standalone command-line tool**, ScanCode is **easy to install**, run,
53+
and embed in your CI/CD processing pipeline.
54+
It runs on **Windows, macOS, and Linux**.
55+
56+
- ScanCode is **used by several projects and organizations** such as
57+
the `Eclipse Foundation <https://www.eclipse.org>`_,
58+
`OpenEmbedded.org <https://www.openembedded.org>`_,
59+
the `FSFE <https://www.fsfe.org>`_,
60+
the `FSF <https://www.fsf.org>`_,
61+
`OSS Review Toolkit <http://oss-review-toolkit.org>`_,
62+
`ClearlyDefined.io <https://clearlydefined.io/>`_,
63+
`RedHat Fabric8 analytics <https://github.com/fabric8-analytics>`_,
64+
and many more.
65+
66+
- ScanCode detects licenses, copyrights, package manifests, direct dependencies,
67+
and more both in **source code** and **binary** files and is considered as the
68+
best-in-class and reference tool in this domain, re-used as the core tools for
69+
software composition data collection by several open source tools.
70+
71+
- ScanCode provides the **most accurate license detection engine** and does a
72+
full comparison (also known as diff or red line comparison) between a database
73+
of license texts and your code instead of relying only on approximate regex
74+
patterns or probabilistic search, edit distance or machine learning.
75+
76+
- Written in Python, ScanCode is **easy to extend with plugins** to contribute
77+
new and improved scanners, data summarization, package manifest parsers, and
78+
new outputs.
79+
80+
- You can save your scan results as **JSON, HTML, CSV or SPDX** or create your
81+
own format with Jinja templates.
82+
83+
- You can also organize and run ScanCode server-side with the
84+
companion `ScanCode.io web app <https://github.com/nexB/scancode.io>`_
85+
to organize and store multiple scan projects including scripted scanning pipelines.
86+
87+
- ScanCode is **actively maintained**, has a **growing users and contributors
88+
community**.
89+
90+
- ScanCode is heavily **tested** with an automated test suite of over **20,000 tests**.
91+
92+
- ScanCode has an extensive and growing documentation.
93+
94+
- ScanCode can process these packages, build manifest and lockfile formats to extract metadata:
95+
Alpine packages, BUCK files, ABOUT files, Android apps, Autotools, Bazel,
96+
JavaScript Bower, Java Axis, MS Cab, Rust Cargo, Chef Chrome apps,
97+
PHP Composer and composer.lock, Conda, CPAN, Debian, Apple dmg,
98+
Java EAR, WAR, JAR, FreeBSD packages, Rubygems gemspec, Gemfile and Gemfile.lock,
99+
Go modules, Haxe packages, InstallShield installers, iOS apps, ISO images,
100+
Apache IVY, JBoss Sar, R CRAN, Apache Maven, Meteor, Mozilla extensions,
101+
MSI installers, JavaScript npm packages, package-lock.json, yarn.lock,
102+
NSIS Installers, NugGet, OPam, Cocoapods, Python PyPI setup.py, setup.cfg, and
103+
several related lockfile formats, semi structured README
104+
files such as README.android, README.chromium, README.facebook, README.google,
105+
README.thirdparty, RPMs, Shell Archives, Squashfs images, Java WAR, Windows executables.
106+
107+
108+
See our `roadmap <https://scancode-toolkit.readthedocs.io/en/latest/contribute/roadmap.html>`_
109+
for upcoming features.
110+
111+
112+
Build and tests status
113+
======================
114+
115+
We run tests on multiple CIs to ensure a good platform compabitility and on
116+
multiple version of Windows, Linux and macOS.
117+
118+
+--------------+--------------+--------------+
119+
| **Appveyor** | **Azure** | **RTD Build**|
120+
+==============+==============+==============+
121+
| |appveyor| | |azure| | |docs-rtd| |
122+
+--------------+--------------+--------------+
123+
124+
125+
Documentation
126+
=============
127+
128+
The ScanCode documentation is hosted at `scancode-toolkit.readthedocs.io <https://scancode-toolkit.readthedocs.io/en/latest/>`_.
129+
130+
If you are new to Scancode, start `here <https://scancode-toolkit.readthedocs.io/en/latest/getting-started/newcomer.html>`_.
131+
132+
Other Important Documentation Pages:
133+
134+
- A `synopsis <https://scancode-toolkit.readthedocs.io/en/latest/cli-reference/synopsis.html>`_
135+
of ScanCode command line options.
136+
137+
- Tutorials on:
138+
139+
- `How to run a scan <https://scancode-toolkit.readthedocs.io/en/latest/tutorials/how_to_run_a_scan.html>`_
140+
- `How to visualize scan results <https://scancode-toolkit.readthedocs.io/en/latest/tutorials/how_to_visualize_scan_results.html>`_
141+
142+
- An exhaustive list of `all available options <https://scancode-toolkit.readthedocs.io/en/latest/cli-reference/list-options.html>`_
143+
144+
- Documentation on `Contributing to Code Development <https://scancode-toolkit.readthedocs.io/en/latest/contribute/contrib_dev.html>`_
145+
146+
- Documentation on `Plugin Architecture <https://scancode-toolkit.readthedocs.io/en/latest/plugins/plugin_arch.html>`_
147+
148+
- `FAQ <https://scancode-toolkit.readthedocs.io/en/latest/misc/faq.html>`_
149+
150+
See also https://aboutcode.org for related companion projects and tools.
151+
152+
153+
Installation
154+
============
155+
156+
Before installing ScanCode make sure that you have installed the prerequisites
157+
properly. This means installing Python (Python 3.6 or higher is required).
158+
159+
See `prerequisites <https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#prerequisites>`_
160+
for detailed information on the support platforms and Python versions.
161+
162+
There are a few common ways to `install ScanCode <https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html>`_.
163+
164+
- `*Recommended* installation as an application: Download a release archive, extract and run.
165+
<https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#installation-as-an-application-downloading-releases>`_
166+
167+
- `Development installation from source code using a git clone
168+
<https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#installation-from-source-code-git-clone>`_
169+
170+
- `Development installation as a library with "pip install scancode-toolkit"
171+
<https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#pip-install>`_
172+
173+
- `Run in a Docker container with a git clone and "docker run"
174+
<https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#installation-via-docker>`_
175+
176+
177+
Quick Start
178+
===========
179+
180+
Note the `commands variation <https://scancode-toolkit.readthedocs.io/en/latest/getting-started/install.html#commands-variation>`_
181+
across installation methods and platforms.
182+
183+
You can run an example scan printed on screen as JSON::
184+
185+
./scancode -clip --json-pp - samples
186+
187+
Follow the `How to Run a Scan <https://scancode-toolkit.readthedocs.io/en/latest/tutorials/how_to_run_a_scan.html>`_
188+
tutorial to perform a basic scan on the ``samples`` directory distributed by
189+
default with Scancode.
190+
191+
See more command examples::
192+
193+
./scancode --examples
194+
195+
See `How to select what will be detected in a scan
196+
<https://scancode-toolkit.readthedocs.io/en/latest/tutorials/how_to_set_what_will_be_detected_in_a_scan.html>`_
197+
and `How to specify the output format <https://scancode-toolkit.readthedocs.io/en/latest/tutorials/how_to_format_scan_output.html>`_
198+
for more information.
199+
200+
You can also refer to the `command line options synopsis
201+
<https://scancode-toolkit.readthedocs.io/en/latest/cli-reference/synopsis.html>`_
202+
and an exhaustive list of `all available command line options
203+
<https://scancode-toolkit.readthedocs.io/en/latest/cli-reference/list-options.html>`_.
204+
205+
206+
Archive extraction
207+
==================
208+
209+
By default ScanCode does not extract files from tarballs, zip files, and
210+
other archives as part of the scan. The archives that exist in a codebase
211+
must be extracted before running a scan: `extractcode` is a bundled utility
212+
behaving as a mostly-universal archive extractor. For example, this command will
213+
recursively extract the mytar.tar.bz2 tarball in the mytar.tar.bz2-extract
214+
directory::
215+
216+
./extractcode mytar.tar.bz2
217+
218+
See `all extractcode options <https://scancode-toolkit.readthedocs.io/en/latest/cli-reference/list-options.html#all-extractcode-options>`_
219+
and `how to extract archives <https://scancode-toolkit.readthedocs.io/en/latest/tutorials/how_to_extract_archives.html>`_ for details.
220+
221+
222+
Support
223+
=======
224+
225+
If you have a problem, a suggestion or found a bug, please enter a ticket at:
226+
https://github.com/nexB/scancode-toolkit/issues
227+
228+
For discussions and chats, we have:
229+
230+
* an official Gitter channel for `web-based chats
231+
<https://gitter.im/aboutcode-org/discuss>`_.
232+
Gitter is also accessible via an `IRC bridge <https://irc.gitter.im/>`_.
233+
There are other AboutCode project-specific channels available there too.
234+
235+
* an official `#aboutcode` IRC channel on liberachat (server web.libera.chat).
236+
This channel receives build and commit notifications and can be noisy.
237+
You can use your favorite IRC client or use the `web chat
238+
<https://web.libera.chat/?#aboutcode>`_.
239+
240+
241+
Source code and downloads
242+
=========================
243+
244+
* https://github.com/nexB/scancode-toolkit/releases
245+
* https://github.com/nexB/scancode-toolkit.git
246+
* https://pypi.org/project/scancode-toolkit/
247+
* https://github.com/nexB/scancode-thirdparty-src.git
248+
249+
250+
License
251+
=======
252+
253+
* Apache-2.0 as the overall license
254+
* CC-BY-4.0 for reference datasets (initially was in the Public Domain).
255+
* Multiple other secondary permissive or copyleft licenses (LGPL, MIT,
256+
BSD, GPL 2/3, etc.) for third-party components.
257+
258+
259+
See the NOTICE file and the .ABOUT files that document the origin and license of
260+
the third-party code used in ScanCode for more details.
261+
262+
263+
.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/4webymu0l2ip8utr?svg=true
264+
:target: https://travis-ci.org/nexB/scancode-toolkit
265+
:alt: Appveyor tests status (Windows)
266+
267+
.. |azure| image:: https://dev.azure.com/nexB/scancode-toolkit/_apis/build/status/nexB.scancode-toolkit?branchName=develop
268+
:target: https://dev.azure.com/nexB/scancode-toolkit/_build/latest?definitionId=1&branchName=develop
269+
:alt: Azure tests status (Linux, macOS, Windows)
270+
271+
.. |docs-rtd| image:: https://readthedocs.org/projects/scancode-toolkit/badge/?version=latest
272+
:target: https://scancode-toolkit.readthedocs.io/en/latest/?badge=latest
273+
:alt: Documentation Status
274+
275+

0 commit comments

Comments
 (0)