Skip to content

Commit

Permalink
fix: bug with options object propagation in stack and component analy…
Browse files Browse the repository at this point in the history
…sis for python

Signed-off-by: Zvi Grinberg <[email protected]>
  • Loading branch information
zvigrinberg committed Oct 31, 2023
1 parent 9333777 commit 8fe8a8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/providers/python_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ export default class Python_controller {
throw new Error('fail invoking pip freeze to fetch all installed dependencies in environment --> ' + err.message)
}
}).toString();
//debug
// freezeOutput = "alternative pip freeze output goes here for debugging"
let lines = freezeOutput.split(EOL)
let depNames = lines.map( line => getDependencyName(line)).join(" ")
let pipShowOutput = execSync(`${this.pathToPipBin} show ${depNames}`, err =>{
Expand All @@ -157,7 +159,7 @@ export default class Python_controller {
}
}).toString();
let allPipShowDeps = pipShowOutput.split( EOL +"---" + EOL);
let matchManifestVersions = getCustom("MATCH_MANIFEST_VERSIONS","true");
let matchManifestVersions = getCustom("MATCH_MANIFEST_VERSIONS","true",this.options);
let linesOfRequirements = fs.readFileSync(this.pathToRequirements).toString().split(EOL).filter( (line) => !line.startsWith("#")).map(line => line.trim())
let CachedEnvironmentDeps = {}
allPipShowDeps.forEach( (record) => {
Expand Down
2 changes: 1 addition & 1 deletion src/providers/python_pip.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function getSbomForComponentAnalysis(data, opts = {}) {
let tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'exhort_'))
let tmpRequirementsPath = path.join(tmpDir, 'requirements.txt')
fs.writeFileSync(tmpRequirementsPath, data)
let pythonController = new Python_controller(createVirtualPythonEnv === "false",binaries.pip,binaries.python,tmpRequirementsPath)
let pythonController = new Python_controller(createVirtualPythonEnv === "false",binaries.pip,binaries.python,tmpRequirementsPath,opts)
let dependencies = pythonController.getDependencies(false);
let sbom = new Sbom();
sbom.addRoot(toPurl("root",undefined))
Expand Down

0 comments on commit 8fe8a8c

Please sign in to comment.