Expand matching of requirements.txt file to include any prefixes or suffixes (#168)

* Expand matching of requirements.txt file to include any prefixes or suffixes

Signed-off-by: Samuel Dacanay <sam.dacanay@anchore.com>

* Add some test cases to integration test (ensure syft can pick up multiple requirements files)

Signed-off-by: Samuel Dacanay <sam.dacanay@anchore.com>

* Run lint-fix

Signed-off-by: Samuel Dacanay <sam.dacanay@anchore.com>
This commit is contained in:
Sam Dacanay 2020-09-08 10:23:37 -07:00 committed by GitHub
parent df7c83c9b0
commit 11334b632e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 2 deletions

View file

@ -20,7 +20,7 @@ func New() *Cataloger {
globParsers := map[string]common.ParserFn{
"**/*egg-info/PKG-INFO": parseEggMetadata,
"**/*dist-info/METADATA": parseWheelMetadata,
"**/requirements.txt": parseRequirementsTxt,
"**/*requirements*.txt": parseRequirementsTxt,
"**/poetry.lock": parsePoetryLock,
"**/setup.py": parseSetup,
}

View file

@ -81,7 +81,13 @@ var cases = []struct {
pkgType: pkg.PythonRequirementsPkg,
pkgLanguage: pkg.Python,
pkgInfo: map[string]string{
"flask": "4.0.0",
"flask": "4.0.0",
"python-dateutil": "2.8.1",
"python-swiftclient": "3.8.1",
"pytz": "2019.3",
"jsonschema": "2.6.0",
"passlib": "1.7.2",
"pathlib": "1.0.1",
},
},
{

View file

@ -0,0 +1,3 @@
jsonschema==2.6.0
passlib==1.7.2
pathlib==1.0.1

View file

@ -0,0 +1,3 @@
python-dateutil==2.8.1
python-swiftclient==3.8.1
pytz==2019.3