aboutcode-org / aboutcode-org/scancode-toolkit

Scancode fails to inventory package manifest files

未关闭
#2,408 17 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug package scan
主要语言
Python
星标
2.6k
派生
791
平均合并
1 天 12 小时
30 天内合并 PR
5

描述

### Description

Hey there,

Scancode appears to only scan package manifest files based on the name AND if the scan is run in the same directory. For example, if my python manifest file is named `dev.txt`, scancode does not appear to inventory it. However, if I rename the file to `requirements.txt` **_AND_** run scancode from the same directory, scancode will inventory it and the package dependencies will populate in the json output.. as shown below. There's also a possibility I am using it wrong and this is expected.

### How To Reproduce

#### Here we run scancode against the entire directory (no package dependencies shown)

Command: `scancode -clpeui --json-pp out.json flask-sqlalchemy`

```
{
"path": "flask-sqlalchemy/requirements/dev.txt", ### name is dev.txt
"type": "file",
"name": "dev.txt",
"base_name": "dev",
"extension": ".txt",
"size": 2363,
"date": "2021-02-19",
"sha1": "f3ec0c8082673263ff92cf965fa104bc9c11e078",
"md5": "80d6553a1d0caf914fb7ff299d742b2a",
"sha256": "53dd0a09ff4313129309e0231463226372482868af9601fedf8758d2f74cea74",
"mime_type": "text/plain",
"file_type": "ASCII text",
"programming_language": null,
"is_binary": false,
"is_text": true,
"is_archive": false,
"is_media": false,
"is_source": false,
"is_script": false,
"licenses": [],
"license_expressions": [],
"percentage_of_license_text": 0,
"copyrights": [],
"holders": [],
"authors": [],
"packages": [], ### NOTHING HERE
"emails": [],
"urls": [],
"files_count": 0,
"dirs_count": 0,
"size_count": 0,
"scan_errors": []
},
```

#### Now we run scancode in the same directory against the file and we get package dependencies

Command: `scancode -clpeui --json-pp out.json requirements.txt`

```
"packages": [ ### NOW WE HAVE DATA
{
"type": "pypi",
"namespace": null,
"name": null,
"version": null,
"qualifiers": {},
"subpath": null,
"primary_language": "Python",
"description": null,
"release_date": null,
"parties": [],
"keywords": [],
"homepage_url": null,
"download_url": null,
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"bug_tracking_url": null,
"code_view_url": null,
"vcs_url": null,
"copyright": null,
"license_expression": null,
"declared_license": null,
"notice_text": null,
"root_path": null,
"dependencies": [
{
"purl": "pkg:pypi/alabaster@0.7.12",
"requirement": "==0.7.12",
"scope": "dependencies",
```

> Tell us how to reproduce the issue.

`scancode -clpeui --json-pp out.json flask-sqlalchemy`

`scancode -clpeui --json-pp out.json requirements.txt`

### System configuration

`Python 3.6.13`

`FROM python:3.6-slim-buster` is the base docker image

Version: ScanCode version 21.2.9

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。