fix: skip PEP 508 marker-constrained packages in pip provider#400
fix: skip PEP 508 marker-constrained packages in pip provider#400ruromero merged 3 commits intoguacsec:mainfrom
Conversation
Review Summary by QodoSkip PEP 508 marker-constrained uninstalled packages in pip provider
WalkthroughsDescription• Skip PEP 508 marker-constrained packages not installed in current environment • Strip marker suffixes from version strings before comparison • Add comprehensive test with mocked pip data validating marker handling Diagramflowchart LR
A["Requirements with markers"] --> B["Check for semicolon marker"]
B --> C["Strip marker from version"]
C --> D["Compare versions"]
B --> E["Check if package installed"]
E --> F{Package in cache?}
F -->|No| G["Skip package"]
F -->|Yes| H["Include in SBOM"]
File Changes1. src/main/java/io/github/guacsec/trustifyda/utils/PythonControllerBase.java
|
Code Review by Qodo
|
Verification Report for TC-4044 (commit 96dae1e)
Acceptance Criteria Breakdown
Review Feedback Sub-tasks
🤖 Generated with Claude Code |
|
/review |
|
Persistent review updated to latest commit c1292e7 |
Verification Report for TC-4044 (commit c1292e7)
Overall: FAILIssues requiring attention:
Advisory (non-blocking):
This comment was AI-generated by sdlc-workflow/verify-pr v0.5.11. |
…vironment When a requirements.txt contains packages with environment markers (e.g., `pywin32==306 ; platform_system == "Windows"`), pip only installs packages whose markers match the current platform. The component analysis now detects the semicolon marker separator and silently skips packages that have markers but are not present in the pip freeze cache, instead of throwing a PackageNotInstalledException. Also strips marker suffixes from version strings before version-match comparison. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ss requirements getDependencyName() picked up operators from marker expressions (e.g., == in sys_platform == "win32") when a requirement had no version operator, producing malformed names and cache misses. Strip the marker suffix (;) before scanning for version operators in both getDependencyName() and the version matching block in getDependenciesImpl(). Implements TC-4085 Assisted-by: Claude Code
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
Summary
;separator) that are not installed in the current pip environment, instead of throwingPackageNotInstalledExceptiongetDependencyName()to strip PEP 508 marker suffix before scanning for version operators, preventing malformed names for marker-only requirements (TC-4085)getDependenciesImpl()to prevent false-positive==detection from marker expressionsCloses: TC-4044
Test plan
test_marker_constrained_uninstalled_packages_are_skipped_in_component_analysispassestest_marker_only_installed_packages_are_included_in_component_analysispassesget_Dependency_Name_with_markerspassesmvn spotless:applyproduces no changes🤖 Generated with Claude Code