python cataloger: allow dots in python package names (#3070)

Signed-off-by: mikcl <mikesmikes400@gmail.com>
This commit is contained in:
mikcl 2024-07-25 18:56:10 +01:00 committed by GitHub
parent 36f95d6828
commit b3848f780f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 1 deletions

View File

@ -26,7 +26,7 @@ const (
// --hash=sha256:e9535b8c84dc9571a48999094fda7f33e63c3f1b74f3e5f3ac0105a58405bb65 # some comment
// namePattern matches: requests[security]
namePattern = `(?P<name>\w[\w\[\],\s-_]+)`
namePattern = `(?P<name>\w[\w\[\],\s-_\.]+)`
// versionConstraintPattern matches: == 2.8.*
versionConstraintPattern = `(?P<versionConstraint>([^\S\r\n]*[~=>!<]+\s*[0-9a-zA-Z.*]+[^\S\r\n]*,?)+)?(@[^\S\r\n]*(?P<url>[^;]*))?`

View File

@ -53,6 +53,18 @@ func TestParseRequirementsTxt(t *testing.T) {
Markers: "python_version < '3.8'",
},
},
{
Name: "dots-._allowed",
Version: "1.0.0",
PURL: "pkg:pypi/dots-._allowed@1.0.0",
Locations: locations,
Language: pkg.Python,
Type: pkg.PythonPkg,
Metadata: pkg.PythonRequirementsEntry{
Name: "dots-._allowed",
VersionConstraint: "== 1.0.0",
},
},
{
Name: "argh",
Version: "0.26.2",

View File

@ -8,6 +8,7 @@ bar >= 1.0.0, <= 2.0.0, \
-r other-requirements.txt
--requirements super-secretrequirements.txt
SomeProject ==5.4 ; python_version < '3.8'
dots-._allowed == 1.0.0
coverage != 3.5 # Version Exclusion. Anything except version 3.5
numpyNew; sys_platform == 'win32'
numpy >= 3.4.1; sys_platform == 'win32'